Repository navigation
CI: cache Cargo with rust-cache, saved from main only - #274
sombraSoft wants to merge 1 commit into
Conversation
The actions/cache key held only the Cargo.lock and Cargo.toml hashes, not the rustc version. The toolchain is floating stable, so after each stable release the restored target dependencies no longer match and rebuild on every run until Cargo.lock changes; an exact key hit never saves again, so the cache did not catch up. Every pull request that changed a Cargo.toml also saved its own ~284 MB cache, which churns the 10 GB repository limit. Swatinem/rust-cache keys on the installed rustc (so it runs after the toolchain step) as well as the Cargo files, and keeps only dependency artifacts. save-if limits saving to main; pull requests restore main's cache.
f6301cc to
bf06178
Compare
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Nothing has happened on this PR for 3 days, so it is marked |
|
No open or merged PR makes the same change. #286 bumps the same AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
The Cargo cache key holds only the
Cargo.lock/Cargo.tomlhashes, not the rustc version. CI installs floating stable, so after each stable release the restored dependencies no longer match and are rebuilt on every run untilCargo.lockchanges. An exact key hit never saves again, so the cache never catches up. And every PR that changes aCargo.tomlsaves its own ~284 MB cache, which churns the 10 GB repository limit when there are dozens of PRs a day.Part of #265
What is in it
.github/workflows/ci.yml:actions/cache@v4is replaced bySwatinem/rust-cache@v2. It runs after the toolchain step, so its key includes the installed rustc (as well asCargo.lock/Cargo.tomland theCARGO*/RUST*env), and it keeps only dependency artifacts. Withsave-if: ${{ github.ref == 'refs/heads/main' }}, onlymainsaves; PRs restoremain's cache and write none. Floating stable andCARGO_INCREMENTAL=0are unchanged.CI time
mainbuilds the dependencies again and later runs reuse them; today they rebuild on every run untilCargo.lockchanges.Tested
v0-rust-windows-Windows_NT-x64-1ffb72bd-aedbd39eincludes rustc 1.100.0. On the PRsave-ifwas false, and nov0-rust-*cache was written (checked the fork's cache list afterwards). The run was cold because the fork had no cache: Build and test took 2m27s.main(9ab7d76), RTX 3060 Ti (driver 621.24), Ryzen 9 5900X, Windows 11, rustc 1.97.1, debug:scripts/test.ps1→ 651 passed, 0 failed, 40 ignored; SKIPPED: 2 (no wave64). This PR changes only CI config, so the compiled code is the same.Regression run
crates/xcl/srcchange.Not tested
main, and a PR restoringmain's cache: only observable after merge.cargo-Windows-*entries are no longer used; GitHub evicts them after 7 days without access.AI use