From 484f3ab64604762a4dd0c87dad5647cdc5c84ada Mon Sep 17 00:00:00 2001 From: andrussal Date: Fri, 5 Dec 2025 14:08:42 +0100 Subject: [PATCH] Package local_runner binary and reuse in smoke --- .github/workflows/build-binaries.yml | 2 + .github/workflows/lint.yml | 5 ++- examples/tests/local_runner_bin_smoke.rs | 52 +++++++++++++++++------- 3 files changed, 44 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build-binaries.yml b/.github/workflows/build-binaries.yml index 61aa858..c386913 100644 --- a/.github/workflows/build-binaries.yml +++ b/.github/workflows/build-binaries.yml @@ -63,12 +63,14 @@ jobs: # Work around flate2 1.1.6 ambiguity issues by pinning to a fixed release. cargo +nightly-2025-09-14 update -p flate2 --precise 1.1.5 cargo +nightly-2025-09-14 build --features testing --bins + cargo +nightly-2025-09-14 build --features testing --bin local_runner -p runner-examples - name: Package binaries run: | mkdir -p artifacts cp "${CARGO_TARGET_DIR}/debug/nomos-node" artifacts/ cp "${CARGO_TARGET_DIR}/debug/nomos-executor" artifacts/ cp "${CARGO_TARGET_DIR}/debug/nomos-cli" artifacts/ + cp "${CARGO_TARGET_DIR}/debug/local_runner" artifacts/ mkdir -p artifacts/circuits rsync -a "$NOMOS_CIRCUITS"/ artifacts/circuits/ tar -czf nomos-binaries.tar.gz -C artifacts . diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b5fb393..b76991b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -212,6 +212,9 @@ jobs: echo "Circuits bundle missing in nomos-binaries tarball" >&2 exit 1 fi + if [ -f "${BIN_DIR}/local_runner" ]; then + echo "LOCAL_RUNNER_BIN=${BIN_DIR}/local_runner" >> "$GITHUB_ENV" + fi - name: Download KZG params for DA (raw) run: | mkdir -p "$(dirname "${NOMOS_KZGRS_PARAMS_PATH}")" @@ -226,7 +229,7 @@ jobs: echo "NOMOS_KZGRS_PARAMS_PATH=${GITHUB_WORKSPACE}/testing-framework/assets/stack/kzgrs_test_params/kzgrs_test_params" >> "$GITHUB_ENV" - name: Run local runner smoke (ignored test) run: | - NOMOS_TESTS_KEEP_LOGS=true cargo +nightly-2025-09-14 test -p runner-examples --test local_runner_bin_smoke -- --ignored --nocapture + NOMOS_TESTS_KEEP_LOGS=true LOCAL_DEMO_RUN_SECS=60 cargo +nightly-2025-09-14 test -p runner-examples --test local_runner_bin_smoke -- --ignored --nocapture - name: Archive local smoke logs if: always() run: | diff --git a/examples/tests/local_runner_bin_smoke.rs b/examples/tests/local_runner_bin_smoke.rs index a2d1e09..98da8a9 100644 --- a/examples/tests/local_runner_bin_smoke.rs +++ b/examples/tests/local_runner_bin_smoke.rs @@ -7,16 +7,31 @@ use std::{env, path::Path, process::Command}; #[test] #[ignore = "runs local_runner binary (~2min) and requires local assets/binaries"] fn local_runner_bin_smoke() { - let output = Command::new("cargo") - .args([ - "run", - "-p", - "runner-examples", - "--bin", - "local_runner", - "--", - "--nocapture", - ]) + // Prefer a prebuilt local_runner binary (if provided), otherwise fall back to + // cargo run. + let runner_bin = env::var("LOCAL_RUNNER_BIN").ok(); + let mut cmd = match runner_bin.as_deref() { + Some(path) => { + let mut c = Command::new(path); + c.args(["--nocapture"]); + c + } + None => { + let mut c = Command::new("cargo"); + c.args([ + "run", + "-p", + "runner-examples", + "--bin", + "local_runner", + "--", + "--nocapture", + ]); + c + } + }; + + let output = cmd .env("POL_PROOF_DEV_MODE", "true") .env( "NOMOS_CIRCUITS", @@ -31,12 +46,21 @@ fn local_runner_bin_smoke() { }) .expect("NOMOS_CIRCUITS must be set or .tmp/nomos-circuits must exist"), ) - .env("LOCAL_DEMO_RUN_SECS", "120") - .env("LOCAL_DEMO_VALIDATORS", "1") - .env("LOCAL_DEMO_EXECUTORS", "1") + .env( + "LOCAL_DEMO_RUN_SECS", + env::var("LOCAL_DEMO_RUN_SECS").unwrap_or_else(|_| "120".into()), + ) + .env( + "LOCAL_DEMO_VALIDATORS", + env::var("LOCAL_DEMO_VALIDATORS").unwrap_or_else(|_| "1".into()), + ) + .env( + "LOCAL_DEMO_EXECUTORS", + env::var("LOCAL_DEMO_EXECUTORS").unwrap_or_else(|_| "1".into()), + ) .env("RUST_BACKTRACE", "1") .output() - .expect("failed to spawn cargo run"); + .expect("failed to spawn local runner"); if !output.status.success() { panic!(