forked from vitest-dev/vitest
-
Notifications
You must be signed in to change notification settings - Fork 0
365 lines (288 loc) · 10.1 KB
/
ci.yml
File metadata and controls
365 lines (288 loc) · 10.1 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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
name: CI
# Remove default permissions of GITHUB_TOKEN for security
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
permissions: {}
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
concurrency:
group: ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.cache/ms-playwright
jobs:
lint:
timeout-minutes: 10
runs-on: ubuntu-latest
name: 'Lint: node-latest, ubuntu-latest'
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: ./.github/actions/setup-and-cache
- name: Install
run: pnpm i
- name: Build
run: pnpm run build
- name: Generate CLI docs
run: pnpm -C docs run cli-table
# check uncommited LICENSE.md, auto-imports.d.ts, etc...
- name: Check stale build artifacts
run: git diff --exit-code
- name: Lint
run: pnpm run lint
- name: Typecheck
run: pnpm run typecheck
- name: Typecheck UI
run: pnpm run -C packages/ui typecheck:client
# From https://github.com/rhysd/actionlint/blob/main/docs/usage.md#use-actionlint-on-github-actions
- name: Check workflow files
run: |
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
./actionlint -color -shellcheck=""
changed:
runs-on: ubuntu-latest
name: 'Diff: node-latest, ubuntu-latest'
outputs:
should_skip: ${{ steps.changed-files.outputs.only_changed == 'true' }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@22103cc46bda19c2b464ffe86db46df6922fd323 # v47.0.5
with:
files: |
docs/**
.github/**
!.github/workflows/ci.yml
**.md
test:
needs: changed
name: 'Build&Test: node-${{ matrix.node_version }}, ${{ matrix.os }}'
if: needs.changed.outputs.should_skip != 'true'
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
matrix:
os: [ubuntu-latest]
node_version: [22, 24]
include:
- os: macos-latest
node_version: 24
- os: windows-latest
node_version: 24
fail-fast: false
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: ./.github/actions/setup-and-cache
with:
node-version: ${{ matrix.node_version }}
- uses: ./.github/actions/setup-webdriverio
id: setup-webdriverio
with:
firefox-version: false
- name: Install
run: pnpm i
- uses: ./.github/actions/setup-playwright
- name: Build
run: pnpm run build
- name: Test
run: pnpm run test:ci
env:
VITEST_CI_BLOB_LABEL: ${{ matrix.os }}-node-${{ matrix.node_version }}
- name: Test Examples
run: pnpm run test:examples
- name: Unit Test UI
run: pnpm -C packages/ui test:ui
env:
VITEST_CI_BLOB_LABEL: ${{ matrix.os }}-node-${{ matrix.node_version }}
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: ${{ !cancelled() }}
with:
name: playwright-report-${{ matrix.os }}-node-${{ matrix.node_version }}
path: test/ui/test-results/
retention-days: 30
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: ${{ !cancelled() }}
with:
name: vitest-results-${{ matrix.os }}-node-${{ matrix.node_version }}
path: |
README.md
test/unit/.vitest
test/e2e/.vitest
packages/ui/.vitest
retention-days: 1
include-hidden-files: true
test-cached:
needs: changed
name: 'Cache&Test: node-${{ matrix.node_version }}, ${{ matrix.os }}'
if: needs.changed.outputs.should_skip != 'true'
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
matrix:
node_version: [24]
os:
- macos-latest
- windows-latest
fail-fast: false
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: ./.github/actions/setup-and-cache
with:
node-version: ${{ matrix.node_version }}
- uses: ./.github/actions/setup-webdriverio
id: setup-webdriverio
with:
firefox-version: false
- name: Install
run: pnpm i
- uses: ./.github/actions/setup-playwright
- name: Build
run: pnpm run build
- name: Test
run: pnpm run test:ci:cache
test-browser:
needs: changed
name: 'Browsers: node-${{ matrix.node_version }}, ${{ matrix.os }}'
if: needs.changed.outputs.should_skip != 'true'
runs-on: ${{ matrix.os }}
strategy:
matrix:
node_version: [24]
os:
- macos-latest
- windows-latest
fail-fast: false
timeout-minutes: 30
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: ./.github/actions/setup-and-cache
with:
node-version: ${{ matrix.node_version }}
- uses: ./.github/actions/setup-webdriverio
id: setup-webdriverio
- name: Install
run: pnpm i
- uses: ./.github/actions/setup-playwright
- name: Build
run: pnpm run build
- name: Test Browser (playwright)
run: pnpm run test:browser:playwright
- name: Test Browser (webdriverio)
run: pnpm run test:browser:webdriverio
test-vite7:
needs: changed
# macos-latest is the fastest one
name: 'Test: vite@7, node-24, macos-latest'
if: needs.changed.outputs.should_skip != 'true'
runs-on: macos-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: ./.github/actions/setup-and-cache
with:
node-version: 24
- uses: ./.github/actions/setup-webdriverio
id: setup-webdriverio
with:
firefox-version: false
- name: Install
run: |
pnpm override-vite7
git add . && git commit -m "ci" && pnpm i --prefer-offline --no-frozen-lockfile
- uses: ./.github/actions/setup-playwright
- name: Build
run: pnpm run build
- name: Test
run: pnpm run test:ci:no-bail
- name: Test Examples
if: ${{ !cancelled() }}
run: pnpm run test:examples
- name: Unit Test UI
if: ${{ !cancelled() }}
run: pnpm -C packages/ui test:ui
- name: Test Browser (playwright)
if: ${{ !cancelled() }}
run: pnpm run test:browser:playwright
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: ${{ !cancelled() }}
with:
name: playwright-report-vite7
path: test/ui/test-results/
retention-days: 30
merge-reports:
needs:
- test
- changed
if: needs.changed.outputs.should_skip != 'true' && !cancelled()
runs-on: ubuntu-latest
name: Merge Reports
timeout-minutes: 10
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: ./.github/actions/setup-and-cache
- name: Install
run: pnpm i
- name: Build
run: pnpm run build
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
pattern: vitest-results-*
merge-multiple: true
- name: Merge reports
continue-on-error: true
run: |
set +e
pnpm --filter=./packages/ui --no-bail test:ui --merge-reports
cp ./packages/ui/.vitest/html/index.html ./packages/ui/.vitest/html/test-ui.html
pnpm --filter=./test/unit --filter=./test/e2e --no-bail --sequential test --merge-reports
cp -rf ./test/unit/.vitest/html/index.html ./test/unit/.vitest/html/test-unit.html
cp -rf ./test/e2e/.vitest/html/index.html ./test/e2e/.vitest/html/test-e2e.html
env:
VITEST_CI_MERGE_REPORTS: 'true'
- name: Upload Test UI Report
id: upload-ui-report
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
path: ./packages/ui/.vitest/html/test-ui.html
archive: false
retention-days: 7
- name: Upload Test Unit Report
id: upload-unit-report
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
path: ./test/unit/.vitest/html/test-unit.html
archive: false
retention-days: 7
- name: Upload Test E2E Report
id: upload-e2e-report
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
path: ./test/e2e/.vitest/html/test-e2e.html
archive: false
retention-days: 7
- name: Link CI reports
run: |
echo "::notice title=CI reports::test/unit: ${STEPS_UPLOAD_UNIT_REPORT_OUTPUTS_ARTIFACT_URL}"
echo "::notice title=CI reports::test/e2e: ${STEPS_UPLOAD_E2E_REPORT_OUTPUTS_ARTIFACT_URL}"
echo "::notice title=CI reports::packages/ui: ${STEPS_UPLOAD_UI_REPORT_OUTPUTS_ARTIFACT_URL}"
env:
STEPS_UPLOAD_UNIT_REPORT_OUTPUTS_ARTIFACT_URL: ${{ steps.upload-unit-report.outputs.artifact-url }}
STEPS_UPLOAD_E2E_REPORT_OUTPUTS_ARTIFACT_URL: ${{ steps.upload-e2e-report.outputs.artifact-url }}
STEPS_UPLOAD_UI_REPORT_OUTPUTS_ARTIFACT_URL: ${{ steps.upload-ui-report.outputs.artifact-url }}