Repository navigation
420 lines (343 loc) · 14.6 KB
/
Copy pathtest.yml
File metadata and controls
420 lines (343 loc) · 14.6 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
name: Tests
on:
pull_request:
push:
branches: [main]
jobs:
unit:
name: Unit Tests
runs-on: ubuntu-latest
# Healthy runs finish in ~2-3 min; bound well above that so a stall fails
# visibly instead of pending for GitHub's 6-hour default (see #1502).
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Build sdk package
working-directory: packages/sdk
run: pnpm build
- name: Build core package
working-directory: packages/core
run: pnpm build
- name: Build types package
working-directory: packages/types
run: pnpm build
# The wire-contract guards under packages/types/type-tests/ live outside src/ so they
# are never published, which also means `pnpm build` above does not check them. They are
# compile-time-only tests (the package has no test runner), so this step is the only
# thing that makes them able to fail a build.
- name: Type-check types package contracts
working-directory: packages/types
run: pnpm check-types:tests
- name: Build artifact-canvas package (+ build-smoke)
working-directory: packages/artifact-canvas
run: pnpm build && pnpm build:smoke
# t3-client first: porch-driver depends on it, and CI previously built the
# dependent without its dependency, so packages/t3-client/dist never existed
# in any job. Anything importing @cluesmith/t3-client/* at test time resolved
# to a missing ./dist/*.js.
- name: Build t3-client package
working-directory: packages/t3-client
run: pnpm build
- name: Build porch-driver package
working-directory: packages/porch-driver
run: pnpm build
- name: Run sdk unit tests
working-directory: packages/sdk
run: pnpm test
- name: Run core unit tests
working-directory: packages/core
run: pnpm test
- name: Run artifact-canvas unit tests
working-directory: packages/artifact-canvas
run: pnpm test
- name: Copy skeleton for unit tests
working-directory: packages/codev
run: pnpm copy-skeleton
# The publish-scrub guard (#214) resolves what each publishable package would actually
# ship, and `dist/`, `dashboard-dist/` and `v2-dist/` are build outputs. Without this
# step the scan over packages/codev silently narrows to the committed files and passes.
# It subsumes the copy-skeleton step above. Not free: this pulls apps/web and apps/v2
# through `codev^...` and `copy-v2`. The integration, cli and package jobs already run
# this exact command, so the cost is known rather than new.
- name: Build codev package
working-directory: packages/codev
run: pnpm build
- name: Run unit tests with coverage
working-directory: packages/codev
run: |
# Enable pipefail so a vitest failure is not masked by tee's exit code.
# (GitHub Actions' default Linux shell is `bash -e {0}` without pipefail,
# so without this line the pipeline exits with tee's status — always 0 —
# and failing tests silently pass CI.)
set -o pipefail
# Vitest forks pool has a known issue where the worker process crashes
# during cleanup after all tests pass (native module teardown).
# Capture the output and check if all test files passed.
pnpm exec vitest run --coverage 2>&1 | tee /tmp/vitest-output.txt; VITEST_EXIT=$?
# The tolerance decision lives in a script so it can be tested against
# real captured output instead of only in CI (#27). The previous inline
# guard greped the bare word `failed` across the whole log, which matched
# test names (`reentry-failed`, `clear-failed`) and `git fetch ... failed`
# warnings — five times in a fully GREEN run — so it could never fire.
"$GITHUB_WORKSPACE/scripts/vitest-crash-tolerance.sh" /tmp/vitest-output.txt "$VITEST_EXIT"
- name: Run web unit tests
working-directory: apps/web
run: pnpm test
- name: Run v2 unit tests
working-directory: apps/v2
run: pnpm test
# Spec 146 phase 11. The client's own suite carries the fidelity checks and
# the CSP/raw-HTML guard, and none of it ran anywhere before this step: the
# root `pnpm test` filters to @cluesmith/codev, so 90 tests existed and CI
# never saw one. That is this PR's own thesis — code nothing reaches passes
# its tests — reproduced at the repo level.
- name: Run client unit tests
working-directory: apps/client
run: pnpm test
- name: Type-check the client
working-directory: apps/client
run: pnpm check-types
# The two-machine e2e harness imports AgentRouteContext and the approval
# stores. Nothing else type-checks it, so a change to either would rot the
# harness silently and the criteria it proves would stop being provable.
- name: Type-check the codev-agent host
working-directory: tools/codev-agent-host
run: pnpm check-types
canvas-browser:
name: Artifact-Canvas Browser Tests
runs-on: ubuntu-latest
# Backstop for #1502. The stall's root cause is removed below (see the install
# step), but every job stays bounded regardless: an unbounded job conceals its
# own failure, which is #1502's real lesson. Healthy runs finish in ~4 min.
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
# Root cause of #1502: `--with-deps` runs `apt-get update` to install Chromium's
# system libraries, and that apt index fetch intermittently stalls indefinitely
# (the fast azure.archive.ubuntu.com mirror is Ign-ored, and apt has no network
# timeout on the fallback to archive.ubuntu.com). Those libraries are already
# present on the ubuntu-latest image: the sibling dashboard-e2e workflow installs
# Chromium the same way without `--with-deps` and launches it successfully on
# every scheduled run. Dropping the flag removes the stalling apt phase entirely.
- name: Install Playwright Chromium
working-directory: packages/artifact-canvas
run: pnpm exec playwright install chromium
# Real-browser fragmentation regression suite (spec 1380): jsdom cannot express CSS
# multi-column fragmentation, so the spike-derived invariants run against Chromium here.
- name: Run artifact-canvas browser tests
working-directory: packages/artifact-canvas
run: pnpm test:browser
integration:
name: Tower Integration Tests
runs-on: ubuntu-latest
# Healthy runs finish in ~2 min; bound above that so a stall fails visibly (#1502).
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Build sdk package
working-directory: packages/sdk
run: pnpm build
- name: Build core package
working-directory: packages/core
run: pnpm build
- name: Build package
working-directory: packages/codev
run: pnpm build
- name: Run tower integration tests
working-directory: packages/codev
run: pnpm exec vitest run --config vitest.e2e.config.ts --exclude 'src/commands/porch/__tests__/e2e/**'
cli:
name: CLI Integration Tests
runs-on: ubuntu-latest
# Healthy runs finish in ~1 min; bound above that so a stall fails visibly (#1502).
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Build sdk package
working-directory: packages/sdk
run: pnpm build
- name: Build core package
working-directory: packages/core
run: pnpm build
- name: Build package
working-directory: packages/codev
run: pnpm build
- name: Run CLI integration tests
working-directory: packages/codev
run: pnpm exec vitest run --config vitest.cli.config.ts
package:
name: Package Install Verification
runs-on: ubuntu-latest
# Healthy runs finish in ~2 min; bound above that so a stall fails visibly (#1502).
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Build sdk package
working-directory: packages/sdk
run: pnpm build
- name: Build core package
working-directory: packages/core
run: pnpm build
# codev-types is a runtime dependency of codev (server-utils imports its
# wire constants at module load), so the install-verification install must
# include its tarball too — else `afx --help` crashes at boot with
# "Cannot find module '@cluesmith/codev-types'".
- name: Build types package
working-directory: packages/types
run: pnpm build
- name: Build t3-client package
working-directory: packages/t3-client
run: pnpm build
- name: Build porch-driver package
working-directory: packages/porch-driver
run: pnpm build
- name: Build package
working-directory: packages/codev
run: pnpm build
- name: Pack core tarball
working-directory: packages/core
run: pnpm pack
- name: Pack sdk tarball
working-directory: packages/sdk
run: pnpm pack
- name: Pack types tarball
working-directory: packages/types
run: pnpm pack
- name: Pack t3-client tarball
working-directory: packages/t3-client
run: pnpm pack
- name: Pack porch-driver tarball
working-directory: packages/porch-driver
run: pnpm pack
- name: Pack tarball
working-directory: packages/codev
run: pnpm pack
- name: Verify install from tarball
working-directory: packages/codev
run: node scripts/verify-install.mjs cluesmith-codev-*.tgz ../core/cluesmith-codev-core-*.tgz ../sdk/cluesmith-codev-sdk-*.tgz ../types/cluesmith-codev-types-*.tgz ../t3-client/cluesmith-t3-client-*.tgz ../porch-driver/cluesmith-porch-driver-*.tgz
v2-playwright:
name: v2 Playwright
runs-on: ubuntu-latest
# Same fixture as local `pnpm test:e2e` (127.0.0.1:4173). No Tower.
# Healthy runs finish in a few minutes; bound so a stall fails (#1502).
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Build types package
working-directory: packages/types
run: pnpm build
- name: Install Playwright Chromium
working-directory: apps/v2
run: pnpm exec playwright install chromium
- name: Run v2 Playwright tests
working-directory: apps/v2
run: pnpm test:e2e
client-playwright:
name: client Playwright (two live servers)
runs-on: ubuntu-latest
# Spec 146 criteria 7, 8, 9b and 15 cannot be met against one server, and a
# single-server approximation of "one machine stopped" is not evidence. This
# job starts two real codev-agent hosts, kills one, and revokes another's
# credential. Bound so a stall fails rather than hangs (#1502).
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
# THE DEPENDENCY CLOSURE, NOT A LIST OF PACKAGES.
#
# `tools/codev-agent-host` runs `packages/codev` FROM SOURCE through tsx,
# so anything that source imports from a sibling workspace package must
# have a built `dist`. A fresh checkout has none, and the first version of
# this job built only `packages/types` — which passed locally six times,
# because a developer's worktree already carries the outputs of an earlier
# full build. It failed here on the first CI run.
#
# The missing packages were `codev-sdk` and `codev-core`, reached through
# `agent-farm/lib/tower-client.ts`. Naming those three would work today and
# would drift silently the moment `packages/codev` imports a fourth — the
# same hand-kept-list failure this PR keeps finding. `^...` is derived from
# the workspace graph instead, and costs 6s measured.
- name: Build the packages codev imports
run: pnpm --filter "@cluesmith/codev^..." build
# porch commits every state write, so the fixture's workspaces are real git
# repositories. Without an identity the commit fails and the approval
# criterion cannot run.
- name: Configure git identity for the fixture workspaces
run: |
git config --global user.email "ci@example.invalid"
git config --global user.name "codev ci"
- name: Install Playwright Chromium
working-directory: apps/client
run: pnpm exec playwright install chromium
- name: Run client Playwright tests
working-directory: apps/client
run: pnpm test:e2e