Skip to content

ci: use targeted Rust build caches - #458

Merged
cpu merged 1 commit into
rustls:mainfrom
cpu:ci/speedup
Sep 22, 2026
Merged

cpu merged 1 commit into
rustls:mainfrom
cpu:ci/speedup

Conversation

@cpu

@cpu cpu commented Sep 22, 2026

Copy link
Copy Markdown
Member

I was getting tired of the very long rcgen CI times and aimed codex at it. I don't particularly find joy in fiddling with the cache settings so taking an actions dep on Swatinem/rust-cache to get everything working & tuned out-of-box seemed appealing to me.

Here's codex's description of the change/rationale:

The hand-written actions/cache setup stores the full target directory under keys that require an exact Cargo.lock hash. This has three practical failure modes:

  • the repository cache reached 9.86 GB of GitHub's 10 GB quota, so useful entries are evicted;
  • the stable build and coverage jobs share a key, allowing coverage to save instrumented artifacts that the stable build cannot reuse; and
  • any lockfile update misses every prior entry and rebuilds all dependencies.

Clippy, one of the longest-running jobs, is not cached at all.

Use Swatinem/rust-cache for Clippy, the platform build matrix, and coverage. It derives keys from the job, compiler, and Rust build environment, falls back across lockfile revisions, and removes workspace, incremental, stale, and unused artifacts before saving.

Keeping that Rust-specific policy in the cache action avoids duplicating fragile path, key, and cleanup logic in the workflow. It also reduces cache pressure while preventing incompatible jobs from sharing entries.

After initial cache population, this reduced average CI wall time from ~18m18s to ~2m19s (87% faster) and runner usage by roughly 63%.

The hand-written actions/cache setup stores the full target directory
under keys that require an exact Cargo.lock hash. This has three
practical failure modes:

- the repository cache reached 9.86 GB of GitHub's 10 GB quota, so
  useful entries are evicted;
- the stable build and coverage jobs share a key, allowing coverage to
  save instrumented artifacts that the stable build cannot reuse; and
- any lockfile update misses every prior entry and rebuilds all
  dependencies.

Clippy, one of the longest-running jobs, is not cached at all.

Use Swatinem/rust-cache for Clippy, the platform build matrix, and
coverage. It derives keys from the job, compiler, and Rust build
environment, falls back across lockfile revisions, and removes
workspace, incremental, stale, and unused artifacts before saving.

Keeping that Rust-specific policy in the cache action avoids duplicating
fragile path, key, and cleanup logic in the workflow. It also reduces
cache pressure while preventing incompatible jobs from sharing entries.

Co-authored-by: Codex <codex@openai.com>
@cpu cpu self-assigned this Sep 22, 2026

@djc djc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hell, yes!

@cpu
cpu enabled auto-merge September 22, 2026 16:08
@cpu
cpu added this pull request to the merge queue Sep 22, 2026
Merged via the queue into rustls:main with commit 42febe1 Sep 22, 2026
17 checks passed
@cpu
cpu deleted the ci/speedup branch September 22, 2026 16:46
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