Repository navigation
91 lines (78 loc) · 2.83 KB
/
Copy pathe2e.yml
File metadata and controls
91 lines (78 loc) · 2.83 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
81
82
83
84
85
86
87
88
89
90
91
name: End-to-end
# A required check. Do not filter it by path. A required check that never starts
# blocks a pull request forever.
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
# Called by the release workflow.
workflow_call:
permissions:
contents: read
jobs:
e2e:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: '24'
- name: Install dev tooling
run: npm ci
- name: Cache Playwright browsers
id: browsers
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
# Any dev-dependency bump changes the key, so fall back to the last
# browser set rather than re-downloading all of them; the install step
# below fetches whatever that set is missing.
restore-keys: playwright-${{ runner.os }}-
- name: Install browsers
run: npx playwright install --with-deps chromium webkit
# The image that ships, so nginx and its headers are part of what is
# tested. A bug this project has already had, an inline handler refused by
# the Content-Security-Policy, is invisible without them.
- name: Build the image
run: docker build -t stackyard:e2e .
- name: Start the container
run: |
mkdir -p "$RUNNER_TEMP/data" "$RUNNER_TEMP/icons"
chmod 777 "$RUNNER_TEMP/data" "$RUNNER_TEMP/icons"
docker run -d --name stackyard-e2e \
-p 8730:80 \
-v "$RUNNER_TEMP/data:/data" \
-v "$RUNNER_TEMP/icons:/icons" \
stackyard:e2e
for i in $(seq 1 60); do
if curl -fsS http://127.0.0.1:8730/health >/dev/null 2>&1; then echo "up after ${i}s"; exit 0; fi
sleep 1
done
echo "::error::the container never became healthy"
docker logs stackyard-e2e
exit 1
- name: Run the specs
run: npx playwright test
env:
BASE_URL: http://127.0.0.1:8730
- name: Container logs on failure
if: failure()
run: docker logs stackyard-e2e
- name: Upload the report
if: failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: playwright-report
path: playwright-report/
retention-days: 7
- name: Stop the container
if: always()
run: docker rm -f stackyard-e2e || true