Skip to content
Source
Sign inSign up
pingdotgg/t3code

ci: cache Chromium for server test shards #19632

Mergedmaria-rcksmerged 2 commits intot3/smart-ci-workflow-gating fromrefs/pull/19632/headmerged by maria-rcks View on GitHub

Showing 1 changed file with 24 additions and 1 deletion.

x
0 of 1 viewed, 1 left
24 additions and 1 deletion.github/workflows/ci.ymlModified
View file
@@ -322,9 +322,32 @@
# No Electron setup here: `t3` (apps/server) has no Electron dependency
# and none of its tests touch the runtime. Only the non-server `test`
# job, which covers @t3tools/desktop, needs the download.
+ # Cache the pinned browser and skip apt unless shared libraries are missing.
+ - name: Resolve Playwright version
+ id: playwright_version
+ if: steps.changes.outputs.test_server != 'false'
+ run: echo "version=$(node -p "require('./apps/server/node_modules/playwright-core/package.json').version")" >> "$GITHUB_OUTPUT"
+​
+ - name: Cache Chromium
+ id: chromium_cache
+ if: steps.changes.outputs.test_server != 'false'
+ uses: actions/cache@v6
+ with:
+ path: ~/.cache/ms-playwright
+ key: playwright-chromium-shell-${{ runner.os }}-${{ runner.arch }}-${{ steps.playwright_version.outputs.version }}
+​
- name: Install Chromium for server browser integration tests
+ if: steps.changes.outputs.test_server != 'false' && steps.chromium_cache.outputs.cache-hit != 'true'
+ run: node apps/server/node_modules/playwright-core/cli.js install --only-shell chromium
+​
+ - name: Install missing Chromium system dependencies
if: steps.changes.outputs.test_server != 'false'
- run: node apps/server/node_modules/playwright-core/cli.js install --with-deps --only-shell chromium
+ run: |
+ browser=$(find "$HOME/.cache/ms-playwright" -name chrome-headless-shell -type f -print -quit)
+ test -n "$browser"
+ if ldd "$browser" | grep '=> not found'; then
+ node apps/server/node_modules/playwright-core/cli.js install-deps chromium