From bb13ea07e15f6bd4e203189cec9958a0dcb4b341 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Gonz=C3=A1lez?= Date: Tue, 2 Jul 2024 11:50:30 +0200 Subject: [PATCH] ci: bring back GitHub Actions cache for Windows According to all known laws of informatics, sccache should work well on Windows. But for some reason in our environment Windows builds with the MinGW toolchain get so slow due to sccache overheads, even though our current sccache approach with a Redis database storing compilation aritfacts is overall a net improvement for the remaining targets. So let's fall back to the older cache method for Windows to continue cutting down on CI time. --- .github/workflows/ci.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3576d991a..3c6712059 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -121,8 +121,9 @@ jobs: # https://github.com/rust-lang/rust/blob/4c8bb79d9f565115637cc6da739f8389e79f3a29/library/std/Cargo.toml#L54-L79 OPTIMIZED_RELEASE_BUILD_FLAGS: -Z build-std -Z build-std-features=panic-unwind - # Use sccache to speed up Rust compilation - RUSTC_WRAPPER: sccache + # Use sccache to speed up Rust compilation except for Windows GNU targets, which + # have great sccache overheads that make builds slow down a lot + RUSTC_WRAPPER: ${{ endsWith(matrix.target, '-pc-windows-gnu') && '' || 'sccache' }} # Exclude in-repo PRs from running this job if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork @@ -156,10 +157,11 @@ jobs: components: rust-src - name: 💨 Set up sccache + if: ${{ !endsWith(matrix.target, '-pc-windows-gnu') }} # See comment above on sccache for Windows uses: mozilla-actions/sccache-action@89e9040de88b577a072e3760aaf59f585da083af # v0.0.5 - name: ⚙️ Prime sccache cache backend - shell: bash + if: ${{ !endsWith(matrix.target, '-pc-windows-gnu') }} env: SCCACHE_REDIS_ENDPOINT: ${{ secrets.SCCACHE_REDIS_ENDPOINT }} SCCACHE_REDIS_USERNAME: ${{ secrets.SCCACHE_REDIS_USERNAME }} @@ -167,6 +169,10 @@ jobs: SCCACHE_REDIS_KEY_PREFIX: ${{ secrets.SCCACHE_REDIS_KEY_PREFIX }} run: sccache --start-server + - name: 💨 Cache Rust artifacts (Windows) + if: endsWith(matrix.target, '-pc-windows-gnu') + uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2 + - name: 🧰 Install nextest if: startsWith(matrix.target, 'x86_64-') || contains(matrix.target, '-linux-') uses: taiki-e/install-action@331a600f1b10a3fed8dc56f925012bede91ae51f # v2