Skip to content

CI: cache the bindgen-cli binary instead of rebuilding it every run#14966

Merged
reaperhulk merged 2 commits into
mainfrom
claude/magical-hopper-1R1Vj
Jun 7, 2026
Merged

CI: cache the bindgen-cli binary instead of rebuilding it every run#14966
reaperhulk merged 2 commits into
mainfrom
claude/magical-hopper-1R1Vj

Conversation

@alex
Copy link
Copy Markdown
Member

@alex alex commented Jun 7, 2026

What

Moves cargo install bindgen-cli to run after the rust-cache step in the linux job, and bumps the shared cache key.

Why

Looking at recent CI timings, every BoringSSL/AWS-LC matrix job (4 jobs per run) spends ~55s compiling bindgen-cli from source on every single run, despite a warm rust cache.

The cause: Swatinem/rust-cache snapshots ~/.cargo/bin at the start of its main step and, before saving the cache, prunes any binaries that already existed at that point (it assumes they're pre-installed tooling, see cleanBin). Since the cargo install bindgen-cli step currently runs before the cache action, the binary is pruned from every cache save and rebuilt from scratch on every run.

With the install moved after the cache action:

  • rust-cache keeps and caches the binary (cache-bin defaults to true, which covers ~/.cargo/bin plus .crates.toml/.crates2.json)
  • on warm caches, cargo install bindgen-cli sees the binary is already installed and becomes a quick no-op (just an index check)

The cache key bump (-4-5) is needed because rust-cache doesn't re-save on a primary key hit — without it, the existing bindgen-less caches would be restored and never refreshed until the next Cargo.lock rotation.

Expected impact

~50s saved on each of the 4 boringssl/aws-lc jobs per CI run (these are among the slowest linux jobs at 3.4–3.9 min).

Note: the first CI run on this PR is a cold-cache run (key bump), so it will be slower than baseline. The second push demonstrates the warm-cache behavior — check the rustup run stable cargo install bindgen-cli step duration on the boringssl/aws-lc jobs.

https://claude.ai/code/session_014StKTjk7GBcVdiWKimEsQb


Generated by Claude Code

claude added 2 commits June 7, 2026 04:31
cargo install bindgen-cli ran before the rust-cache action. rust-cache
prunes binaries that already exist in ~/.cargo/bin before its main step
runs (it assumes they are pre-installed tooling), so bindgen was deleted
from every cache save and recompiled from scratch (~55s) on every
BoringSSL and AWS-LC job.

Moving the install after the cache restore lets rust-cache keep the
binary (cache-bin defaults to true), and on warm caches cargo install
sees the binary is already installed and skips the build.

The cache key is bumped so the improvement takes effect immediately
rather than waiting for the next Cargo.lock rotation (rust-cache does
not re-save on a primary key hit).

https://claude.ai/code/session_014StKTjk7GBcVdiWKimEsQb
@reaperhulk reaperhulk merged commit c8d128b into main Jun 7, 2026
63 checks passed
@reaperhulk reaperhulk deleted the claude/magical-hopper-1R1Vj branch June 7, 2026 04:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants