ci: cache Playwright browsers for the story tests - #311
Merged
Conversation
The `Install Chromium` step downloads the browser from Playwright's CDN on every run, with nothing caching it. That is usually fast and sometimes not: observed 19-22s on several runs, then 241s, then 1379s, and one run sat on it for over 20 minutes. The job's budget is 25 minutes, so a slow download means the story tests never execute and the check fails having tested nothing. Caches `~/.cache/ms-playwright`, keyed on the resolved playwright version rather than a hash of yarn.lock -- the browser revision only changes when playwright does, so an unrelated dependency bump should not discard it. System libraries live outside that directory and are installed either way. On a cache hit only `install-deps` runs, which is seconds; on a miss the full `install --with-deps` runs as before. The first run after this lands still pays the download once, to populate the cache.
|
📦 Preview published for commit Install the preview with dist-tag: npm install @vc-shell/framework@pr-311Or pin to the exact commit: npm install @vc-shell/framework@2.4.0-pr311.5130191Published packages (dist-tag
|
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.
Problem
storybook-testsdownloads Chromium from Playwright's CDN on every run, and nothing caches it. That download is usually fast and sometimes not. Measured on theInstall Chromiumstep across recent runs:The job's
timeout-minutesis 25. When the download is slow, the step eats the entire budget and the story tests never run — the check reports failure having tested nothing. That is what happened on #310, whose own diff was two ai-agent files.Worth stating explicitly: this is not caused by #309 (
checkout@v4→v7,setup-node@v4→v7). Those actions have nothing to do with browser downloads, and the fast/slow split straddles that merge — 33 s and 73 s runs landed onmainafter it. The variance is the CDN.Change
Cache
~/.cache/ms-playwright, keyed on the resolved playwright version rather than a hash ofyarn.lock. The browser revision only changes when playwright does, so an unrelated dependency bump should not throw the cache away.System libraries live outside that directory, so they are installed either way:
playwright install --with-deps chromium, as beforeplaywright install-deps chromium, which is secondsThe existing comment about needing the workspace binary rather than
yarn dlxis preserved — that constraint still holds.Note on the first run
The first run after this merges still pays the download once, to populate the cache. If it happens to land during a slow CDN window it can still hit the 25-minute timeout; a re-run will then find the cache warm.
timeout-minutesis deliberately left at 25 — with the cache in place the step should be seconds, and raising the ceiling would just hide a future regression for longer.