ci: stop pull requests evicting the main cache seeds, and add an optional Warp cache store

Merged
TE
2mo ago
+268-97

Summary

Two changes, one macOS run.

1. Pull request jobs restore caches and never save them.

  • On Warp runners actions/cache writes to the GitHub cache store, which evicts above about 10 GB. ci.yml had 14 save+restore steps in pull request jobs. Each run saved 1 to 3 GB entries scoped to refs/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 logged Cache not found for the Debug compilation cache nightly.yml seeds. 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.yml are now restore-only. Seeds come from the existing main-branch jobs in nightly.yml. tests-build-and-lag and release-build read the spm- key nightly.yml saves with the same path; their old spm-build- and spm-release- families were written only by pull requests. release-build drops the step that bounded the compilation cache before a save that no longer happens.

2. Optional Warp cache store, off by default.

  • Two local composite actions, .github/actions/cache-restore and .github/actions/cache-save, each with two exactly complementary branches: actions/cache, or WarpBuilds/cache when the backend is warp and the runner name starts with warp-. Any other runner keeps using the GitHub store.
  • The compilation caches and Swift package caches go through them in ci.yml (restore only), the two nightly.yml seed jobs, and the nightly app build.
  • Backend = the cache_backend dispatch input when set, else the CI_CACHE_BACKEND repository variable. Unset means today's behaviour.
  • Rollout: set CI_CACHE_BACKEND=warp. The store starts empty; the next 17 */6 seed fills it.

Cost (list prices, 2026-09-20)

  • Warp store: $0.20 per GB-month, $0.0001 per operation, no size cap, entries expire 7 days after last use. Seeds only are about 10 to 20 GB: about $2 to $4 a month, plus about $7 a month of operations at 1,111 runs a week.
  • For scale: 5.2 hours of pull request runs on 2026-09-20 cost about $960 at list price; the three build steps were $306 (32%).

Known gaps

  • The two DerivedData restores have no main seeder, so they miss. They were 4.2 GB per pull request. Remove or seed them after a warm run is measured.
  • perf-activation.yml, ci-macos-compat.yml and test-e2e.yml still save to the GitHub store from their own runs.

Testing

  • actionlint on both workflows.
  • New tests/test_ci_pull_request_caches_are_read_only.py (fails on main, first commit): no saving cache step in ci.yml, every spm- restore has a nightly.yml save with the same key and path, and the two actions have complementary conditions, the expected upstream actions, and commit pins. Wired into workflow-guard-tests.
  • 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.sh pass. Assertions that required pull request Release builds to save now require restore-only, and matchers accept the local actions.
  • Warp branch exercised with nightly.yml build_only dispatches on this branch (cold, then warm). Results in a comment below.

Replaces https://github.com/manaflow-ai/cmux/pull/13158.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added configurable GitHub and Warp cache backends for manually triggered CI and nightly workflows.
    • Added unified cache restore and save handling with cache-hit reporting.
    • Improved cache reuse across Swift package and compilation caches.
  • Bug Fixes

    • Pull request workflows now use read-only cache access, preventing accidental cache writes.
    • Oversized compilation-cache handling is now performed during cache restoration.
    • Tests-build-and-lag runs now perform full builds without DerivedData caching.