Skip to content

ci: cache Rust compilation with sccache - #1354

Draft
pjb157 wants to merge 1 commit into
mainfrom
peter/sccache-depot-cache
Draft

ci: cache Rust compilation with sccache#1354
pjb157 wants to merge 1 commit into
mainfrom
peter/sccache-depot-cache

Conversation

@pjb157

@pjb157 pjb157 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • route the four sharded dwctl coverage builds through sccache on Depot runners
  • use Depot's runner-provided WebDAV cache credentials, with compiler cache failures treated as non-fatal
  • retain Swatinem/rust-cache for Cargo dependencies/tools while disabling its target cache to avoid caching build outputs twice
  • pin the sccache action and binary versions
  • add a workflow contract test that keeps the cache configuration scoped to the intended job and rejects long-lived/manual cache credentials

Result: not recommended for merge

This reproduces the Depot article's configuration successfully, but it does not improve this repository's existing sharded coverage build. Even with a 100% sccache hit rate, fetching hundreds of individual compiler objects is slower here than restoring the existing compressed Rust target cache and compiling the remaining work locally on a 16-core Depot runner.

Scenario Median Cargo compile Median compile + test step Median shard job sccache hit rate
Existing workflow baseline 131s 154.5s 211.5s n/a
Empty sccache 211.5s 239s 368s 4.9–25.1%
Warm sccache, attempt 1 141s 165s 219s 100%
Warm sccache, attempt 2 141s 165s 218s 100%

Against the existing workflow, the two warm attempts consistently regressed median Cargo compilation by 7.6%, the measured compile/test step by 6.8%, and the complete shard job by about 3.1%. The empty-cache attempt was substantially slower, as expected.

The first warm attempt had one failure in test_flush_emits_single_notification_for_multiple_depletions; the second identical warm attempt passed the complete workflow. The timing regression was the same in both attempts, so it is independent of that test flake.

Runs

Validation

  • bash .github/scripts/test-rust-ci-matrix.sh
  • ruby scripts/tests/preview_workflow_test.rb (4 runs, 63 assertions)
  • shellcheck .github/scripts/test-rust-ci-matrix.sh
  • actionlint -ignore 'label "depot-' -ignore 'shellcheck reported issue' .github/workflows/ci.yaml
  • complete GitHub Actions workflow passed on the final warm attempt

This PR is intentionally left as a draft experiment. Based on the measurements above, I recommend closing it rather than merging the implementation.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying control-layer with  Cloudflare Pages  Cloudflare Pages

Latest commit: 845e449
Status: ✅  Deploy successful!
Preview URL: https://b37dcdb6.control-layer.pages.dev
Branch Preview URL: https://peter-sccache-depot-cache.control-layer.pages.dev

View logs

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