Skip to content

Commit e26e835

Browse files
authored
test: Cache Playwright deps (#6716)
1 parent 59b0bf6 commit e26e835

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

.github/workflows/build.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,13 +541,34 @@ jobs:
541541
with:
542542
path: ${{ env.CACHED_BUILD_PATHS }}
543543
key: ${{ env.BUILD_CACHE_KEY }}
544+
- name: Get npm cache directory
545+
id: npm-cache-dir
546+
run: |
547+
echo "::set-output name=dir::$(npm config get cache)"
548+
- name: Get Playwright version
549+
id: playwright-version
550+
run: |
551+
echo "::set-output name=version::$(node -p "require('@playwright/test/package.json').version")"
552+
- uses: actions/cache@v3
553+
name: Check if Playwright browser is cached
554+
id: playwright-cache
555+
with:
556+
path: ${{ steps.npm-cache-dir.outputs.dir }}
557+
key: ${{ runner.os }}-Playwright-${{steps.playwright-version.outputs.version}}
558+
- name: Install Playwright browser if not cached
559+
if: steps.playwright-cache.outputs.cache-hit != 'true'
560+
run: npx playwright install --with-deps
561+
env:
562+
PLAYWRIGHT_BROWSERS_PATH: ${{steps.npm-cache-dir.outputs.dir}}
563+
- name: Install OS dependencies of Playwright if cache hit
564+
if: steps.playwright-cache.outputs.cache-hit == 'true'
565+
run: npx playwright install-deps
544566
- name: Run Playwright tests
545567
env:
546568
PW_BUNDLE: ${{ matrix.bundle }}
547569
PW_TRACING_ONLY: ${{ matrix.tracing_only }}
548570
run: |
549571
cd packages/integration-tests
550-
yarn run playwright install-deps webkit
551572
yarn test:ci
552573
553574
job_browser_integration_tests:

0 commit comments

Comments
 (0)