Skip to content

Commit 72146b6

Browse files
committed
fix(ci): improve macOS cache detection for Swatinem/rust-cache
The macOS runner uses Swatinem/rust-cache@v2 (non-Blacksmith), which requires a different cache key strategy than the Blacksmith runners. Changes: - Use consistent prefix-key with version (v1-rust-test, v1-rust-build) - Generate shared-key directly with matrix.name and Cargo file hashes - Removed dependency on setup-cache job's output for non-Blacksmith runners This ensures macOS builds properly detect and restore the Rust cache, as the cache key now includes OS-specific information and is computed locally on the macOS runner rather than relying on a key generated on Ubuntu.
1 parent 334f682 commit 72146b6

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ jobs:
133133
if: "!contains(matrix.runner, 'blacksmith')"
134134
uses: Swatinem/rust-cache@v2
135135
with:
136-
prefix-key: "rust-test-${{ matrix.name }}"
137-
shared-key: ${{ needs.setup-cache.outputs.cache-key }}
136+
prefix-key: "v1-rust-test"
137+
shared-key: "${{ matrix.name }}-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}"
138138

139139
- name: Run tests
140140
run: cargo +nightly test --workspace --all-features
@@ -181,8 +181,8 @@ jobs:
181181
if: "!contains(matrix.runner, 'blacksmith')"
182182
uses: Swatinem/rust-cache@v2
183183
with:
184-
prefix-key: "rust-build-${{ matrix.name }}"
185-
shared-key: ${{ needs.setup-cache.outputs.cache-key }}
184+
prefix-key: "v1-rust-build"
185+
shared-key: "${{ matrix.name }}-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}"
186186

187187
- name: Check build
188188
run: cargo +nightly check --workspace --all-features

0 commit comments

Comments
 (0)