From 6e1c1dd0fcc31ce44016063676765503dd962cdc Mon Sep 17 00:00:00 2001 From: rob thijssen Date: Wed, 27 May 2026 12:55:18 +0300 Subject: [PATCH] ci: retry clippy + test up to 3 times on spurious sccache failures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sccache occasionally fails mid-compile with race-condition errors that clear on a re-run without any code changes. Rather than tracking that down right now, wrap the two affected steps in a bash loop that retries up to three times with a 5-second pause. Real failures still surface; they just take ~10s longer to fail. fmt is left as a single invocation — it's a one-shot syntactic check, not a build, and isn't subject to the same sccache races. Co-Authored-By: Claude Opus 4.7 (1M context) --- .gitea/workflows/ci.yml | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 35670db..26dcfc3 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -47,7 +47,25 @@ jobs: runs-on: rust steps: - uses: actions/checkout@v4 - - run: cargo clippy --workspace -- -D warnings + # sccache occasionally fails with spurious race-condition errors; + # retrying the same invocation succeeds without code changes. + # Allow up to 3 attempts before declaring real failure. + - name: Clippy (with retry) + run: | + for attempt in 1 2 3; do + echo "::group::clippy attempt ${attempt}" + if cargo clippy --workspace -- -D warnings; then + echo "::endgroup::" + exit 0 + fi + echo "::endgroup::" + echo "clippy failed on attempt ${attempt}" + if [ "${attempt}" -lt 3 ]; then + sleep 5 + fi + done + echo "clippy failed after 3 attempts" + exit 1 - run: sccache --show-stats test: @@ -55,7 +73,23 @@ jobs: runs-on: rust steps: - uses: actions/checkout@v4 - - run: cargo test --workspace + # See the clippy job for why this is retried. + - name: Test (with retry) + run: | + for attempt in 1 2 3; do + echo "::group::test attempt ${attempt}" + if cargo test --workspace; then + echo "::endgroup::" + exit 0 + fi + echo "::endgroup::" + echo "test failed on attempt ${attempt}" + if [ "${attempt}" -lt 3 ]; then + sleep 5 + fi + done + echo "test failed after 3 attempts" + exit 1 - run: sccache --show-stats srpm-cortex: