Skip to content

Commit a5d229a

Browse files
committed
try using a cached playwright
1 parent 7ae74c3 commit a5d229a

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

.github/workflows/npm-publish.yml

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,37 @@ jobs:
1616
- uses: actions/setup-node@v4
1717
with:
1818
node-version: 24
19-
- run: npm ci
20-
- name: Install Playwright Browsers
21-
run: npx playwright install chromium
22-
- name: Install Playwright System Dependencies
23-
run: npx playwright install-deps chromium
24-
- run: npm test
2519

20+
- name: Install dependencies
21+
run: npm ci
22+
23+
- name: Get Playwright version
24+
id: playwright-version
25+
run: echo "version=$(npm list @playwright/test --json | jq -r '.dependencies["@playwright/test"].version')" >> $GITHUB_OUTPUT
26+
27+
- name: Cache Playwright browsers
28+
uses: actions/cache@v4
29+
id: playwright-cache
30+
with:
31+
path: ~/.cache/ms-playwright
32+
key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }}
33+
restore-keys: |
34+
${{ runner.os }}-playwright-
35+
36+
- name: Install Playwright browsers
37+
if: steps.playwright-cache.outputs.cache-hit != 'true'
38+
run: npx playwright install --with-deps
39+
40+
- name: Install Playwright system dependencies
41+
if: steps.playwright-cache.outputs.cache-hit == 'true'
42+
run: npx playwright install-deps
43+
44+
- name: Run tests
45+
run: npm test
46+
47+
- name: Build
48+
run: npm run build
49+
2650
publish-npm:
2751
needs: build
2852
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)