Skip to content

Commit 3bc2741

Browse files
authored
fix(ci): improve macOS cache detection for Swatinem/rust-cache (#12)
* 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. * fix: resolve flaky tests in CI for config_discovery and batch handlers - test_caching: Remove race-prone assertion checking cache_size() after clear_cache() call. The test now properly verifies cache behavior by checking that cached results match original results and that clear_cache() properly empties the cache. - test_parallel_execution_performance: Increase timing threshold from 100ms to 500ms to account for slower CI runners (especially Windows VMs) and system load variability. The test still validates that parallel execution is significantly faster than sequential would be. Fixes CI failures on: - PR #12 (fix/macos-cache-detection) - Ubuntu test_caching assertion - PR #9 (feature/complete-plugin-system) - Windows timing assertion - PR #12 (fix/macos-cache-detection) - Windows timing assertion
1 parent 4705e86 commit 3bc2741

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)