-
Notifications
You must be signed in to change notification settings - Fork 29
438 lines (369 loc) · 12 KB
/
ci.yml
File metadata and controls
438 lines (369 loc) · 12 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
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
name: CI
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.event.pull_request.number ||
github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
env:
CI: true
FORCE_COLOR: "1"
jobs:
quality:
name: Quality
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup pnpm
uses: pnpm/action-setup@v6
with:
version: 10.27.0
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run workspace checks
run: pnpm check
- name: Run Knip
run: pnpm exec turbo run knip:ci
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup pnpm
uses: pnpm/action-setup@v6
with:
version: 10.27.0
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build workspace
run: pnpm exec turbo run build --filter='./packages/*'
unit:
name: Unit Tests
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup pnpm
uses: pnpm/action-setup@v6
with:
version: 10.27.0
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run unit tests
run: pnpm exec turbo run test:unit
bench-regression:
name: Bench Regression
runs-on: ubuntu-latest
timeout-minutes: 15
# Microbenchmarks are inherently noisy; keep this job non-blocking so a
# spurious regression on a shared runner never blocks a PR. Real
# regressions still surface in the workflow summary and the job log.
continue-on-error: true
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup pnpm
uses: pnpm/action-setup@v6
with:
version: 10.27.0
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run schema micro-benchmarks and compare against baseline
run: pnpm test:bench:schema:check
- name: Upload current bench report
if: always()
uses: actions/upload-artifact@v7
with:
name: schema-bench-report
path: tests/bench/schema/current.json
if-no-files-found: warn
retention-days: 7
integration:
name: Integration Tests
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup pnpm
uses: pnpm/action-setup@v6
with:
version: 10.27.0
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run integration tests
run: pnpm exec turbo run test:integration
windows-smoke:
name: Windows Smoke
runs-on: windows-latest
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup pnpm
uses: pnpm/action-setup@v6
with:
version: 10.27.0
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run Windows-focused unit tests
run: >
pnpm exec vitest run --config vitest.config.ts
tests/unit/core/generate.test.ts tests/unit/core/orchestrator.test.ts
tests/unit/cli/commands/generate.test.ts
tests/unit/cli/commands/init.test.ts
tests/unit/init/create-docs-page.test.ts tests/unit/public/cli.test.ts
tests/unit/workspace/generate-scripts.test.ts
tests/unit/schema/zod/zod-converter-drizzle.test.ts
- name: Run one Windows generate path
run: pnpm exec turbo run generate --filter=next-pages-router
coverage:
name: Coverage
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup pnpm
uses: pnpm/action-setup@v6
with:
version: 10.27.0
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run coverage
env:
FORCE_COLOR: "0"
run: |
set -o pipefail
pnpm test:coverage 2>&1 | tee coverage-output.txt
- name: Write coverage summary
if: always()
run: |
node <<'NODE'
const fs = require("node:fs");
const summaryPath = process.env.GITHUB_STEP_SUMMARY;
const coverageOutputPath = "coverage-output.txt";
let markdown = "## Coverage\n\n";
if (!fs.existsSync(coverageOutputPath)) {
markdown += "Coverage output was not generated.\n";
fs.appendFileSync(summaryPath, markdown);
process.exit(0);
}
const output = fs.readFileSync(coverageOutputPath, "utf8");
const row = output
.split(/\r?\n/)
.map((line) => line.replace(/\u001b\[[0-9;]*m/g, "").trim())
.reverse()
.find((line) => /^All files\s*\|/.test(line));
if (!row) {
markdown += "Coverage command completed, but the aggregate coverage row could not be parsed from `coverage-output.txt`.\n";
fs.appendFileSync(summaryPath, markdown);
process.exit(0);
}
const columns = row.split("|").map((value) => value.trim()).filter(Boolean);
const [, statements = "n/a", branches = "n/a", functions = "n/a", lines = "n/a"] = columns;
markdown += "| Statements | Branches | Functions | Lines |\n";
markdown += "| --- | --- | --- | --- |\n";
markdown += `| ${statements} | ${branches} | ${functions} | ${lines} |\n`;
fs.appendFileSync(summaryPath, markdown);
NODE
- name: Upload coverage artifact
if: always()
uses: actions/upload-artifact@v7
with:
name: coverage
path: |
coverage/**
coverage-output.txt
if-no-files-found: warn
retention-days: 7
e2e:
name: E2E (${{ matrix.app }})
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
app:
- next-app-zod
- next-app-typescript
- next-app-scalar
- next-app-swagger
- next-app-sandbox
- next-app-drizzle-zod
- next-pages-router
- next-app-mixed-schemas
- tanstack-app
- react-router-app
- next-app-adapter
- next-app-next-config
- next-app-ts-config
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup pnpm
uses: pnpm/action-setup@v6
with:
version: 10.27.0
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Restore Playwright browser cache
uses: actions/cache@v5
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-chromium-${{ hashFiles('pnpm-lock.yaml',
'playwright.config.ts') }}
restore-keys: |
${{ runner.os }}-playwright-chromium-
- name: Install Playwright Chromium
run: pnpm exec playwright install --with-deps chromium
- name: Run E2E tests
env:
E2E_APP: ${{ matrix.app }}
run: pnpm test:e2e:app
- name: Upload Playwright report
if: failure()
uses: actions/upload-artifact@v7
with:
name: playwright-report-${{ matrix.app }}
path: |
playwright-report/**
test-results/**
if-no-files-found: ignore
retention-days: 7
report:
name: CI Summary
if: always()
runs-on: ubuntu-latest
needs:
- quality
- build
- unit
- integration
- windows-smoke
- bench-regression
- coverage
- e2e
steps:
- name: Write workflow summary
env:
QUALITY_RESULT: ${{ needs.quality.result }}
BUILD_RESULT: ${{ needs.build.result }}
UNIT_RESULT: ${{ needs.unit.result }}
INTEGRATION_RESULT: ${{ needs.integration.result }}
WINDOWS_SMOKE_RESULT: ${{ needs.windows-smoke.result }}
BENCH_REGRESSION_RESULT: ${{ needs.bench-regression.result }}
COVERAGE_RESULT: ${{ needs.coverage.result }}
E2E_RESULT: ${{ needs.e2e.result }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{
github.run_id }}
run: |
node <<'NODE'
const fs = require("node:fs");
const jobs = [
["Quality", process.env.QUALITY_RESULT],
["Build", process.env.BUILD_RESULT],
["Unit Tests", process.env.UNIT_RESULT],
["Integration Tests", process.env.INTEGRATION_RESULT],
["Windows Smoke", process.env.WINDOWS_SMOKE_RESULT],
["Bench Regression", process.env.BENCH_REGRESSION_RESULT],
["Coverage", process.env.COVERAGE_RESULT],
["E2E Matrix", process.env.E2E_RESULT],
];
const iconByResult = {
success: "SUCCESS",
failure: "FAILURE",
cancelled: "CANCELLED",
skipped: "SKIPPED",
};
const failed = jobs.filter(([, result]) => result !== "success");
let markdown = "## CI Summary\n\n";
markdown += "| Check | Result |\n";
markdown += "| --- | --- |\n";
for (const [name, result] of jobs) {
const label = iconByResult[result] ?? result ?? "unknown";
markdown += `| ${name} | ${label} |\n`;
}
markdown += "\n";
if (failed.length === 0) {
markdown += "All CI jobs passed.\n";
} else {
markdown += "Failed or incomplete checks:\n";
for (const [name, result] of failed) {
markdown += `- ${name}: ${result}\n`;
}
}
markdown += "\nArtifacts for coverage and failed Playwright runs are available from this workflow run.\n";
markdown += `Run details: ${process.env.RUN_URL}\n`;
fs.appendFileSync(process.env.GITHUB_STEP_SUMMARY, markdown);
NODE