-
Notifications
You must be signed in to change notification settings - Fork 526
348 lines (316 loc) · 13.1 KB
/
Copy pathci.yml
File metadata and controls
348 lines (316 loc) · 13.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
name: 'ci'
on:
push:
branches:
- '**'
- '!renovate/**'
paths-ignore:
- README.md
- CONTRIBUTING.md
pull_request:
branches:
- '**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
name: Build the package
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
with:
submodules: true
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: 24
cache: 'pnpm'
- run: pnpm install
env:
CYPRESS_INSTALL_BINARY: 0
CHROMEDRIVER_SKIP_DOWNLOAD: true
- run: pnpm build
- run: pnpm format-check
- run: pnpm test:unit
- run: pnpm snapshot
# Use artifact to share the output across different jobs
# No need to save node_modules because they are all bundled
# Note we use the atos-actions/* version to tar/untar the files
- uses: atos-actions/upload-artifact@b1b357dda9a51327e7a8007107d815c061c2f36a # v2
with:
name: build-output
path: |
bundle.js
playground
retention-days: 3
# ====================
# Verify build/lint/format scripts in playground projects
# ====================
verify-scripts:
needs: build
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [22, 24, 26]
script:
# ----- Build: non-TypeScript projects -----
- name: 'build (non-TS)'
run: pnpm --filter '!*typescript*' --workspace-concurrency 2 build
# ----- Build: TypeScript projects (sampled) -----
# Covers key tsconfig variations:
# typescript - minimal base case
# typescript-jsx - adds the vueJsx vite plugin
# typescript-*-vitest - adds tsconfig.vitest.json reference
# typescript-*-cypress - adds Cypress tsconfig files/references
# typescript-*-playwright - adds tsconfig.playwright.json
- name: 'build (TS samples)'
run: >-
pnpm --filter 'typescript'
--filter 'typescript-jsx'
--filter 'typescript-router-pinia-vitest'
--filter 'typescript-router-pinia-cypress'
--filter 'typescript-jsx-router-pinia-vitest-playwright'
--filter 'typescript-jsx-router-pinia-vitest-cypress-eslint-prettier'
build
# ----- Build: bare TypeScript projects (separate code path via trimBoilerplate) -----
- name: 'build (bare TS samples)'
run: >-
pnpm --filter 'bare-typescript'
--filter 'bare-typescript-vitest'
--filter 'bare-typescript-jsx-router-pinia-vitest-cypress'
build
# ----- Vitest -----
- name: 'test:unit (vitest)'
run: pnpm --filter '*vitest*' test:unit
# ----- ESLint -----
- name: 'lint:oxlint'
run: pnpm --filter '*eslint*' lint:oxlint --max-warnings=0 -A no-empty-file
- name: 'lint:eslint'
run: pnpm --filter '*eslint*' lint:eslint --no-fix --max-warnings=0
# ----- Prettier -----
- name: 'format (prettier)'
run: pnpm --filter '*prettier*' format
exclude:
# Node version issues are rarely platform-specific, so skip the non-active-LTS Node.js versions on Windows/macOS
- os: windows-latest
node-version: 22
- os: macos-latest
node-version: 22
- os: windows-latest
node-version: 26
- os: macos-latest
node-version: 26
runs-on: ${{ matrix.os }}
name: ${{ matrix.script.name }} (${{ matrix.os }}, node ${{ matrix.node-version }})
continue-on-error: ${{ matrix.os == 'windows-latest' }}
env:
CYPRESS_INSTALL_BINARY: 0
CHROMEDRIVER_SKIP_DOWNLOAD: true
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
with:
submodules: true
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: remove playground to avoid conflicts with downloaded artifact
run: >-
node -e "require('fs').rmSync('./playground', { recursive: true, force: true })"
- uses: atos-actions/download-artifact@c6679ede60711f0697c0f21936ee9b6292502046 # v2
with:
name: build-output
- name: Install dependencies to avoid tsconfig warnings
run: pnpm install
- name: Install dependencies in playground
working-directory: ./playground
run: |
node -e "require('fs').rmSync('pnpm-lock.yaml', { force: true })"
pnpm install --no-frozen-lockfile --ignore-scripts
- name: ${{ matrix.script.name }}
working-directory: ./playground
run: ${{ matrix.script.run }}
# ====================
# E2E tests (Cypress & Playwright)
# Runs on all platforms, but Windows/macOS only on main branch
# ====================
# Ubuntu E2E - runs on every push/PR
verify-e2e:
needs: build
strategy:
matrix:
e2e-framework: [cypress, playwright]
node-version: [24]
runs-on: ubuntu-latest
name: e2e / ${{ matrix.e2e-framework }} (ubuntu)
env:
# Sometimes the Linux runner can't verify Cypress in 30s
CYPRESS_VERIFY_TIMEOUT: 60000
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.cache/playwright-bin
CYPRESS_CACHE_FOLDER: ${{ github.workspace }}/.cache/cypress-bin
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
with:
submodules: true
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: remove playground to avoid conflicts with downloaded artifact
run: >-
node -e "require('fs').rmSync('./playground', { recursive: true, force: true })"
- uses: atos-actions/download-artifact@c6679ede60711f0697c0f21936ee9b6292502046 # v2
with:
name: build-output
- name: Install dependencies to avoid tsconfig warnings
run: pnpm install
- name: Install dependencies in playground
working-directory: ./playground
run: |
node -e "require('fs').rmSync('pnpm-lock.yaml', { force: true })"
pnpm install --no-frozen-lockfile --ignore-scripts
env:
CYPRESS_INSTALL_BINARY: 0
- name: Cache Cypress binaries
if: matrix.e2e-framework == 'cypress'
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
# TODO: avoid snowballing by adding version
key: ${{ runner.os }}-cypress-bin
path: ${{ env.CYPRESS_CACHE_FOLDER }}
- name: Cache Playwright binaries
if: matrix.e2e-framework == 'playwright'
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
# Playwright removes unused browsers automatically
# So does not need to add playwright version to key
key: ${{ runner.os }}-playwright-bin-v1
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
- name: Install Cypress
if: matrix.e2e-framework == 'cypress'
working-directory: ./playground/cypress
run: |
pnpm exec cypress cache list
pnpm exec cypress install
- name: Install Playwright
if: matrix.e2e-framework == 'playwright'
working-directory: ./playground/playwright
run: pnpm exec playwright install --with-deps
- name: Build sample projects
working-directory: ./playground
run: >-
pnpm --filter '${{ matrix.e2e-framework }}'
--filter 'typescript-${{ matrix.e2e-framework }}'
--filter 'router-${{ matrix.e2e-framework }}'
--filter 'typescript-router-pinia-${{ matrix.e2e-framework }}'
--filter 'typescript-jsx-router-pinia-vitest-${{ matrix.e2e-framework }}'
--filter 'typescript-jsx-router-pinia-vitest-${{ matrix.e2e-framework }}-eslint-prettier'
build
- name: Run E2E tests
working-directory: ./playground
run: >-
pnpm --filter '${{ matrix.e2e-framework }}'
--filter 'typescript-${{ matrix.e2e-framework }}'
--filter 'router-${{ matrix.e2e-framework }}'
--filter 'typescript-router-pinia-${{ matrix.e2e-framework }}'
--filter 'typescript-jsx-router-pinia-vitest-${{ matrix.e2e-framework }}'
--filter 'typescript-jsx-router-pinia-vitest-${{ matrix.e2e-framework }}-eslint-prettier'
--workspace-concurrency 1
test:e2e
# FIXME: Component testing is failing in CI after running too many tests.
# The workaround in https://github.com/cypress-io/cypress/issues/22208 is not working.
# But it seems not affecting real-world projects.
# - name: Cypress component testing for projects without Vitest
# working-directory: ./playground
# if: matrix.e2e-framework == 'cypress'
# run: pnpm --filter '*cypress*' --filter '!*vitest*' --workspace-concurrency 1 test:unit
# FIXME: `--with-tests` folders. It's failing now.
# Windows/macOS E2E - only runs on main branch (slow, less critical for PRs)
verify-e2e-cross-platform:
needs: build
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
strategy:
matrix:
e2e-framework: [cypress, playwright]
os: [windows-latest, macos-latest]
node-version: [24]
exclude:
# Temporarily exclude Windows + Cypress due to EPERM issues with start-server-and-test
# FIXME: move away from `start-server-and-test`
- os: windows-latest
e2e-framework: cypress
runs-on: ${{ matrix.os }}
name: e2e / ${{ matrix.e2e-framework }} (${{ matrix.os }})
continue-on-error: true
env:
CYPRESS_VERIFY_TIMEOUT: 60000
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.cache/playwright-bin
CYPRESS_CACHE_FOLDER: ${{ github.workspace }}/.cache/cypress-bin
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
with:
submodules: true
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: remove playground to avoid conflicts with downloaded artifact
run: >-
node -e "require('fs').rmSync('./playground', { recursive: true, force: true })"
- uses: atos-actions/download-artifact@c6679ede60711f0697c0f21936ee9b6292502046 # v2
with:
name: build-output
- name: Install dependencies to avoid tsconfig warnings
run: pnpm install
- name: Install dependencies in playground
working-directory: ./playground
run: |
node -e "require('fs').rmSync('pnpm-lock.yaml', { force: true })"
pnpm install --no-frozen-lockfile --ignore-scripts
env:
CYPRESS_INSTALL_BINARY: 0
- name: Cache Cypress binaries
if: matrix.e2e-framework == 'cypress'
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
# TODO: avoid snowballing by adding version
key: ${{ runner.os }}-cypress-bin
path: ${{ env.CYPRESS_CACHE_FOLDER }}
- name: Cache Playwright binaries
if: matrix.e2e-framework == 'playwright'
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
# Playwright removes unused browsers automatically
# So does not need to add playwright version to key
key: ${{ runner.os }}-playwright-bin-v1
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
- name: Install Cypress
if: matrix.e2e-framework == 'cypress'
working-directory: ./playground/cypress
run: |
pnpm exec cypress cache list
pnpm exec cypress install
- name: Install Playwright
if: matrix.e2e-framework == 'playwright'
working-directory: ./playground/playwright
run: pnpm exec playwright install --with-deps
# Minimal sample on non-Linux platforms
- name: Build sample projects
working-directory: ./playground
run: >-
pnpm --filter '${{ matrix.e2e-framework }}'
--filter 'typescript-${{ matrix.e2e-framework }}'
build
- name: Run E2E tests
working-directory: ./playground
run: >-
pnpm --filter '${{ matrix.e2e-framework }}'
--filter 'typescript-${{ matrix.e2e-framework }}'
--workspace-concurrency 1
test:e2e