-
Notifications
You must be signed in to change notification settings - Fork 1
80 lines (67 loc) · 2.32 KB
/
Copy pathplaywright-e2e.yml
File metadata and controls
80 lines (67 loc) · 2.32 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Playwright E2E
on:
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
concurrency:
group: e2e-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
e2e:
timeout-minutes: 30
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write # needed for the PR comment step
steps:
- uses: actions/checkout@v6
# Astro requires Node >=22.12.0 (see .node-version / package.json engines)
- uses: actions/setup-node@v6
with:
node-version-file: ".node-version"
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install --frozen-lockfile
# Install only Chromium in CI – matches playwright.config.ts project list
- name: Install Playwright browsers
run: bunx playwright install --with-deps chromium
# Build the Astro site and start the preview server on port 4321
- name: Build Astro site
run: bun run build
env:
BASE_URL: "http://localhost:4321"
- name: Run Playwright E2E tests
run: bunx playwright test
env:
CI: "true"
PLAYWRIGHT_BASE_URL: "http://localhost:4321"
# Always upload artifacts so failures can be investigated
- name: Upload Playwright report
if: always()
uses: actions/upload-artifact@v7
with:
name: playwright-report
path: playwright-report/
retention-days: 14
- name: Upload test results (traces, videos, screenshots)
if: always()
uses: actions/upload-artifact@v7
with:
name: playwright-results
path: test-results/
retention-days: 14
# Comment on the PR with run status and artifact links.
# Uses github-script so it works from fork PRs without leaking secrets
# (GITHUB_TOKEN is scoped to the target repo).
- name: Comment on PR
if: always() && github.event_name == 'pull_request'
uses: actions/github-script@v9
env:
JOB_STATUS: ${{ job.status }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const script = require('./.github/workflows/comment-pr.js')
await script({ github, context, core })