Skip to content

Commit

Permalink
ci: bring back GitHub Actions cache for Windows
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
AlexTMjugador committed Jul 2, 2024
1 parent 6452376 commit bb13ea0
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -156,17 +157,22 @@ 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 }}
SCCACHE_REDIS_PASSWORD: ${{ secrets.SCCACHE_REDIS_PASSWORD }}
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
Expand Down

0 comments on commit bb13ea0

Please sign in to comment.