Choices/.github/workflows/browsers.yml
2024-08-17 21:21:42 +08:00

60 lines
1.9 KiB
YAML

name: End-to-end tests (playwright)
on:
push:
branches: [ playwright ]
pull_request:
branches: [ main, master ]
jobs:
test-e2e-playwright:
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest] # caching setup doesn't work on windows (yet), and macos is 10 times expensive minutes wise
# os: [windows-latest, macos-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Cache node modules
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.OS }}-build
restore-keys: |
${{ runner.OS }}-build
${{ runner.OS }}
- name: Install dependencies
run: npm ci --no-audit
- name: Get installed Playwright version
id: playwright-version
run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./package-lock.json').packages['node_modules/@playwright/test'].version)")" >> $GITHUB_ENV
- name: Cache playwright binaries
uses: actions/cache@v3
id: playwright-cache
with:
path: |
~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
- name: Install Playwright Browsers
run: npx playwright install --with-deps
if: steps.playwright-cache.outputs.cache-hit != 'true'
- run: npx playwright install-deps
if: steps.playwright-cache.outputs.cache-hit != 'true'
- name: Run Playwright tests
run: npm run test:e2e:all
- uses: actions/upload-artifact@v4
if: failure()
with:
name: screenshot-${{ matrix.os }}
path: screenshot
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30