ci: pull request jobs restore caches and never save them
Closed
TE
2mo ago+91+91+01234567890123456789-54-54-01234567890123456789
Summary
- On Warp runners
actions/cachewrites to the GitHub cache store, which evicts above about 10 GB.ci.ymlhad 14 save+restore cache steps in pull request jobs. Each run saved 1 to 3 GB entries scoped torefs/pull/N/merge, which no other pull request can read. - Measured 2026-09-20 05:55 UTC: 37.5 GB in 27 entries, oldest macOS entry 5 minutes old, only the Zig and Bun entries on
refs/heads/main. Compile admission loggedCache not foundfor the Debug compilation cache thatnightly.ymlseeds. Every compile ran cold: compile admission 18.3 min (compile 14.5), tests-build-and-lag 20.0 (build 12.9), release-build 29.9 (build 28.2). - All cache steps in
ci.ymlnow useactions/cache/restore. Seeds come from the existing main-branch jobs innightly.yml(Debug and Release compilation caches,spm-for both package paths, Zig). tests-build-and-lagandrelease-buildread thespm-keynightly.ymlsaves with the same path. Their oldspm-build-andspm-release-families were written only by pull requests.release-builddrops the step that pruned and bounded the compilation cache before a save that no longer happens.- New guard
tests/test_ci_pull_request_caches_are_read_only.py: no saving cache step inci.yml, and everyspm-restore has anightly.ymlsave with the same key and path.
Known gaps
- The two DerivedData restores (
deriveddata-build-,deriveddata-release-v2-) have no main seeder, so they miss until one exists. They were 4.2 GB per pull request and the largest source of churn. Removing them or seeding them is a follow-up once a warm run is measured. - A re-push no longer reuses its own pull request cache. Under the churn above it could not anyway.
perf-activation.yml,ci-macos-compat.ymlandtest-e2e.ymlstill save from their own runs.
Testing
- actionlint on
ci.yml. tests/test_ci_pull_request_caches_are_read_only.pyfails on main (first commit) and passes here.tests/test_ci_change_areas.py,tests/test_ci_self_hosted_guard.sh,tests/test_nightly_universal_build.sh,tests/test_ci_test_compilation_cache_seed.shpass. Two assertions that required pull request Release builds to save were rewritten to require restore-only.- Warm numbers need a seed to survive first: after this merges and the next
17 */6seed runs, read one compile admission and one release-build.
๐ค Generated with Claude Code
Summary by cubic
Pull request CI jobs now restore caches instead of saving them, so pull-request-only entries stop evicting the main-branch seeds that keep builds warm. Before, every pull request run saved 1โ3 GB entries that only that pull request could read, and the churn pushed the seeded caches out of the size-capped store.
- All 14
actions/cachesteps inci.ymlare nowactions/cache/restore, and seeds come from existing main-branch jobs innightly.yml. tests-build-and-lagandrelease-buildread thespm-cache with the same key and pathnightly.ymlsaves;release-buildalso drops the compilation-cache prune-and-bound step that only existed before the removed save.- Adds
tests/test_ci_pull_request_caches_are_read_only.py, which fails ifci.ymlsaves a cache or restores anspm-key thatnightly.ymldoesn't seed. - Known gaps: DerivedData restores have no main-branch seed yet, and a re-pushed branch no longer reuses its own earlier cache entry.
Summary by CodeRabbit
-
CI Improvements
- Pull request workflows now restore caches without modifying or saving them.
- Shared Swift package caches are used across applicable build jobs.
- Removed automatic pruning and size enforcement for the release build compilation cache.
-
Tests
- Added validation to ensure pull request caches remain read-only and correspond to nightly cache saves.
- Updated regression checks to reflect the new cache restoration behavior.