-
Notifications
You must be signed in to change notification settings - Fork 0
126 lines (100 loc) · 3.33 KB
/
Copy pathdeploy.yml
File metadata and controls
126 lines (100 loc) · 3.33 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: Test and deploy
# Runs entirely on public infrastructure. Nothing here may depend on an
# internal host: corporate mirrors such as artifacts.sys.dom do not resolve
# from GitHub runners. The lockfile check below enforces that.
on:
push:
branches: [main, master]
pull_request:
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: '22'
cache: npm
- name: Lockfile must point at the public npm registry
run: node scripts/normalize-lockfile.mjs --check
- run: npm ci
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Python test dependencies
run: python -m pip install --disable-pip-version-check pytest
- name: Transformer and project tests
run: python -m pytest
- name: Resolve Playwright version for the cache key
id: pw
run: |
version=$(node -p "require('@playwright/test/package.json').version")
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Cache browsers
id: pw-cache
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ steps.pw.outputs.version }}
- name: Install browsers
run: npx playwright install --with-deps chromium firefox
- name: Install browser system dependencies
if: steps.pw-cache.outputs.cache-hit == 'true'
run: npx playwright install-deps chromium firefox
- name: Browser tests
run: npx playwright test
- name: GitHub Pages subpath tests
run: npx playwright test -c playwright.ghpages.config.ts
- uses: actions/upload-artifact@v7
if: failure()
with:
name: playwright-report
path: |
playwright-report/
test-results/
retention-days: 7
deploy:
needs: test
# Only the default branch publishes, whatever it happens to be called.
if: github.event_name != 'pull_request' && github.ref_name == github.event.repository.default_branch
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: '22'
cache: npm
- run: npm ci
- name: Work out the Pages base path
id: base
run: |
owner="${GITHUB_REPOSITORY%%/*}"
repo="${GITHUB_REPOSITORY#*/}"
# A <user>.github.io repository is served from the domain root;
# every other repository is served from /<repo>/.
if [ "$repo" = "${owner}.github.io" ]; then
echo "path=/" >> "$GITHUB_OUTPUT"
else
echo "path=/${repo}/" >> "$GITHUB_OUTPUT"
fi
- name: Build
env:
BASE_PATH: ${{ steps.base.outputs.path }}
run: npm run build
- uses: actions/configure-pages@v6
- uses: actions/upload-pages-artifact@v5
with:
path: dist
- id: deployment
uses: actions/deploy-pages@v4