From 26bb3c6b8a179d4c1377d4ed37f532e1f9d9f587 Mon Sep 17 00:00:00 2001 From: Giorgi Merebashvili Date: Sun, 15 Feb 2026 00:01:05 +0400 Subject: [PATCH 1/8] Add pnpm installation in tests workflow --- .github/workflows/tests.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 21de126..79c81dd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -31,6 +31,15 @@ jobs: - run: pip install -e .[tests] + - uses: actions/setup-node@v4 + with: + node-version: 24 + cache: 'pnpm' + + - uses: pnpm/action-setup@v4 + with: + version: 9 + - run: scripts/check-prettier.sh - run: cargo fmt --all -- --check - run: cargo clippy --workspace -- -D warnings From 912fe8df3027d0930c914b665d368f3c3842f937 Mon Sep 17 00:00:00 2001 From: Giorgi Merebashvili Date: Sun, 15 Feb 2026 00:08:28 +0400 Subject: [PATCH 2/8] Update node version --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 79c81dd..8c7e993 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -33,7 +33,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version: 24 + node-version: 20 cache: 'pnpm' - uses: pnpm/action-setup@v4 From 3e065d54e56d0116ed390a0bef5a0384d12855a4 Mon Sep 17 00:00:00 2001 From: Giorgi Merebashvili Date: Sun, 15 Feb 2026 00:11:44 +0400 Subject: [PATCH 3/8] Remove node setup --- .github/workflows/tests.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8c7e993..855c95d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -31,11 +31,6 @@ jobs: - run: pip install -e .[tests] - - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'pnpm' - - uses: pnpm/action-setup@v4 with: version: 9 From 45e053d3f4f51f54116406b3e00b85cfda962102 Mon Sep 17 00:00:00 2001 From: Giorgi Merebashvili Date: Sun, 15 Feb 2026 00:33:30 +0400 Subject: [PATCH 4/8] Fix redis connection --- .github/workflows/tests.yml | 26 ++++++++++++++++++-------- crates/fluxqueue-worker/src/main.rs | 4 ++-- crates/fluxqueue-worker/src/worker.rs | 23 +++++++++++++---------- 3 files changed, 33 insertions(+), 20 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 855c95d..a212ede 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,8 +8,25 @@ on: branches: - main +env: + REDIS_VERSION: 8.4.0 + jobs: - linux: + check-style: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + - uses: pnpm/action-setup@v4 + with: + version: 9 + + - run: scripts/check-prettier.sh + - run: cargo fmt --all -- --check + - run: cargo clippy --workspace -- -D warnings + + tests-linux: runs-on: ubuntu-latest strategy: matrix: @@ -31,12 +48,5 @@ jobs: - run: pip install -e .[tests] - - uses: pnpm/action-setup@v4 - with: - version: 9 - - - run: scripts/check-prettier.sh - - run: cargo fmt --all -- --check - - run: cargo clippy --workspace -- -D warnings - run: pytest tests/ - run: cargo test --workspace --locked diff --git a/crates/fluxqueue-worker/src/main.rs b/crates/fluxqueue-worker/src/main.rs index f1d9af6..c7a8020 100644 --- a/crates/fluxqueue-worker/src/main.rs +++ b/crates/fluxqueue-worker/src/main.rs @@ -70,9 +70,9 @@ async fn main() -> Result<()> { fluxqueue_worker::run_worker( shutdown_rx, concurrency, - &redis_url, + redis_url, tasks_module_path, - &queue, + queue, save_dead_tasks, ) .await diff --git a/crates/fluxqueue-worker/src/worker.rs b/crates/fluxqueue-worker/src/worker.rs index 2590405..bd836d6 100644 --- a/crates/fluxqueue-worker/src/worker.rs +++ b/crates/fluxqueue-worker/src/worker.rs @@ -18,27 +18,27 @@ use fluxqueue_common::{Task, deserialize_raw_task_data}; pub async fn run_worker( mut shutdown: watch::Receiver, concurrency: usize, - redis_url: &str, + redis_url: String, tasks_module_path: String, - queue_name: &str, + queue_name: String, save_dead_tasks: bool, ) -> Result<()> { - let redis_client = RedisClient::new(redis_url).await.map_err(|e| { + let redis_client = RedisClient::new(&redis_url).await.map_err(|e| { tracing::error!("{}", e); std::process::exit(1); })?; let redis_client = Arc::new(redis_client); - let task_functions = get_task_functions(&tasks_module_path, queue_name).map_err(|e| { + let task_functions = get_task_functions(&tasks_module_path, &queue_name).map_err(|e| { tracing::error!("{}", e); std::process::exit(1); })?; let task_names: Vec<&String> = task_functions.iter().map(|(name, _obj)| name).collect(); initial_logs( - queue_name, + &queue_name, concurrency, - redis_url, + &redis_url, &tasks_module_path, &task_names, ); @@ -630,9 +630,8 @@ mod tests { let module_path_str = get_test_module_path("test_tasks_module.py"); let redis_version = std::env::var("REDIS_VERSION").unwrap_or("latest".to_string()); - let redis_url = "redis://localhost:6379"; - GenericImage::new("redis", &redis_version) + let container = GenericImage::new("redis", &redis_version) .with_exposed_port(6379.tcp()) .with_wait_for(WaitFor::message_on_stdout("Ready to accept connections")) .with_network("bridge") @@ -641,6 +640,10 @@ mod tests { .await .expect("Failed to start Redis"); + let mapped_port = container.get_host_port_ipv4(6379).await; + let redis_url = format!("redis://localhost:{:?}", mapped_port); + let cloned_redis_url = redis_url.clone(); + let (shutdown_tx, shutdown_rx) = watch::channel(false); let worker_handle = tokio::spawn(run_worker( @@ -648,12 +651,12 @@ mod tests { 4, redis_url, module_path_str, - "default", + "default".to_string(), false, )); sleep(Duration::from_secs(5)).await; - enqueue_tasks(redis_url).await?; + enqueue_tasks(&cloned_redis_url).await?; sleep(Duration::from_secs(5)).await; let _ = shutdown_tx.send(true); From 09b029e359d7a01acd8ba2e0de49c5560c78a857 Mon Sep 17 00:00:00 2001 From: Giorgi Merebashvili Date: Sun, 15 Feb 2026 00:35:23 +0400 Subject: [PATCH 5/8] Add ruff check --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a212ede..1ee5652 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -23,6 +23,7 @@ jobs: version: 9 - run: scripts/check-prettier.sh + - run: ruff check . - run: cargo fmt --all -- --check - run: cargo clippy --workspace -- -D warnings From 0aa67af26f3615ac4418ae947168e0fb261c2bdb Mon Sep 17 00:00:00 2001 From: Giorgi Merebashvili Date: Sun, 15 Feb 2026 00:39:45 +0400 Subject: [PATCH 6/8] Fix --- .github/workflows/tests.yml | 5 ++++- pyproject.toml | 11 +---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1ee5652..54d454c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,7 +21,10 @@ jobs: - uses: pnpm/action-setup@v4 with: version: 9 - + - uses: actions/setup-python@v5 + with: + python-version: "3.13" + - run: pip install -e .[dev] - run: scripts/check-prettier.sh - run: ruff check . - run: cargo fmt --all -- --check diff --git a/pyproject.toml b/pyproject.toml index ca77b3e..2936691 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,16 +36,7 @@ Repository = "https://github.com/CCXLV/fluxqueue" Documentation = "https://fluxqueue.ccxlv.dev" [project.optional-dependencies] -dev = [ - "ruff", - "pytest-asyncio", - "python-dotenv", - "redis", - "mkdocs-material", - "mkdocstrings", - "mkdocstrings-python", - "maturin", -] +dev = ["ruff"] tests = [ "pytest-asyncio", "python-dotenv", From 1d653afccdd70bb99041b4e5396fb91bc8e58acf Mon Sep 17 00:00:00 2001 From: Giorgi Merebashvili Date: Sun, 15 Feb 2026 00:46:25 +0400 Subject: [PATCH 7/8] Fix test_run_worker --- crates/fluxqueue-worker/src/worker.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/fluxqueue-worker/src/worker.rs b/crates/fluxqueue-worker/src/worker.rs index bd836d6..4931987 100644 --- a/crates/fluxqueue-worker/src/worker.rs +++ b/crates/fluxqueue-worker/src/worker.rs @@ -640,7 +640,7 @@ mod tests { .await .expect("Failed to start Redis"); - let mapped_port = container.get_host_port_ipv4(6379).await; + let mapped_port = container.get_host_port_ipv4(6379).await?; let redis_url = format!("redis://localhost:{:?}", mapped_port); let cloned_redis_url = redis_url.clone(); From 5f34409ffbdaae3c399b52228a9b1a0005676270 Mon Sep 17 00:00:00 2001 From: Giorgi Merebashvili Date: Sun, 15 Feb 2026 00:56:34 +0400 Subject: [PATCH 8/8] Add tests-pass job --- .github/workflows/tests.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 54d454c..a3122f9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -54,3 +54,12 @@ jobs: - run: pytest tests/ - run: cargo test --workspace --locked + + tests-pass: + needs: + - check-style + - tests-linux + if: (github.repository_owner == 'ccxlv') + runs-on: ubuntu-latest + steps: + - run: echo "All tests passed ✅"