Repository navigation
112 lines (106 loc) · 4.96 KB
/
Copy pathpages.yml
File metadata and controls
112 lines (106 loc) · 4.96 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# CI on every push and PR that changes what ships (check, unit tests, keyless browser tests, build + dist guard); on push to main also deploy app/dist to GitHub Pages.
# Enable Pages once: Settings > Pages > Source = "GitHub Actions". No secrets or env: the PixelLab key never touches CI.
name: CI and Pages
# The site is built from app/ alone. Keep these paths equal to SHIPPED in app/version.ts so every deploy bumps the version.
# GitHub checks only a push's first 300 changed files against them, so push large docs-only sweeps apart from app/ changes.
on:
push:
branches: ['**'] # GitHub ignores `paths` for tag pushes, so tags would run everything
paths: [app/**, .github/workflows/pages.yml]
pull_request:
paths: [app/**, .github/workflows/pages.yml]
workflow_dispatch:
permissions:
contents: read
# A newer push to the same branch or PR supersedes its running checks; main always finishes so every deploy is tested.
# Manual runs get their own group: they never deploy, so they must not replace a pending deployable push.
concurrency:
group: ci-${{ github.event_name == 'workflow_dispatch' && 'manual-' || '' }}${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
build:
runs-on: ubuntu-24.04
timeout-minutes: 15
defaults:
run:
working-directory: app
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
fetch-depth: 0 # the build counts commits for the app version (app/version.ts); it needs commits and trees, not old files
filter: blob:none
- uses: actions/setup-node@v7
with:
node-version: '24.22.1'
cache: npm
cache-dependency-path: app/package-lock.json
- run: npm ci
- run: npm run check
- run: npm test
- run: npm run build
- if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/configure-pages@v6
- if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v5
with:
path: app/dist
# Sixteen one-worker shards on separate 4-vCPU runners, in parallel with build (Playwright's CI advice: shard, don't overload).
# Benchmarked 2026-10-25: 16x1 = 147-151 s, 8x1 = 175-182 s, 8x2 = 128-200 s with a load flake (docs/testing/test-performance.md).
# Shards are balanced by recorded test durations (scripts/e2e-shard.mjs), not by Playwright's equal-count --shard slices.
e2e:
name: e2e ${{ matrix.shard }}/16
runs-on: ubuntu-24.04
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
defaults:
run:
working-directory: app
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
fetch-depth: 0 # the build counts commits for the app version (app/version.ts); it needs commits and trees, not old files
filter: blob:none
- uses: actions/setup-node@v7
with:
node-version: '24.22.1'
cache: npm
cache-dependency-path: app/package-lock.json
- run: npm ci
# Fails before any test runs unless every test has exactly one shard and Playwright selects exactly this one's tests.
# The total comes from the matrix, so removing a shard entry reassigns its tests instead of dropping them.
- name: e2e-shard
run: node scripts/e2e-shard.mjs ${{ matrix.shard }}/${{ strategy.job-total }} "$RUNNER_TEMP/e2e-shard.txt"
# No --with-deps: the runner already has Chromium's libraries, and the apt mirror it used stalled shards for up to
# 10 min. Fonts the app's stacks resolve to are identical either way (docs/testing/test-performance.md).
- run: npx playwright install chromium # native crash profiles use full Chromium; ordinary tests use the headless shell
timeout-minutes: 5 # usually under 15 s; a stalled download fails here instead of holding the job for 15 minutes
- run: npm run e2e -- --test-list "$RUNNER_TEMP/e2e-shard.txt" # list + GitHub annotations for failures and flakes (playwright.config.ts)
timeout-minutes: 10 # a step timeout fails the step (job timeouts cancel it), so traces still upload
- if: ${{ !cancelled() && hashFiles('app/test-results/**/trace.zip') != '' }} # failures and retried flakes
uses: actions/upload-artifact@v7
with:
name: e2e-results-${{ matrix.shard }}
path: app/test-results
retention-days: 7
if-no-files-found: ignore
deploy:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: [build, e2e]
runs-on: ubuntu-24.04
permissions:
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v5