Repository navigation
ci: save only the caches something restores: the nightly reuses main's test cache, previews share the web app's - #1558
Conversation
…s test cache, previews share the web app's The repository's Actions cache is at its 10 GB limit, and GitHub evicts the least recently used entries, so a cache used once a day is gone by the next. Two kinds of cache were saved and never restored: - The nightly's test jobs kept a cache of their own (key `release`), saved every night and evicted before the next: all four platforms built from nothing each night. A run with the release build now restores main's test cache and saves nothing. - Each pull request's preview saved its own 435 MB web build, which only later pushes to that pull request could restore. The preview now shares main's web app cache (web-deploy.yml builds the same app) and saves none, so its first build starts warm too.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
| with: | ||
| # Shared with the pull request previews' build of the same app (docs-preview.yml), | ||
| # which restores this cache and saves none of its own. | ||
| shared-key: web |
There was a problem hiding this comment.
Security (low confidence, about 30%): this key now links untrusted runs to the deploy job's cache. Before this PR, docs-preview.yml (which runs pull request code with no secrets) had its own per-PR key, so web-deploy.yml never restored anything a PR could influence. With shared-key: web, a preview restores the same key that the deploy job, which holds WEB_DEPLOY_KEY, restores and saves. A PR cannot write that key, because docs-preview.yml sets save-if: false and PR-scoped caches are not visible to main. The remaining writer is workflow_dispatch: a maintainer who dispatches this workflow from main with an arbitrary ref input saves a main-scoped cache. Its key includes the Cargo.lock hash and rust-cache does not save the workspace's own crates, so the impact is limited. But a restore-key prefix match could still hand previews a cache built from that ref's dependencies. Options to consider: save only on push (github.event_name == 'push'), or give previews a key that dispatches cannot write. Not blocking if the maintainers accept that trust boundary.
There was a problem hiding this comment.
Fixed in 2cb6d2e: web-deploy.yml saves the web cache only on push (save-if: ${{ github.event_name == 'push' }}), so a run started by hand on another ref restores it but writes nothing previews could restore. Previews still save nothing.
Code reviewBugs: None found. I checked the Security:
Performance: None. The change removes a 435 MB per-PR cache save and the nightly's release-keyed save, which reduces cache pressure. Quality:
AGENTS.md: No violations. The workflow files fall outside the Rust and asset rules, and the comments and the Already raised in earlier threads: none. Change sizeCompared with main (merge base c506aa1 to PR head c0156c3).
|
📖 Docs preview
GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the |
The pull request previews restore this cache. A run started by hand may build another ref, and its cache would then be what previews restore.
Code reviewReviewed the three workflow changes ( Bugs: None found.
Security: None new.
Performance:
Quality:
AGENTS.md:
Already raised, left alone: 1 earlier thread ( Change sizeCompared with
|
Summary
The repository's Actions cache is at GitHub's 10 GB limit (10.6 GB in 67 entries, the oldest two days old), and GitHub evicts the least recently used entries first. Caches pull requests use all day stay warm. A cache used once a day is gone by the next. Two kinds of cache were saved and never restored:
test-rust.ymlkept the nightly's cache apart (key: release) so that the release build wouldn't bloat the cache pull requests restore. Saved every night, it was evicted before the next one: on the last three nights all four platforms loggedNo cache foundand built from nothing, 30 to 75 minutes each. A run with the release build (the nightly,ci:full) now restores main's test cache and saves nothing. Its test build starts warm; the release build itself still compiles from nothing, as it did when its cache was evicted.docs-preview.ymlsaved a 435 MB cache per pull request, which only later pushes to that pull request could restore. The first preview of each pull request built from nothing (12 to 13 minutes, against 9 to 11 warm). The preview now shares the cache ofweb-deploy.yml, which builds the same app on main with the same commands (trunk build --release,xtask web-pwa). It restores that cache and saves none, andweb-deploy.ymlsaves it only from pushes to main, not from a run started by hand on another ref.That takes about 3 GB a night and 435 MB per pull request out of the cache, leaving room for main's caches to stay. It should also keep the nightly's Census files (16 MB), which were evicted every day (#1550).
Testing
rust-cachesettings do.shared-key: web, both web builds use the keyv0-rust-web-Linux-x64-<env>-<lock>, built from the same toolchain, environment and lock file. The nightly andci:fullnow use the same key as main'sTestjob, which runs on the same runners with the same environment.Restored from cache key "v0-rust-test-…", and a pull request's first previewRestored from cache key "v0-rust-web-…"once main has deployed after this change.UI evidence
No visible UI change.
Related issue
Follow-up to #1550, which found the nightly's Census cache evicted every day.
Summary by CodeRabbit