cache playwright in ci

This commit is contained in:
Gauthier Roebroeck 2025-06-25 13:57:18 +08:00
parent 484e91f062
commit 0e021154c5
2 changed files with 32 additions and 3 deletions

View file

@ -0,0 +1,20 @@
name: "Setup Playwright"
description: "Setup Playwright with caching, using npm (should already be installed)"
runs:
using: "composite"
steps:
- name: Extract Playwright version
id: playwright-version
shell: bash
run: echo "PLAYWRIGHT_VERSION=$(jq -r '.devDependencies.playwright' package.json)" >> $GITHUB_ENV
- name: Cache Playwright
id: playwright-cache
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ env.PLAYWRIGHT_VERSION }}
- name: Install Playwright dependencies
shell: bash
run: npx playwright install --with-deps --only-shell

View file

@ -101,35 +101,44 @@ jobs:
name: Test next-ui
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
cache-dependency-path: next-ui/package-lock.json
- name: npm install
working-directory: next-ui
run: npm ci
- name: npx playwright install --with-deps
working-directory: next-ui
run: npx playwright install --with-deps
- name: Setup Playwright
uses: ./.github/actions/setup-playwright
- name: test:unit
working-directory: next-ui
run: npm run test:unit
# retry because of https://github.com/storybookjs/storybook/issues/31599
- name: test:storybook
uses: nick-fields/retry@v3
with:
command: npm run --prefix next-ui test:storybook
max_attempts: '3'
timeout_minutes: '5'
- name: lint
working-directory: next-ui
run: npm run lint
- name: prettier
working-directory: next-ui
run: npm run prettier
- name: type-check
working-directory: next-ui
run: npm run type-check
- name: build
working-directory: next-ui
run: npm run build-only