fix(actions): prune cargo cache before saving - #5
Merged
Conversation
goastler
marked this pull request as ready for review
August 12, 2026 13:50
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.
save_cargo_cacheuploads~/.cargoandtarget/verbatim. On a local Protect checkout that tree is 17 GB — ~7.5 GB of it incremental state, ~6 GBdeps/with a dozen-odd link artifacts over 100 MB each. GitHub caps a repo's total cache at 10 GB and evicts LRU, so an entry that size never really saves and thrashes out every other cache in the repo; the existing "delete all but the latest key" step is a symptom of that. It also costs disk on restore, before the build has compiled anything — part of what tipped hosted runners into ENOSPC on Protect#410.Adds a prune step before the save, doing what
Swatinem/rust-cachedoes:findrather than a**glob, since**isn't recursive withoutglobstarand nested workspaces have their owntarget/.~/.cargo/registry/src— regenerated from the.cratearchives inregistry/cache, which are kept. Roughly halves the registry.cargo metadata --no-depsso the dependency artifacts beside them, which are the entire point of the cache, survive.Prints before/after MB.
Not delegating to
Swatinem/rust-cachewholesale: it has no equivalent of the self-hosted gating inrestore_cargo_cache, nor of this repo's run_id-keyed save + wildcard restore-keys scheme.Related: prosopo/github_actions#4, Protect#450.