Skip to content

ci: replace manual cargo cache with Swatinem/rust-cache#68

Merged
panos-xyz merged 3 commits intomainfrom
panos/ci-cache
Mar 31, 2026
Merged

ci: replace manual cargo cache with Swatinem/rust-cache#68
panos-xyz merged 3 commits intomainfrom
panos/ci-cache

Conversation

@panos-xyz
Copy link
Copy Markdown
Contributor

Summary

  • Replace all 5 instances of manual actions/cache with Swatinem/rust-cache@v2 across build, lint, and test workflows
  • Smarter cache key generation (includes Cargo.lock + Cargo.toml + toolchain version)
  • Auto-cleanup of stale target artifacts prevents cache bloat
  • cache-on-failure: true saves cache even on build errors for faster retries
  • Reduces cache config from ~10 lines to 3 lines per job

Test plan

  • Build workflow runs with cache hit/miss
  • Lint workflow (clippy) runs with cache
  • Test workflows (unit + doc) run with cache
  • Second run on same PR shows cache restoration

Replace all 5 instances of manual actions/cache configuration with
Swatinem/rust-cache@v2 across build, lint, and test workflows.

Benefits:
- Smarter cache key (includes Cargo.lock + Cargo.toml + toolchain)
- Auto-cleanup of stale target artifacts to prevent cache bloat
- cache-on-failure saves cache even on build errors
- Simpler configuration (3 lines vs 10+ lines per job)
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 26, 2026

Warning

Rate limit exceeded

@panos-xyz has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 5 minutes and 24 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 5 minutes and 24 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8dab5742-8ee1-4919-a465-95d859a323e0

📥 Commits

Reviewing files that changed from the base of the PR and between ccbf482 and aff4d85.

📒 Files selected for processing (3)
  • .github/workflows/build.yml
  • .github/workflows/lint.yml
  • .github/workflows/test.yml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch panos/ci-cache

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@panos-xyz panos-xyz requested a review from chengwenxi March 26, 2026 08:02
Copy link
Copy Markdown
Contributor

@chengwenxi chengwenxi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review: Approve

Clean, well-scoped CI improvement. All 4 manual actions/cache@v4 blocks are correctly replaced with Swatinem/rust-cache@v2. No cache block is missed, and the fmt job (which has no cache and doesn't need one) is correctly left untouched.

What this improves:

  • Smarter cache keys (includes Cargo.toml, rustc version, job ID -- not just Cargo.lock)
  • Automatic target directory cleanup prevents cache bloat
  • cache-on-failure: true saves partial compilation for faster retries
  • ~10 lines reduced to 3 lines per job

Verified:

  • Swatinem/rust-cache is well-established (~1,770 stars, latest release v2.9.1 from 2026-03-12)
  • No unrelated changes, no security concerns
  • Workflow triggers, permissions, env vars, toolchain setup, and build/test commands are all untouched

Copy link
Copy Markdown
Contributor

@chengwenxi chengwenxi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Swatinem/rust-cache@v2 is the de facto standard — better cache keys (factors in Cargo.toml + rustc version), automatic target pruning, and cache-on-failure: true for retry perf. All 4 manual cache blocks correctly replaced.

@panos-xyz panos-xyz merged commit a79dd88 into main Mar 31, 2026
9 checks passed
@panos-xyz panos-xyz deleted the panos/ci-cache branch March 31, 2026 14:15
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