From 8b8921973407c7cd19f6760fd9119af06d783b45 Mon Sep 17 00:00:00 2001 From: Jason Ross Date: Sat, 4 Jul 2026 22:34:15 -0500 Subject: [PATCH] ci: run traffic-controller unit tests as a gate job Adds a fast traffic-control-tests job (ubuntu, actions/checkout + actions/setup-python, no emulator/Gradle) that runs the 37 pure-stdlib unit tests for .github/scripts/traffic_control.py on every PR, and wires it into ci-passed's needs so a regression blocks merge instead of only being caught locally. Closes #346 Co-Authored-By: Claude Opus 4.8 --- .github/workflows/ci.yml | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 053d703..bef2971 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,6 +103,27 @@ jobs: continue-on-error: true run: python3 .github/scripts/traffic_control.py + # Fast, pure-stdlib-Python unit tests for the traffic-control decision core + # (.github/scripts/traffic_control.py / test_traffic_control.py — see the + # `traffic-control` job above). No emulator, no Gradle: this runs in seconds, + # independently of the Android jobs below, so a regression in the runner-priority + # logic fails fast and blocks merge via `ci-passed`. + traffic-control-tests: + name: Traffic-control unit tests + needs: traffic-control # order after runner-priority orchestration (P0/broken/draft preempt; P1–P9 hold-back) + runs-on: ubuntu-latest + steps: + - name: Check out source + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + + - name: Set up Python + uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 + with: + python-version: "3.x" + + - name: Run traffic-controller unit tests + run: python -m unittest discover -s .github/scripts -p 'test_*.py' -v + debug-build: name: Debug build needs: traffic-control # order after runner-priority orchestration (P0/broken/draft preempt; P1–P9 hold-back) @@ -514,13 +535,14 @@ jobs: # a (should-never-happen) traffic-control failure would mark them 'skipped'; # treating 'skipped' as a gate failure below keeps that fail-safe (blocks the # merge rather than letting it through untested). - needs: [static-analysis, debug-build, unit-tests, e2e, e2e-preview] + needs: [traffic-control-tests, static-analysis, debug-build, unit-tests, e2e, e2e-preview] runs-on: ubuntu-latest steps: - name: Verify every required job succeeded if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') }} run: | echo "Required CI jobs did not all succeed:" + echo " traffic-control-tests: ${{ needs.traffic-control-tests.result }}" echo " static-analysis: ${{ needs.static-analysis.result }}" echo " debug-build: ${{ needs.debug-build.result }}" echo " unit-tests: ${{ needs.unit-tests.result }}" -- 2.47.3