-
Notifications
You must be signed in to change notification settings - Fork 107
64 lines (53 loc) · 1.82 KB
/
test-template.yml
File metadata and controls
64 lines (53 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Test Template(s)
on:
workflow_call:
inputs:
template:
required: true
type: string
description: 'Template name (e.g., vite, starter)'
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install dependencies (tests)
working-directory: tests
run: npm ci
- name: Install dependencies (template)
working-directory: templates/${{ inputs.template }}
run: npm install
- name: Get Playwright version
id: playwright-version
working-directory: tests
run: echo "version=$(npm ls @playwright/test --json | jq -r '.dependencies["@playwright/test"].version')" >> $GITHUB_OUTPUT
- name: Cache Playwright browsers
uses: actions/cache@v4
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: playwright-${{ steps.playwright-version.outputs.version }}
- name: Install Playwright browsers
if: steps.playwright-cache.outputs.cache-hit != 'true'
working-directory: tests
run: npx playwright install --with-deps chromium
- name: Install Playwright system dependencies
if: steps.playwright-cache.outputs.cache-hit == 'true'
run: npx playwright install-deps chromium
- name: Run Playwright tests
working-directory: tests
run: npm run test
env:
CI: true
TEMPLATE: ${{ inputs.template }}
- name: Upload Playwright report
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report-${{ inputs.template }}-template
path: tests/playwright-report/index.html
retention-days: 30