diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c0e8649af5..246d642d88 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -106,7 +106,8 @@ jobs: if: needs.changes.outputs.rust == 'true' permissions: contents: read - timeout-minutes: 60 + # A Windows build that misses the Rust cache spends ~50 minutes compiling before the tests run. + timeout-minutes: ${{ matrix.os == 'windows-latest' && 75 || 60 }} strategy: fail-fast: false matrix: @@ -127,10 +128,12 @@ jobs: with: { components: "clippy, rustfmt" } # Self-hosted runners keep persistent local Cargo caches; GitHub-hosted runners use Actions cache # (only main saves it because saving takes minutes on Windows; PRs restore main's). + # A failing test run on main still saves it, so the next PR doesn't compile from scratch. - uses: Swatinem/rust-cache@v2 if: runner.environment != 'self-hosted' with: save-if: ${{ github.ref == 'refs/heads/main' }} + cache-on-failure: true # The persistent target dir makes incremental builds pay off; cap its size so it can't fill the disk. - name: Persistent Cargo target dir if: runner.environment == 'self-hosted'