Skip to content

Use rust-cache for CI Rust dependency caching#73

Open
TaKO8Ki wants to merge 1 commit into
nasa:mainfrom
TaKO8Ki:ci/use-rust-cache
Open

Use rust-cache for CI Rust dependency caching#73
TaKO8Ki wants to merge 1 commit into
nasa:mainfrom
TaKO8Ki:ci/use-rust-cache

Conversation

@TaKO8Ki

@TaKO8Ki TaKO8Ki commented Jul 13, 2026

Copy link
Copy Markdown

This replaces the hand-written actions/cache steps with Swatinem/rust-cache@v2.

The previous workflow cached ~/.cargo/registry, ~/.cargo/git, and target separately. rust-cache handles those Rust cache paths directly, while also taking care of Rust-specific cache keys, pruning stale build artifacts, and setting CARGO_INCREMENTAL=0 for CI builds.

ref: https://github.com/swatinem/rust-cache

@github-actions

Copy link
Copy Markdown

Welcome, new contributor!

Please make sure you've read our contributing guide, as well as our policy regarding AI usage, and we look forward to reviewing your pull request shortly

@TaKO8Ki TaKO8Ki force-pushed the ci/use-rust-cache branch from 97f227a to 8a160e5 Compare July 13, 2026 07:52
@chvanam

chvanam commented Jul 13, 2026

Copy link
Copy Markdown

Independent opinion: it might not be worth taking in a third party dependency to replace 40 explicit cache lines, especially for a critical system.

@TaKO8Ki

TaKO8Ki commented Jul 13, 2026

Copy link
Copy Markdown
Author

That’s a fair concern. As I mentioned in the PR description, this does more than replace the existing cache steps. It caches ~/.cargo and target, builds cache keys from the Rust toolchain and Cargo files, uses cargo metadata to focus on dependency artifacts, prunes stale and incremental artifacts, reuses older caches when Cargo.lock changes, works around macOS cache issues, and sets CARGO_INCREMENTAL=0.

So the value is not just fewer lines. It provides a Rust-specific caching strategy through an action already used by projects such as tokio, ruff, and uv. Since this workflow already relies on other third-party actions, I thought adding this one would be consistent with the existing configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants