ci: use targeted Rust build caches - #458
Merged
Merged
Conversation
The hand-written actions/cache setup stores the full target directory under keys that require an exact Cargo.lock hash. This has three practical failure modes: - the repository cache reached 9.86 GB of GitHub's 10 GB quota, so useful entries are evicted; - the stable build and coverage jobs share a key, allowing coverage to save instrumented artifacts that the stable build cannot reuse; and - any lockfile update misses every prior entry and rebuilds all dependencies. Clippy, one of the longest-running jobs, is not cached at all. Use Swatinem/rust-cache for Clippy, the platform build matrix, and coverage. It derives keys from the job, compiler, and Rust build environment, falls back across lockfile revisions, and removes workspace, incremental, stale, and unused artifacts before saving. Keeping that Rust-specific policy in the cache action avoids duplicating fragile path, key, and cleanup logic in the workflow. It also reduces cache pressure while preventing incompatible jobs from sharing entries. Co-authored-by: Codex <codex@openai.com>
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.
I was getting tired of the very long rcgen CI times and aimed
codexat it. I don't particularly find joy in fiddling with the cache settings so taking an actions dep on Swatinem/rust-cache to get everything working & tuned out-of-box seemed appealing to me.Here's codex's description of the change/rationale:
The hand-written actions/cache setup stores the full target directory under keys that require an exact Cargo.lock hash. This has three practical failure modes:
Clippy, one of the longest-running jobs, is not cached at all.
Use Swatinem/rust-cache for Clippy, the platform build matrix, and coverage. It derives keys from the job, compiler, and Rust build environment, falls back across lockfile revisions, and removes workspace, incremental, stale, and unused artifacts before saving.
Keeping that Rust-specific policy in the cache action avoids duplicating fragile path, key, and cleanup logic in the workflow. It also reduces cache pressure while preventing incompatible jobs from sharing entries.
After initial cache population, this reduced average CI wall time from ~18m18s to ~2m19s (87% faster) and runner usage by roughly 63%.