Repository navigation
CI: cache Cargo with rust-cache, saved from main only - #274
Open
sombraSoft wants to merge 1 commit into
Open
sombraSoft wants to merge 1 commit into
sombraSoft wants to merge 1 commit into
Conversation
8 tasks
sombraSoft
marked this pull request as ready for review
November 23, 2026 22:18
This was referenced Nov 23, 2026
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.
sombraSoft
force-pushed
the
ci/rust-cache
branch
from
November 23, 2026 23:12
f6301cc to
bf06178
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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