forge
Explore
Log in

Don't you dare go Hollow

Cancel the run when Clippy fails

Browse files at this commit

57527df057b34b71b847ff0713d5975f9ae5e138Ahmet Kaan GümüşParent: d8dad92
  • fix
    • cancel the run when Clippy fails
Show full message
🐛 fix(ci): cancel the run when Clippy fails

A red Clippy left Build-and-test running to its 90-minute ceiling even
though the deploy gates on both, so the outcome was already decided.
New clippy-guard job (needs: clippy, if: failure()) cancels the run via
the API the moment Clippy concludes red; parallelism is untouched since
the guard only ever runs on the failure path.
.github/workflows/main.ymlmodified+26 -0
@@ -29,6 +29,14 @@
29 # cancels an in-flight Deploy (two deploys racing would interleave the29 # cancels an in-flight Deploy (two deploys racing would interleave the
30 # compose stack).30 # compose stack).
31 #31 #
32+# Fail-fast: Clippy is ~2 minutes, Build-and-test up to 90. A red Clippy
33+# still leaves the suite burning runner minutes for nothing — the deploy
34+# already gates on both, so the outcome is decided. The `clippy-guard`
35+# job fires the moment Clippy concludes red and cancels the whole run,
36+# killing the in-flight suite. Parallelism is untouched: the guard only
37+# ever runs on the failure path. (GitHub has no native "sibling job
38+# failed → cancel the rest"; the run-cancel API is the door.)
39+#
32 # The split is the recovery story, not ceremony:40 # The split is the recovery story, not ceremony:
33 # * "Re-run failed jobs" on a run whose Deploy step failed re-runs ONLY the41 # * "Re-run failed jobs" on a run whose Deploy step failed re-runs ONLY the
34 # ~1-minute deploy job — the built image is still in the run's artifact.42 # ~1-minute deploy job — the built image is still in the run's artifact.
@@ -137,6 +145,24 @@ jobs:
137 - name: Clippy145 - name: Clippy
138 run: cargo clippy --all-targets --locked -- -D warnings146 run: cargo clippy --all-targets --locked -- -D warnings
139 147
148+ # Fires the moment Clippy concludes red and cancels the run, killing the
149+ # in-flight Build-and-test instead of letting it burn up to 90 minutes on
150+ # a run whose outcome is already decided. Skipped on a green Clippy and on
151+ # workflow_dispatch (Clippy itself is skipped there, which is not a
152+ # failure). Needs `actions: write` to cancel the run.
153+ clippy-guard:
154+ name: Cancel run on Clippy failure
155+ needs: clippy
156+ if: failure()
157+ runs-on: ubuntu-24.04
158+ permissions:
159+ actions: write
160+ steps:
161+ - name: Cancel the run
162+ env:
163+ GH_TOKEN: ${{ github.token }}
164+ run: gh api -X POST "/repos/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID/cancel"
165+
140 build:166 build:
141 name: Build and test167 name: Build and test
142 # Pushes always build (and, by default, test). A manual redeploy reuses168 # Pushes always build (and, by default, test). A manual redeploy reuses