Skip to content

Commit cdcc1d5

Browse files
committed
ci: key the Playwright browser cache on the OS release
The cache key was `Linux-playwright-<version>`, which does not change when `ubuntu-latest` moves to a new Ubuntu release. Playwright downloads a different WebKit build per OS release, but installs it into the same `webkit-<revision>` directory, and `playwright install` skips a browser whose directory is already complete. When `ubuntu-latest` rolled over to 26.04, the job restored a cache saved on 24.04, `playwright install` found `webkit-2388` and downloaded nothing, and the 24.04 build then failed to start (`libicudata.so.74: cannot open shared object file`). All 529 WebKit tests failed in the Playwright bucket. Add the OS release to the key and to `restore-keys`, read from `/etc/os-release` on Linux and `sw_vers` on macOS (the runner images only export `ImageOS` through `.bashrc` on macOS, which a non-interactive step does not source). The first run on each new image does one cold browser download.
1 parent a9f2e53 commit cdcc1d5

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

‎.github/workflows/test-smokes.yml‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,16 @@ jobs:
237237
run: |
238238
VERSION=$(node -p "require('@playwright/test/package.json').version")
239239
echo "PLAYWRIGHT_VERSION=$VERSION" >> "$GITHUB_ENV"
240+
# Browser builds are per OS release (e.g. WebKit links the distro's ICU),
241+
# but the install directory name is not, so the cache must not cross
242+
# OS releases (ubuntu 24.04 -> 26.04).
243+
if [ -r /etc/os-release ]; then
244+
. /etc/os-release
245+
HOST="$ID-$VERSION_ID"
246+
else
247+
HOST="macos-$(sw_vers -productVersion | cut -d. -f1)"
248+
fi
249+
echo "PLAYWRIGHT_HOST=$HOST" >> "$GITHUB_ENV"
240250
working-directory: ./tests/integration/playwright
241251
shell: bash
242252

@@ -249,9 +259,9 @@ jobs:
249259
uses: actions/cache@v5
250260
with:
251261
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
252-
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
262+
key: ${{ runner.os }}-${{ env.PLAYWRIGHT_HOST }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
253263
restore-keys: |
254-
${{ runner.os }}-playwright-
264+
${{ runner.os }}-${{ env.PLAYWRIGHT_HOST }}-playwright-
255265
256266
- name: Install Playwright system dependencies
257267
if: >-

0 commit comments

Comments
 (0)