ci: cache Composer downloads, so a codeload outage stops taking the build down - #23
Merged
Conversation
…uild down Every PHP job downloads its dependencies from scratch on every run. npm has been cached since the workflows were written; Composer never was. When GitHub's codeload started answering 429 this afternoon, all three PHP jobs died at "Install PHP dependencies" before a single test executed — 108 rate-limit responses and zero assertions run, on a commit that was green locally. Caches the Composer files directory rather than vendor/. The files cache holds the downloaded archives, so `composer install` still resolves and extracts normally and cannot be fooled by a partially restored vendor tree; it simply finds every archive on disk instead of reaching for the network. Keyed on composer.lock, so a dependency change invalidates it exactly, with a restore-key so a changed lock still reuses every archive that did not move and only fetches the delta. Applied at all four install sites: both jobs in tests.yml, plus lint.yml and og.yml, each placed after setup-php so composer is on PATH when the cache directory is resolved. The key deliberately omits the PHP version — the matrix jobs download identical archives, so 8.4 and 8.5 share one cache. This does not rescue a cold cache: the first run after this merge still has to download, and will still fail if the incident is ongoing. It stops the second one from depending on GitHub being healthy.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every PHP job downloads its dependencies from scratch on every run. npm has been cached since these workflows were written; Composer never was.
When GitHub's
codeloadstarted answering 429 this afternoon, all three PHP jobs died at "Install PHP dependencies" before a single test executed:108 rate-limit responses, zero assertions run — on a commit verified green locally (168 tests, 2139 assertions).
What it caches, and why not
vendor/The Composer files directory, not
vendor/. The files cache holds the downloaded archives, socomposer installstill resolves and extracts normally and can't be fooled by a partially restoredvendortree — it just finds every archive on disk instead of reaching for the network.Keyed on
composer.lockso a dependency change invalidates it exactly, with arestore-keyso a changed lock still reuses every archive that didn't move and fetches only the delta.Where it's applied
All four install sites — both jobs in
tests.yml, pluslint.ymlandog.yml— each placed aftersetup-php, socomposeris on PATH when the cache directory is resolved. Verified for every file:The key deliberately omits the PHP version: the matrix jobs download identical archives, so 8.4 and 8.5 share one cache rather than warming two.
What this does not do
It does not rescue a cold cache. The first run after this merge still has to download, and will still fail if the incident is ongoing. It stops the second one from depending on GitHub being healthy.
If you'd rather also survive a cold-cache outage, the next lever is a bounded retry around
composer install— I left that out because it also masks genuine failures, and it's a separate call from the one you made.