Repository navigation
273 lines (230 loc) · 7.88 KB
/
Copy pathrelease.yml
File metadata and controls
273 lines (230 loc) · 7.88 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
name: Release tarballs
# Trigger on tags ``vX.Y.Z`` and on manual dispatch (for re-runs).
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
permissions:
contents: write
pages: write
id-token: write
jobs:
verify:
name: Verify versions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Require published Sigima, guidata and DataLab-Capsule dependencies
run: node scripts/check-sigima-release.mjs
- name: Check tag matches package.json and SDK versions
run: |
APP_VERSION=$(node -p "require('./package.json').version")
SDK_VERSION=$(node -p "require('./packages/sdk/package.json').version")
echo "app=$APP_VERSION sdk=$SDK_VERSION"
if [ "$APP_VERSION" != "$SDK_VERSION" ]; then
echo "::error::package.json ($APP_VERSION) and packages/sdk/package.json ($SDK_VERSION) versions disagree."
exit 1
fi
# On a tag push, additionally enforce that the tag matches the
# package version. Skipped on workflow_dispatch (manual re-run).
if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
TAG_VERSION="${GITHUB_REF_NAME#v}"
if [ "$APP_VERSION" != "$TAG_VERSION" ]; then
echo "::error::tag ${GITHUB_REF_NAME} does not match package.json version ${APP_VERSION}."
exit 1
fi
echo "Tag ${GITHUB_REF_NAME} matches package version ${APP_VERSION}."
fi
python-tests:
name: Python ${{ matrix.python-version }} (pytest)
runs-on: ubuntu-latest
needs: verify
env:
DLW_REQUIRE_PROVENANCE: "1"
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12"]
steps:
- uses: actions/checkout@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: |
requirements-dev.txt
sigima-dependency.json
guidata-dependency.json
datalab-capsule-dependency.json
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python scripts/sigima_dependency.py install --published
python scripts/capsule_dependency.py install
- name: Run pytest
run: python -m pytest tests/python
e2e:
# Balanced parallel shards, as in ``tests.yml`` (see
# ``scripts/e2e-shards.mjs``); ``pack`` waits for every shard.
name: End-to-end (Playwright ${{ matrix.shard }}/${{ strategy.job-total }})
runs-on: ubuntu-latest
needs: verify
env:
DLW_REQUIRE_PROVENANCE: "1"
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
steps:
- uses: actions/checkout@v7
- name: Report runner hardware
run: |
echo "vCPUs: $(nproc)"
lscpu | grep -E '^(Model name|Thread\(s\) per core|Core\(s\) per socket|Socket\(s\))' || true
free -h
- uses: actions/setup-node@v7
with:
node-version: 24
cache: npm
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Install npm dependencies
run: npm ci
- name: Select the spec files of this shard
run: >-
node scripts/e2e-shards.mjs plan
--shard ${{ matrix.shard }}/${{ strategy.job-total }}
--output "$RUNNER_TEMP/e2e-specs.txt"
- name: Install the published DataLab-Capsule registry (optional feature, tested)
run: |
REQ=$(node -p "require('./datalab-capsule-dependency.json').publishedRequirement")
python -m pip install "${REQ/==/[registry]==}"
echo "DLW_REGISTRY_PYTHON=$(command -v python)" >> "$GITHUB_ENV"
echo "DLW_REQUIRE_REGISTRY=1" >> "$GITHUB_ENV"
- name: Install Playwright browsers
run: npx playwright install --with-deps chromium
- name: Run Playwright tests
env:
VITE_SIGIMA_INSTALL_SPEC: ""
VITE_GUIDATA_INSTALL_SPEC: ""
VITE_DATALAB_CAPSULE_INSTALL_SPEC: ""
PLAYWRIGHT_BLOB_OUTPUT_NAME: report-${{ matrix.shard }}.zip
run: |
mapfile -t specs < "$RUNNER_TEMP/e2e-specs.txt"
npm run test:e2e -- --reporter=github,blob "${specs[@]}"
- name: Upload shard report
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: e2e-shard-${{ matrix.shard }}
path: blob-report/
retention-days: 1
e2e-report:
name: End-to-end (Playwright report)
runs-on: ubuntu-latest
needs: e2e
if: ${{ !cancelled() }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 24
cache: npm
- name: Install npm dependencies
run: npm ci
- name: Download shard reports
uses: actions/download-artifact@v8
with:
pattern: e2e-shard-*
path: blob-report
merge-multiple: true
- name: Merge Playwright reports
run: npx playwright merge-reports --reporter=html ./blob-report
- name: Upload Playwright report
uses: actions/upload-artifact@v7
with:
name: playwright-report
path: playwright-report/
retention-days: 14
pack:
name: Build & pack (app + SDK)
runs-on: ubuntu-latest
needs: [verify, python-tests, e2e]
outputs:
app-version: ${{ steps.versions.outputs.app }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 24
cache: npm
- name: Install dependencies
run: npm ci
- name: Read app version
id: versions
run: echo "app=$(node -p "require('./package.json').version")" >> "$GITHUB_OUTPUT"
- name: Lint
run: npm run lint
- name: Unit tests (Vitest)
run: npm run test
- name: Build app bundle
run: npm run build:release
- name: Pack SDK tarball
run: npm run sdk:pack
- name: Pack app tarball
run: npm run app:pack
- name: List release artefacts
run: ls -lh release/
- name: Upload tarballs as workflow artefacts
uses: actions/upload-artifact@v7
with:
name: datalab-web-release
path: release/*.tgz
if-no-files-found: error
retention-days: 30
- name: Upload built bundle for Pages deploy
uses: actions/upload-artifact@v7
with:
name: datalab-web-dist
path: dist/
if-no-files-found: error
retention-days: 7
- name: Extract release notes from CHANGELOG
if: startsWith(github.ref, 'refs/tags/v')
run: node scripts/extract-changelog.mjs "$GITHUB_REF_NAME" -o release-notes.md
- name: Attach tarballs to GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v3
with:
files: release/*.tgz
fail_on_unmatched_files: true
body_path: release-notes.md
generate_release_notes: true
deploy-pages:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
needs: pack
# Only deploy on actual tag pushes; skip on workflow_dispatch re-runs.
if: startsWith(github.ref, 'refs/tags/v')
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
concurrency:
group: pages
cancel-in-progress: false
steps:
- name: Download built bundle
uses: actions/download-artifact@v8
with:
name: datalab-web-dist
path: dist
- uses: actions/configure-pages@v6
- uses: actions/upload-pages-artifact@v5
with:
path: dist
- id: deployment
uses: actions/deploy-pages@v5