Skip to content

ci: keep rust caches warm on main and stop saving binary caches on branches - #4881

Merged
krishicks merged 1 commit into
mainfrom
ci/rust-cache-main-only/krishicks
Oct 23, 2026
Merged

krishicks merged 1 commit into
mainfrom
ci/rust-cache-main-only/krishicks

Conversation

@krishicks

Copy link
Copy Markdown
Collaborator

Summary

The Actions cache is at its 50 GB quota and turns over within hours, so main's caches get evicted. Most of the space is per-binary release build caches saved from PR branches, plus rust-checks caches that every PR saves because main never writes one. This PR saves per-binary caches only on main and adds a workflow that keeps main's rust-checks cache warm.

Related Issue

None. This is a CI build fix from an author with write access.

Changes

  • build-rust-binary saves its rust-binaries-v2-* cache only on refs/heads/main. Other branches still restore main's. Two PRs alone held about 10 GiB each of these caches.
  • New .github/workflows/rust-cache.yml runs on pushes to main. It builds the Branch Checks rust-test targets with --no-run on the same three runners, with the same env and cache key. Branch Checks only triggers on pull-request/N, merge_group and dispatch, so main previously had no rust-checks cache for PRs to restore.
  • setup-rust exposes cache-hit, so the warming job skips the build when main's cache already matches.
  • PR branches still save rust-checks. Swatinem/rust-cache skips saving on an exact key hit, so once main is warm, PRs whose dependencies match main no longer write duplicates. PRs that change dependencies or the Nix dev shell keep their own warm cache across pushes.

Testing

  • actionlint passes on the changed files. The only warnings are the existing self-hosted runner labels.
  • After merge: confirm Rust Cache saves v0-rust-rust-checks-v2-* entries for refs/heads/main, and that PR rust-test jobs restore them.

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Architecture docs updated (if applicable)

🤖 Generated with Claude Code

…anches

Branch Checks never runs on main, so PR mirrors had no main rust-checks
cache to restore and each one saved its own. Per-binary release build
caches were also saved from every branch. Together they filled the 50 GB
cache quota within hours and evicted main's caches.

Save per-binary caches only on main, and add a Rust Cache workflow that
builds the Branch Checks test targets on each push to main so PRs and
merge groups can restore a matching rust-checks cache.

Signed-off-by: Kris Hicks <khicks@nvidia.com>
@krishicks
krishicks force-pushed the ci/rust-cache-main-only/krishicks branch from d0194ba to 73894ef Compare October 23, 2026 19:43
@krishicks
krishicks added this pull request to the merge queue Oct 23, 2026
Merged via the queue into main with commit e0ba078 Oct 23, 2026
80 checks passed
@krishicks
krishicks deleted the ci/rust-cache-main-only/krishicks branch October 23, 2026 22:07
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