Skip to content

ci: share Rust caches across runner images - #3520

Open
kevinjqliu wants to merge 1 commit into
apache:mainfrom
kevinjqliu:kevinjqliu-public-api-check-without-cargo-install
Open

kevinjqliu wants to merge 1 commit into
apache:mainfrom
kevinjqliu:kevinjqliu-public-api-check-without-cargo-install

Conversation

@kevinjqliu

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

  • N/A (CI maintenance).

What changes are included in this PR?

rust-cache hashes every installed toolchain into its cache key, including the runner's preinstalled stable. We build with the nightly in rust-toolchain.toml and never use stable. But runner images roll out with different stable versions (1.99.0 vs 1.99.1 this week, on Linux, macOS and Windows), so each job ends up with 2 cache keys that can't restore from each other.

What that looks like over ~45 recent runs per workflow:

  • The less common image misses a lot more. macOS build missed 4/4, Windows bindings 7/10, check-public-api 64% vs 37%.
  • A miss rebuilds every dependency. For check-public-api that's ~6 min vs ~1 min.
  • The duplicate entries take ~2.8GB. We're at 10.7GB of the 10GB cache limit, so they push out caches we still need.

Remove stable in setup-builder when it uses rust-toolchain.toml. Jobs that pass rust-version (audit, MSRV, publish, Python release) are unchanged. rust-toolchain.toml is still part of the key, so a nightly bump still invalidates the cache.

Apache Iggy does the same in its setup action.

Are these changes tested?

CI only. actionlint and zizmor --offline show no new findings. Checked locally that rustup toolchain uninstall stable exits 0 when stable is the default toolchain and when it's not installed. The hit rate only shows after this lands on main and the caches are re-saved.

AI Disclosure

Prepared with Copilot, including pulling the cache hit/miss numbers from run logs. Worth a look: that nothing in these jobs calls cargo +stable or relies on stable being installed.

rust-cache hashes every installed toolchain into its key. Runner images
roll out with different preinstalled stable versions (1.99.0 vs 1.99.1),
which splits each job's cache into two keys that miss each other and
duplicate ~2.8GB of cache storage. Jobs using rust-toolchain.toml never
use stable, so setup-builder removes it.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@kevinjqliu
kevinjqliu marked this pull request as ready for review October 24, 2026 04:25
@kevinjqliu
kevinjqliu requested review from CTTY and blackmwk and a balanced review from Copilot and removed request for Copilot October 24, 2026 04:25
@kevinjqliu

Copy link
Copy Markdown
Contributor Author

this should improve cache hits and make ci faster

This branch has not been deployed

No deployments
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.

1 participant