From aa78e845daaf15a7895efd4e4d2e43edebbca167 Mon Sep 17 00:00:00 2001 From: bdimitrov-netzine Date: Fri, 10 Jul 2026 11:11:07 +0300 Subject: [PATCH 1/2] ci(pr): run tests across feature sets, not just default The PR `tests` job ran `cargo test` with default features only, while the feature-build matrix merely compiled the non-default feature sets. As a result, tests (and code branches) gated behind non-default features were compiled but never executed anywhere in CI. Convert the single `tests` job into a matrix: * default - full workspace, default features (unchanged) * dev-single-node-setup - re-runs the types/primary/orchestrator crates whose single-authority committee, sole-member consensus, and epoch-transition-mode unit tests are gated behind this feature. * archive-replay - evm-crate-local feature not reachable from the rayls-network bin (so the feature-build matrix can't cover it); compile-checks the alternate reth_env/chainspec/block-execution paths and re-runs the evm suite through the feature-gated test_utils branches. Each leg uses its own rust-cache shared-key so their feature-divergent target dirs don't clobber one another, and fail-fast is disabled so one failing feature set doesn't mask the others. --- .github/workflows/pr.yaml | 44 ++++++++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index e267bbb..7860360 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -59,11 +59,45 @@ jobs: run: cargo +nightly fmt --all --check # =========================================================================== - # TESTS - Rust workspace tests + # TESTS - Rust workspace tests, across feature sets + # + # The `default` leg runs the full workspace with default features. The other + # legs re-run just the crates whose tests (or behavior) are gated behind a + # non-default feature — without them, those tests are compiled by the + # feature-build matrix but never actually EXECUTE anywhere in CI: + # * dev-single-node-setup: single-authority committee / sole-member consensus + # & epoch-transition-mode unit tests in types, primary, and orchestrator + # (plus the alternate single-node production branches those crates take). + # * archive-replay: evm-crate-local branches not reachable from the shipping + # binary, so the feature-build matrix can't cover them. + # Each leg gets its own rust-cache shared-key so their feature-divergent + # target dirs don't clobber one another. fail-fast: false so one failing + # feature set doesn't cancel the others' signal. # =========================================================================== tests: - name: Tests + name: Tests (${{ matrix.name }}) runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - name: default + cache-key: pr-tests + cmd: cargo test --workspace --exclude rayls-execution-faucet --exclude e2e-tests -- --quiet --test-threads 1 + # All three crates define `dev-single-node-setup`; orchestrator's + # variant transitively enables it in primary/worker/bridge/types. + - name: dev-single-node-setup + cache-key: pr-tests-dev + cmd: cargo test -p rayls-infrastructure-types -p rayls-consensus-primary -p rayls-middleware-orchestrator --features dev-single-node-setup -- --quiet --test-threads 1 + # archive-replay is an evm-crate-local feature — NOT reachable from the + # rayls-network bin, so the feature-build matrix can't cover it. It + # gates no dedicated tests, but `cargo test` here compile-checks the + # alternate reth_env / chainspec / block-execution paths and re-runs the + # evm suite through the feature-gated test_utils branches. This is the + # only place archive-replay gets any CI coverage. + - name: archive-replay + cache-key: pr-tests-archive-replay + cmd: cargo test -p rayls-execution-evm --features archive-replay -- --quiet --test-threads 1 steps: # exit immediately for drafts # - name: Check if draft PR @@ -86,17 +120,17 @@ jobs: toolchain: 1.91.0 components: rustfmt, rust-src, clippy - # cache target/ and cargo registry across PRs via shared-key + # cache target/ and cargo registry across PRs via shared-key (per matrix leg) - name: Cache Rust dependencies uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 with: - shared-key: pr-tests + shared-key: ${{ matrix.cache-key }} cache-on-failure: true # use cargo test (not nextest) to match what developers run locally — # nextest discovers a different set of tests, which has caused divergence - name: Run tests - run: cargo test --workspace --exclude rayls-execution-faucet --exclude e2e-tests -- --quiet --test-threads 1 + run: ${{ matrix.cmd }} # =========================================================================== # SECURITY SCAN - Trivy vulnerability scanning (filesystem/code) From 346deb3cb68dd0392c3f6277d6d9986d3d38530a Mon Sep 17 00:00:00 2001 From: bdimitrov-netzine Date: Fri, 10 Jul 2026 11:17:21 +0300 Subject: [PATCH 2/2] ci(pr): add Tests gate job so branch protection stays satisfied The matrix renamed the test job to 'Tests (${{ matrix.name }})', so its check contexts are 'Tests (default)', 'Tests (dev-single-node-setup)', etc. Branch protection requires a context named exactly 'Tests', which would then never report and would block every PR merge. Add a lightweight 'tests-gate' job displayed as 'Tests' that needs the matrix and fails unless every leg succeeded, restoring the required check without having to enumerate each leg in protection settings. --- .github/workflows/pr.yaml | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 7860360..c8dd450 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -90,11 +90,7 @@ jobs: cache-key: pr-tests-dev cmd: cargo test -p rayls-infrastructure-types -p rayls-consensus-primary -p rayls-middleware-orchestrator --features dev-single-node-setup -- --quiet --test-threads 1 # archive-replay is an evm-crate-local feature — NOT reachable from the - # rayls-network bin, so the feature-build matrix can't cover it. It - # gates no dedicated tests, but `cargo test` here compile-checks the - # alternate reth_env / chainspec / block-execution paths and re-runs the - # evm suite through the feature-gated test_utils branches. This is the - # only place archive-replay gets any CI coverage. + # rayls-network bin, so the feature-build matrix can't cover it. - name: archive-replay cache-key: pr-tests-archive-replay cmd: cargo test -p rayls-execution-evm --features archive-replay -- --quiet --test-threads 1 @@ -132,6 +128,23 @@ jobs: - name: Run tests run: ${{ matrix.cmd }} + # =========================================================================== + # TESTS GATE - stable required-check target + # =========================================================================== + tests-gate: + name: Tests + runs-on: ubuntu-latest + needs: tests + if: always() + steps: + - name: Verify all test legs passed + run: | + if [[ "${{ needs.tests.result }}" != "success" ]]; then + echo "One or more Tests matrix legs did not succeed (result: ${{ needs.tests.result }})." + exit 1 + fi + echo "All Tests matrix legs passed." + # =========================================================================== # SECURITY SCAN - Trivy vulnerability scanning (filesystem/code) # ===========================================================================