From 57527df057b34b71b847ff0713d5975f9ae5e138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Fri, 25 Sep 2026 17:48:15 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(ci):=20cancel=20the=20run=20?= =?UTF-8?q?when=20Clippy=20fails?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2ed2af4..71be66a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,6 +29,14 @@ # cancels an in-flight Deploy (two deploys racing would interleave the # compose stack). # +# Fail-fast: Clippy is ~2 minutes, Build-and-test up to 90. A red Clippy +# still leaves the suite burning runner minutes for nothing — the deploy +# already gates on both, so the outcome is decided. The `clippy-guard` +# job fires the moment Clippy concludes red and cancels the whole run, +# killing the in-flight suite. Parallelism is untouched: the guard only +# ever runs on the failure path. (GitHub has no native "sibling job +# failed → cancel the rest"; the run-cancel API is the door.) +# # The split is the recovery story, not ceremony: # * "Re-run failed jobs" on a run whose Deploy step failed re-runs ONLY the # ~1-minute deploy job — the built image is still in the run's artifact. @@ -137,6 +145,24 @@ jobs: - name: Clippy run: cargo clippy --all-targets --locked -- -D warnings + # Fires the moment Clippy concludes red and cancels the run, killing the + # in-flight Build-and-test instead of letting it burn up to 90 minutes on + # a run whose outcome is already decided. Skipped on a green Clippy and on + # workflow_dispatch (Clippy itself is skipped there, which is not a + # failure). Needs `actions: write` to cancel the run. + clippy-guard: + name: Cancel run on Clippy failure + needs: clippy + if: failure() + runs-on: ubuntu-24.04 + permissions: + actions: write + steps: + - name: Cancel the run + env: + GH_TOKEN: ${{ github.token }} + run: gh api -X POST "/repos/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID/cancel" + build: name: Build and test # Pushes always build (and, by default, test). A manual redeploy reuses