From efd620b552800854095a0f7158302d67df4cb0f8 Mon Sep 17 00:00:00 2001 From: nomdetom Date: Tue, 21 Jul 2026 09:39:40 +0100 Subject: [PATCH 1/3] ci: enforce native-suite-count against test/ directories at PR time platformio test discovers and runs whatever test_* directories exist, so it never notices when test/native-suite-count drifts from the actual directory count. That reconciliation lived only in bin/run-tests.sh, which CI does not invoke - so a stale or unbumped count sailed through PRs (develop itself shipped 38 dirs against a 37 file). Add a standalone suite-count-check job to test_native.yml that mirrors run-tests.sh's exact counting logic and fails on a mismatch. It runs on every PR via main_matrix's test-native job, with no build step so it fails fast. Bump native-suite-count to 38 to match the current suites. clod helped too --- .github/workflows/test_native.yml | 38 +++++++++++++++++++++++++++++++ test/native-suite-count | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_native.yml b/.github/workflows/test_native.yml index 3b1b95ee8..e15f5ad62 100644 --- a/.github/workflows/test_native.yml +++ b/.github/workflows/test_native.yml @@ -10,6 +10,44 @@ env: LCOV_CAPTURE_FLAGS: --quiet --capture --include "${PWD}/src/*" --exclude '*/src/mesh/generated/*' --directory .pio/build/coverage/src --base-directory "${PWD}" jobs: + # Guard the registered native-suite total. `platformio test` discovers and runs whatever + # test_* directories exist, so it never notices when test/native-suite-count drifts from the + # actual directory count (a suite added without registering it, or the file left stale). That + # reconciliation only lives in bin/run-tests.sh, which CI does not invoke - so mirror the exact + # check here and fail the PR on a mismatch, keeping the manual count honest. + suite-count-check: + name: Native Suite Count + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@v7 + + - name: Reconcile native-suite-count with test/ directories + shell: bash + run: | + set -euo pipefail + count_file="test/native-suite-count" + if [[ ! -f $count_file ]]; then + echo "::error title=Missing native-suite-count::$count_file not found - it must record the number of test_* suite directories." + exit 1 + fi + # Same canonical set as bin/run-tests.sh: directories named test_* directly under test/. + expected_count=$(find test -maxdepth 1 -type d -name 'test_*' -printf '%f\n' | wc -l) + canonical_count=$(tr -d '[:space:]' <"$count_file") + echo "test/ directories: $expected_count" + echo "native-suite-count: $canonical_count" + if [[ $expected_count -ne $canonical_count ]]; then + if [[ $expected_count -gt $canonical_count ]]; then + hint="a suite was added - bump $count_file to $expected_count" + else + hint="a suite was removed - lower $count_file to $expected_count" + fi + echo "::error title=native-suite-count mismatch::test/ has $expected_count suite directories but $count_file says $canonical_count ($hint)." + exit 1 + fi + echo "native-suite-count matches the $expected_count suite directories." + simulator-tests: name: Native Simulator Tests runs-on: ubuntu-latest diff --git a/test/native-suite-count b/test/native-suite-count index 81b5c5d06..e522732c7 100644 --- a/test/native-suite-count +++ b/test/native-suite-count @@ -1 +1 @@ -37 +38 From d8118358af611de75f5cf168302f3bcf1c0a7911 Mon Sep 17 00:00:00 2001 From: nomdetom Date: Tue, 21 Jul 2026 21:46:11 +0100 Subject: [PATCH 2/3] nitpicks and guards --- .github/workflows/test_native.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/test_native.yml b/.github/workflows/test_native.yml index e15f5ad62..a12fe7d62 100644 --- a/.github/workflows/test_native.yml +++ b/.github/workflows/test_native.yml @@ -22,6 +22,8 @@ jobs: contents: read steps: - uses: actions/checkout@v7 + with: + persist-credentials: false - name: Reconcile native-suite-count with test/ directories shell: bash @@ -35,6 +37,10 @@ jobs: # Same canonical set as bin/run-tests.sh: directories named test_* directly under test/. expected_count=$(find test -maxdepth 1 -type d -name 'test_*' -printf '%f\n' | wc -l) canonical_count=$(tr -d '[:space:]' <"$count_file") + if ! [[ $canonical_count =~ ^[0-9]+$ ]]; then + echo "::error title=Invalid native-suite-count::$count_file must contain a single integer, got '$canonical_count'." + exit 1 + fi echo "test/ directories: $expected_count" echo "native-suite-count: $canonical_count" if [[ $expected_count -ne $canonical_count ]]; then @@ -51,6 +57,7 @@ jobs: simulator-tests: name: Native Simulator Tests runs-on: ubuntu-latest + needs: suite-count-check steps: - uses: actions/checkout@v7 with: @@ -125,6 +132,7 @@ jobs: platformio-tests: name: Native PlatformIO Tests runs-on: ubuntu-latest + needs: suite-count-check steps: - uses: actions/checkout@v7 with: From d5bb2c2bc3bfd049e5371241e4d7b94c2fa952ce Mon Sep 17 00:00:00 2001 From: nomdetom Date: Tue, 21 Jul 2026 21:54:51 +0100 Subject: [PATCH 3/3] fix a nitpicky semgrep --- .github/workflows/test_native.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test_native.yml b/.github/workflows/test_native.yml index a12fe7d62..ae669cdf0 100644 --- a/.github/workflows/test_native.yml +++ b/.github/workflows/test_native.yml @@ -21,7 +21,7 @@ jobs: permissions: contents: read steps: - - uses: actions/checkout@v7 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 with: persist-credentials: false @@ -59,7 +59,7 @@ jobs: runs-on: ubuntu-latest needs: suite-count-check steps: - - uses: actions/checkout@v7 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 with: submodules: recursive @@ -134,7 +134,7 @@ jobs: runs-on: ubuntu-latest needs: suite-count-check steps: - - uses: actions/checkout@v7 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 with: submodules: recursive @@ -195,7 +195,7 @@ jobs: - platformio-tests if: always() steps: - - uses: actions/checkout@v7 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - name: Get release version string run: echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT