fix(ci): move sccache cache key configuration before action initialization

The SCCACHE_GHA_CACHE_TO and SCCACHE_GHA_CACHE_FROM environment variables must be
set BEFORE the mozilla-actions/sccache-action runs, otherwise sccache won't see
them during initialization.

Changes:
- Move cache key configuration before sccache-action setup
- Bump cache version to v3 to force fresh cache
- Add v2 to CACHE_FROM for transition period
- This should finally enable cache hits across workflow runs
This commit is contained in:
James Peter
2025-08-24 10:32:50 +10:00
parent 9bcf7c7e2b
commit 46e57f0243
+8 -8
View File
@@ -120,6 +120,14 @@ jobs:
~/.cargo/registry/cache
~/.cargo/git
# Configure stable cache keys for sccache BEFORE initializing it
- name: Configure sccache cache keys
shell: bash
run: |
# Use stable cache keys that persist across runs
echo "SCCACHE_GHA_CACHE_TO=sccache-${{ matrix.target }}-rust-1.89-v3" >> "$GITHUB_ENV"
echo "SCCACHE_GHA_CACHE_FROM=sccache-${{ matrix.target }}-rust-1.89-v3,sccache-${{ matrix.target }}-rust-1.89-v2" >> "$GITHUB_ENV"
# ✅ Current sccache action (GHAC support). Do not hand-edit ACTIONS_* envs.
- name: Setup sccache (GHA backend)
uses: mozilla-actions/[email protected]
@@ -127,14 +135,6 @@ jobs:
version: v0.10.0
token: ${{ secrets.GITHUB_TOKEN }}
# Configure stable cache keys for sccache
- name: Configure sccache cache keys
shell: bash
run: |
# Use stable cache keys that persist across runs
echo "SCCACHE_GHA_CACHE_TO=sccache-${{ matrix.target }}-rust-1.89-v2" >> "$GITHUB_ENV"
echo "SCCACHE_GHA_CACHE_FROM=sccache-${{ matrix.target }}-rust-1.89-v2" >> "$GITHUB_ENV"
# Ensure GHAC is enabled & rustc routed through sccache; also set a per-OS default local dir
- name: Set sccache env + dir
shell: bash