ci: Added CI/CD and release pipelines (#45)

This commit is contained in:
Vlad Frolov
2026-02-12 12:25:36 +01:00
committed by GitHub
parent 115b7f38fe
commit 09198c68ab
25 changed files with 886 additions and 161 deletions
+31 -10
View File
@@ -3,7 +3,7 @@
//! Verifies the full pairing lifecycle: upsert → list → approve → allowFrom → is_sender_allowed.
//! Uses temp directory for isolation.
use ironclaw::cli::{run_pairing_command_with_store, PairingCommand};
use ironclaw::cli::{PairingCommand, run_pairing_command_with_store};
use ironclaw::pairing::PairingStore;
use tempfile::TempDir;
@@ -19,10 +19,16 @@ fn test_pairing_flow_unknown_user_to_approved() {
let channel = "telegram";
// 1. Unknown user sends first message -> upsert creates request
let r1 = store.upsert_request(channel, "user_12345", Some(serde_json::json!({
"chat_id": 999,
"username": "alice"
}))).unwrap();
let r1 = store
.upsert_request(
channel,
"user_12345",
Some(serde_json::json!({
"chat_id": 999,
"username": "alice"
})),
)
.unwrap();
assert!(r1.created);
assert!(!r1.code.is_empty());
assert_eq!(r1.code.len(), 8);
@@ -34,7 +40,11 @@ fn test_pairing_flow_unknown_user_to_approved() {
assert_eq!(pending[0].code, r1.code);
// 3. User is not allowed yet
assert!(!store.is_sender_allowed(channel, "user_12345", Some("alice")).unwrap());
assert!(
!store
.is_sender_allowed(channel, "user_12345", Some("alice"))
.unwrap()
);
// 4. Approve via code
let approved = store.approve(channel, &r1.code).unwrap();
@@ -42,8 +52,16 @@ fn test_pairing_flow_unknown_user_to_approved() {
assert_eq!(approved.unwrap().id, "user_12345");
// 5. User is now allowed
assert!(store.is_sender_allowed(channel, "user_12345", None).unwrap());
assert!(store.is_sender_allowed(channel, "user_12345", Some("alice")).unwrap());
assert!(
store
.is_sender_allowed(channel, "user_12345", None)
.unwrap()
);
assert!(
store
.is_sender_allowed(channel, "user_12345", Some("alice"))
.unwrap()
);
// 6. Pending list is empty
let pending_after = store.list_pending(channel).unwrap();
@@ -69,7 +87,11 @@ fn test_pairing_flow_cli_approve() {
},
);
assert!(result.is_ok());
assert!(store.is_sender_allowed("telegram", "user_999", None).unwrap());
assert!(
store
.is_sender_allowed("telegram", "user_999", None)
.unwrap()
);
}
#[test]
@@ -109,4 +131,3 @@ fn test_pairing_multiple_channels_isolated() {
store.approve("slack", &r_slack.code).unwrap();
assert!(store.is_sender_allowed("slack", "user_b", None).unwrap());
}
+1 -1
View File
@@ -10,11 +10,11 @@ use std::collections::HashMap;
use std::sync::Arc;
use ironclaw::channels::Channel;
use ironclaw::pairing::PairingStore;
use ironclaw::channels::wasm::{
ChannelCapabilities, EmitRateLimitConfig, PreparedChannelModule, RegisteredEndpoint,
WasmChannel, WasmChannelRouter, WasmChannelRuntime, WasmChannelRuntimeConfig,
};
use ironclaw::pairing::PairingStore;
use tempfile::TempDir;
/// Create a test runtime for WASM channel operations.