Skip to content

Commit 0c1edcc

Browse files
chore: gh caching
1 parent 34a203c commit 0c1edcc

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

.github/workflows/main.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,58 @@ jobs:
1616
steps:
1717
- name: Checkout
1818
uses: actions/checkout@v4
19+
1920
- name: Setup pnpm
2021
uses: pnpm/action-setup@v4
2122
# version is read from package.json#packageManager
23+
2224
- name: Setup Node.js
2325
uses: actions/setup-node@v4
2426
with:
2527
node-version: 20
2628
cache: 'pnpm'
29+
30+
- name: Get pnpm store directory
31+
id: pnpm-cache
32+
shell: bash
33+
run: |
34+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
35+
36+
- name: Setup pnpm cache
37+
uses: actions/cache@v4
38+
with:
39+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
40+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
41+
restore-keys: |
42+
${{ runner.os }}-pnpm-store-
43+
44+
- name: Get Playwright version
45+
id: playwright-version
46+
run: echo "PLAYWRIGHT_VERSION=$(pnpm ls @playwright/test --json | jq -r '.[0].devDependencies."@playwright/test".version')" >> $GITHUB_OUTPUT
47+
48+
- name: Cache Playwright browsers
49+
id: playwright-cache
50+
uses: actions/cache@v4
51+
with:
52+
path: ~/.cache/ms-playwright
53+
key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.PLAYWRIGHT_VERSION }}
54+
restore-keys: |
55+
${{ runner.os }}-playwright-
56+
2757
- name: Install dependencies
2858
run: pnpm install --frozen-lockfile=false
59+
2960
- name: Install Playwright Browsers
61+
if: steps.playwright-cache.outputs.cache-hit != 'true'
3062
run: pnpm exec playwright install --with-deps
63+
64+
- name: Install Playwright dependencies only
65+
if: steps.playwright-cache.outputs.cache-hit == 'true'
66+
run: pnpm exec playwright install-deps
67+
3168
- name: Build project
3269
run: NO_NUXT=1 pnpm build
70+
3371
- name: Run Playwright tests
3472
run: pnpm test:e2e
3573
- name: Upload Playwright report

0 commit comments

Comments
 (0)