Repository navigation
597 lines (545 loc) · 30.1 KB
/
Copy pathci.yml
File metadata and controls
597 lines (545 loc) · 30.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
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
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
# Workspace-wide CI: the always-on repo guards (`metadata`) and every pnpm
# member's frontend (`frontend`: lint, typecheck, codegen, test, build), plus the
# conformance rig. Each app's contract (build, tests, scenarios, browser suites)
# is components.yml.
#
# On a pull request the frontend job covers only the members a change reaches
# (scripts/ci-scope.py), and a change to the workspace root, a JS pin or this
# pipeline covers every one. A push to main and a dispatch cover everything.
name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
inputs:
all:
# Re-verify the whole fleet on demand — e.g. after an SDK bump whose own
# run was cancelled (see concurrency below). A dispatch otherwise has
# no diff to scope from.
description: Run every app, not only what changed
type: boolean
default: true
concurrency:
group: ci-${{ github.ref }}
# Supersede stale runs on a PR branch only. On main every merge must finish:
# cancelling there meant two merges seconds apart discarded the first one's
# run — which is how the rc.45 SDK bump (#215) landed without its fleet-wide
# run ever completing, hidden under the next merge's app-scoped run.
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
jobs:
# ── what changed ───────────────────────────────────────────────────────────
changes:
name: Detect changes
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
# pnpm workspace dirs the frontend job lints/typechecks/tests/builds, or
# ["*"] for all of them.
frontend_dirs: ${{ steps.set.outputs.frontend_dirs }}
# `shared` and `js_deps` are the EFFECTIVE verdicts, not the raw path
# filters: a lockfile that changed only for the app being touched does not
# make this a workspace-level change. See the `locks` step below.
shared: ${{ (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.all)) && 'true' || steps.locks.outputs.shared }}
tooling: ${{ steps.filter.outputs.tooling }}
js_deps: ${{ steps.locks.outputs.js_deps }}
# The raw `conformance` filter, not narrowed by the `locks` step: any
# lockfile move can change the mero-js/mero-react the rig runs. A push to
# main and a manual "run every app" dispatch run it too.
conformance: ${{ (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.all)) && 'true' || steps.filter.outputs.conformance }}
steps:
# Full history: deciding whether a lockfile change reaches other apps
# means reading the lockfile as it was BEFORE this change.
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: dorny/paths-filter@v3
id: filter
with:
# `list-files: shell` so the per-app mapping below reads real paths
# instead of re-deriving them from a boolean.
list-files: shell
filters: |
# A workspace-level change is one that can change a CONTRACT's
# bytes, which is what justifies fanning out to every app.
#
# It used to include `.github/**`, `scripts/**` and the JS
# workspace files, so editing a COMMENT in this very file triggered
# the most expensive path in the pipeline. Those still need to run
# something — they just do not change any wasm — so they are their
# own filters below.
#
# The manifest and the lockfile are separate because they answer
# differently: editing the workspace manifest is always everyone's
# business, while `Cargo.lock` is also rewritten just by adding or
# renaming an app. The `locks` step tells those two cases apart.
#
# Add 'crates/**' to `workspace_manifest` when that dir is created.
workspace_manifest:
- 'Cargo.toml'
cargo_lock:
- 'Cargo.lock'
# The pipeline itself changed, so the pipeline has to be exercised.
#
# NOT `.github/**` and NOT `scripts/**`. release.yml and
# publish-bundle.yml drive nothing here, and the `check-*.py` guards
# and their tests run ONLY in the `metadata` job, which always runs.
# Listing them here meant a mero-design PR that moved a guard's
# baseline (#204) rebuilt and browser-tested all 17 apps.
tooling:
- '.github/workflows/ci.yml'
- '.github/actions/**'
- 'scripts/ci-scope.py'
- 'scripts/lockfile-fanout.py'
# Runs only in the frontend job, over every app's build output.
frontend_tooling:
- 'scripts/check-vercel-output.sh'
- 'scripts/check-service-workers.py'
- 'scripts/check-node-shield-gate.py'
# The generator every app's `codegen` runs, at its pinned release.
- 'scripts/install-meroctl.sh'
# JS-only: a catalog bump or a tsconfig change cannot alter a
# contract.
#
# Same split as above. The catalog and the shared tsconfig are
# everyone's; `pnpm-lock.yaml` is per-importer, so adding an app
# rewrites it without changing what any other app resolves.
js_config:
- 'tsconfig.base.json'
- 'package.json'
# The catalog SOURCE. Split out of `js_config` because it answers
# differently for the same reason the lockfiles do: an arriving app
# only ADDS catalog entries for dependencies no one else has, which
# cannot change what another app resolves. The `locks` step tells
# that apart from an existing pin actually moving.
pnpm_workspace:
- 'pnpm-workspace.yaml'
pnpm_lock:
- 'pnpm-lock.yaml'
# Everything that can reach an app. scripts/ci-scope.py decides
# WHICH apps: a README or a dev script beside an app reaches none,
# and a shared package reaches every app that imports it.
app:
- 'apps/**'
- 'packages/**'
# The conformance rig (conformance.yml). Not an app ci-scope.py maps:
# it has no contract of its own, and what it checks is what a shared
# package or a JS dependency bump can break for EVERY app — the
# admin and RPC calls mero-react makes, on a node and on an account.
conformance:
- 'apps/conformance/**'
- 'packages/**'
- 'pnpm-workspace.yaml'
- 'pnpm-lock.yaml'
- '.github/workflows/conformance.yml'
# DID THE LOCKFILES CHANGE FOR ANYONE ELSE?
#
# `Cargo.lock` and `pnpm-lock.yaml` are rewritten whenever an app is
# added, renamed or removed, and both used to be plain booleans that
# fanned out to every app. So every migration PR paid for the full WASM +
# browser matrix to prove that nine untouched apps still built.
#
# scripts/lockfile-fanout.py answers the narrower question the fan-out
# actually needs — see its docstring for the rules, and
# scripts/tests/lockfile-fanout-test.py for both branches pinned.
- name: Decide whether the lockfile changes reach other apps
id: locks
env:
MANIFEST: ${{ steps.filter.outputs.workspace_manifest }}
CARGO_LOCK: ${{ steps.filter.outputs.cargo_lock }}
JS_CONFIG: ${{ steps.filter.outputs.js_config }}
PNPM_WORKSPACE: ${{ steps.filter.outputs.pnpm_workspace }}
PNPM_LOCK: ${{ steps.filter.outputs.pnpm_lock }}
# For a PR this is the base of the merge; for a push, the previous
# tip. Empty or all-zeroes (a brand-new branch) makes the script
# answer `all`, which is the safe direction.
BASE: ${{ github.event.pull_request.base.sha || github.event.before }}
run: |
set -uo pipefail
# The shared JS config is everyone's business on its own; the
# manifest and the lockfiles only sometimes are.
shared=false
js_deps="$JS_CONFIG"
extra_paths=""
# Note the explicit failure branch on every probe below. With `set
# -e` a crash would kill the job; WITHOUT it, an unchecked `$(...)`
# leaves `verdict` empty, which reads as "no fan-out" and SKIPS apps
# — the one direction that fails silently. So a failure is forced to
# mean `all`.
# Porting an app to the component SDK appends its crate to
# `[workspace].exclude` and nothing else here; that cannot change
# another member's bytes, so it must not cost the full matrix.
if [ "$MANIFEST" = "true" ]; then
if ! verdict=$(python3 scripts/lockfile-fanout.py manifest --base "$BASE" --head HEAD); then
verdict=all
echo "::warning::lockfile-fanout.py failed on Cargo.toml — covering every app"
fi
if [ "$verdict" = "all" ]; then
shared=true
echo "::notice::Cargo.toml changed the workspace — covering every app"
else
echo "::notice::Cargo.toml only changed [workspace].exclude or the component pins — no fan-out"
fi
fi
if [ "$CARGO_LOCK" = "true" ] && [ "$shared" != "true" ]; then
if ! verdict=$(python3 scripts/lockfile-fanout.py cargo --base "$BASE" --head HEAD); then
verdict=all
echo "::warning::lockfile-fanout.py failed on Cargo.lock — covering every app"
fi
if [ "$verdict" = "all" ]; then
shared=true
echo "::notice::Cargo.lock moved a dependency — covering every app"
else
echo "::notice::Cargo.lock changed only for the apps in this PR"
fi
fi
if [ "$PNPM_WORKSPACE" = "true" ] && [ "$js_deps" != "true" ]; then
if ! verdict=$(python3 scripts/lockfile-fanout.py catalog --base "$BASE" --head HEAD); then
verdict=all
echo "::warning::lockfile-fanout.py failed on pnpm-workspace.yaml — covering every app"
fi
if [ "$verdict" = "all" ]; then
js_deps=true
echo "::notice::pnpm-workspace.yaml moved an existing catalog pin — covering every app"
else
echo "::notice::pnpm-workspace.yaml only added catalog entries — no fan-out"
fi
fi
if [ "$PNPM_LOCK" = "true" ] && [ "$js_deps" != "true" ]; then
if ! verdict=$(python3 scripts/lockfile-fanout.py pnpm --base "$BASE" --head HEAD); then
verdict=all
echo "::warning::lockfile-fanout.py failed on pnpm-lock.yaml — covering every app"
fi
if [ "$verdict" = "all" ]; then
js_deps=true
echo "::notice::pnpm-lock.yaml changed shared resolution — covering every app"
elif [ -n "$verdict" ]; then
# Importer paths, which map to apps exactly like source paths do.
extra_paths="$verdict"
echo "::notice::pnpm importers changed: $(echo "$verdict" | tr '\n' ' ')"
fi
fi
echo "shared=$shared" >> "$GITHUB_OUTPUT"
echo "js_deps=$js_deps" >> "$GITHUB_OUTPUT"
{
echo "extra_paths<<__EOF__"
echo "$extra_paths"
echo "__EOF__"
} >> "$GITHUB_OUTPUT"
# WHICH FRONTENDS, not "are there any": scripts/ci-scope.py maps the
# changed files to the pnpm members they reach (a shared package reaches
# every member importing it). A workspace-level change still means all.
- name: Resolve the frontend scope
id: set
env:
# A push to main and a manual "run every app" dispatch count as a
# workspace-level change: only a pull request is scoped.
SHARED: ${{ (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.all)) && 'true' || steps.locks.outputs.shared }}
TOOLING: ${{ steps.filter.outputs.tooling }}
FRONTEND_TOOLING: ${{ steps.filter.outputs.frontend_tooling }}
JS_DEPS: ${{ steps.locks.outputs.js_deps }}
APP_FILES: ${{ steps.filter.outputs.app_files }}
EXTRA_PATHS: ${{ steps.locks.outputs.extra_paths }}
run: |
set -euo pipefail
# pnpm importers arrive as bare dirs (`apps/x/app`); give them a file
# so they map the way a changed source file does.
importers=$(printf '%s\n' "$EXTRA_PATHS" | sed '/^$/d; s|$|/package.json|')
if ! scope=$(printf '%s\n%s\n' "$APP_FILES" "$importers" | python3 scripts/ci-scope.py); then
echo "::warning::ci-scope.py failed — covering every app"
SHARED=true
scope='{"app_paths":[],"frontend_dirs":[]}'
fi
echo "scope: $scope"
if [ "$SHARED" = "true" ] || [ "$TOOLING" = "true" ] || [ "$JS_DEPS" = "true" ] || [ "$FRONTEND_TOOLING" = "true" ]; then
frontend_dirs='["*"]'
else
frontend_dirs=$(jq -c '.frontend_dirs' <<<"$scope")
fi
echo "frontend_dirs=$frontend_dirs" >> "$GITHUB_OUTPUT"
echo "::notice::frontend dirs: $frontend_dirs"
# ── workspace-wide, cheap, always ──────────────────────────────────────────
metadata:
name: App metadata
needs: changes
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
# Full history: check-live-frontends.py asks whether a live origin serves
# a title this repo has EVER built for that app, which it answers from
# `git log --follow` over each index.html. A depth-1 checkout makes that
# lookup blind, and the check then falls back to comparing production
# against an undeployed working tree — the exact false positive it was
# changed to stop.
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: bash scripts/check-app-metadata.sh
# Two dependency PRs merged back to back red EVERY app: git line-merges
# pnpm-lock.yaml into a hybrid with a duplicated mapping key, pnpm refuses
# the whole file, and every job dies at install. The key is in NEITHER
# branch — git makes it. Cheap to check, and the message names the cause.
- name: Assert pnpm-lock.yaml is not a merged hybrid
run: python3 scripts/check-lockfile.py
# `icon` is the one field check-app-metadata.sh never looked at, and every
# way it can be wrong is silent: the bundle publishes, this job is green,
# and the only symptom is the wrong picture in the registry and in the
# desktop launcher. Two apps shipped cargo-mero's shared placeholder for
# months that way.
- name: Assert every app's icon is real and safe to mask
run: python3 scripts/check-app-icons.py
# Every core request struct is `deny_unknown_fields`, so an extra body key
# is a 400 that kills the whole call — not a field the node ignores. Two
# of them were live against rc.34: `alias` on namespace/context create
# (core replaced the group alias with a metadata record in #2338) and
# `executorPublicKey` on the JSON-RPC envelope (dropped in #2116). Nothing
# here could catch either — the vitest wire tests assert the keys that
# should be present and never that nothing else is, the Playwright suites
# `page.route` the node so no deserializer ever sees the body. This reads the bodies out of the source and compares them to core's
# schema, which is the only check in this file that does.
- name: Assert no app sends a body key the node refuses
run: python3 scripts/check-admin-wire.py
# The checker's own tests. Its first version matched routes as LITERAL
# strings, so every `` `/namespaces/${id}/groups` `` call site was
# invisible to it and four apps sent `groupAlias` there under a green
# check. A guard that silently stops covering a shape is worse than no
# guard, because it also carries the claim that the shape is covered.
- name: Assert the wire checker still catches what it claims to
run: python3 scripts/tests/admin-wire-test.py
# Since core#4890 each app has its own team in an organization, and what
# invite, remove and leave mean depends on the org's mode: in an org
# that keeps its apps apart, an invite that does not name the app's
# team opens every app to the person, with nothing thrown. Those rules
# live in one module (`packages/connect/src/orgApp.ts`); this fails when
# an org app calls `createOrg`, `scopeApps`, `invite` or `removeMember`
# itself. Unconverted apps sit on an exemption list that only shrinks.
- name: Assert no two source modules differ only by case
run: python3 scripts/check-case-collisions.py
- name: Assert org apps reach their organization through the shared module
run: python3 scripts/check-org-app-module.py
- name: Assert the org-app module check still catches what it claims to
run: python3 scripts/tests/org-app-module-test.py
# Staging's clusters run debug node images, whose memory the operator can
# read. A served web page trusts them only on staging's own hostname
# (packages/connect); a native app has no such hostname, so only a
# staging build (BuildConfig.MERO_STAGING, `#if MERO_STAGING`) may, and a
# store build never. This fails when an app's code says otherwise.
- name: Assert no mobile store build trusts staging
run: python3 scripts/check-mobile-staging.py
- name: Assert the mobile staging check still catches what it claims to
run: python3 scripts/tests/mobile-staging-test.py
- name: Assert the node shield gate check still catches what it claims to
run: python3 scripts/tests/node-shield-gate-test.py
# `battleships.vercel.app` served a create-react-app build for an unknown
# length of time after the app moved to Vite in this repo. The repo was
# fine and every existing check passed; the Vercel project simply never
# deployed from here. That URL is what the registry publishes as
# links.frontend, so it is what the desktop launcher opens, what invite
# links resolve to, and what authorizes a login callback — a stale
# deployment silently becomes the app. An unreachable host reports as
# skipped, not as a failure: a check that reds the build when a third
# party is down gets switched off, and then it catches nothing.
- name: Assert each live deployment is the app this repo builds
run: python3 scripts/check-live-frontends.py
- name: Assert the live-frontend history survives an app rename
run: python3 scripts/tests/live-frontends-history-test.py
- name: Assert the publish script uploads straight to storage
run: bash scripts/publish-bundle.test.sh
# Release skips a component whose manifest equals the registry's latest.
# Wrong one way and a change nodes act on (outbound, frontendAliases,
# upgrades, the guide) silently never ships; wrong the other and every
# dispatch adds a duplicate version to the registry's Redis.
- name: Assert Release skips only a component nothing changed in
run: python3 scripts/tests/registry-unchanged-test.py
# The frontend packed into a bundle is built with the lowest release the
# cluster runs: too high and it refuses every node of a half-rolled-out
# cluster, so the derivation is tested against fixture responses.
- name: Assert the derived attestation floor is the cluster's lowest release
run: python3 scripts/tests/cluster-min-release-test.py
# The vitest copy-lint suite only scans string literals and JSX text in a
# handful of files, so an em dash in a comment, a test name or a Rust doc
# comment slips past review every time. This scans
# every tracked file under apps/mero-docs instead. The landing page is a
# generated copy of scripts/landing/template, so it is fixed there.
- name: Assert no em dash in apps/mero-docs
run: |
! git grep -nI $'\u2014' -- apps/mero-docs ':!apps/mero-docs/app/src/pages/landing' ':!apps/mero-docs/app/src/generated'
# The matrix resolver decides what the rest of this file runs, and both of
# its wrong answers are silent — too broad only costs money, too narrow
# skips an app with nothing to notice. So its rules are tested.
- name: Test the lockfile fan-out rules
run: python3 scripts/tests/lockfile-fanout-test.py
# The per-app scope, for this file's frontend job and components.yml's
# per-job matrices. Wrong in either direction and nothing fails: too
# broad costs the whole matrix, too narrow skips an app silently.
- name: Assert the app scope picks the apps a change reaches, and only those
run: python3 scripts/tests/ci-scope-test.py
# Vercel's ignore step reuses that scope. Too narrow and a changed app
# never deploys; too broad and every push rebuilds every Vercel project.
- name: Assert Vercel skips only the apps a change does not reach
run: python3 scripts/tests/vercel-ignore-build-test.py
# Its fixtures are real builds: mero-chat's worker before and after it
# stopped precaching its page, and hyperfeed's push-only worker.
- name: Assert the service-worker check still catches a precached page
run: python3 scripts/tests/service-workers-test.py
# A consumer job cannot run where its artifact's producer is gated off —
# GitHub skips a job whose `needs:` was skipped, whatever its own `if:`
# says. That failure is silent, so components.yml's rust -> e2e link is
# asserted here.
- name: Assert artifact producers are not gated more narrowly than consumers
run: python3 scripts/tests/producer-gate-test.py
# A filter that stops matching skips the rig with nothing to notice.
- name: Assert the conformance rig is gated on the paths it depends on
run: python3 scripts/tests/conformance-gate-test.py
# A lockfile inside a workspace member installs nothing (pnpm resolves
# from the root) but Dependabot scans it, so it generates security alerts
# forever. Two of them accounted for 176 of 182 open alerts, including all
# four criticals.
- name: Assert no lockfile lives inside a workspace member
run: python3 scripts/tests/no-nested-lockfiles-test.py
- name: Assert frontend-dir is read from the TOML, not grepped
run: python3 scripts/tests/frontend-dir-test.py
frontend:
name: Frontend (typecheck, test, build)
needs: changes
if: needs.changes.outputs.frontend_dirs != '[]'
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- run: pnpm install --frozen-lockfile
# Only the workspace members this change reaches (`["*"]` = all). It was
# `pnpm -r` over every app on every PR — a mero-chat fix typechecked,
# tested and built all 17 frontends.
- name: Scope the workspace to this change
env:
DIRS: ${{ needs.changes.outputs.frontend_dirs }}
run: |
set -euo pipefail
if [ "$(jq -r '.[0]' <<<"$DIRS")" = "*" ]; then
filter=""
apps=""
# Every app's vitest at once (pnpm runs 4, each using every core)
# starves the runner, and the suites' waits time out at random:
# one suite at a time when the whole workspace is in scope.
echo "PNPM_TEST_CONCURRENCY=--workspace-concurrency=1" >> "$GITHUB_ENV"
else
filter=$(jq -r '.[] | "--filter ./" + .' <<<"$DIRS" | tr '\n' ' ')
# Only app frontends (`apps/<a>/app`): shared packages are
# members too, but nothing Vercel serves.
apps=$(jq -r '.[] | select(startswith("apps/") and endswith("/app"))' <<<"$DIRS" | tr '\n' ' ')
fi
echo "PNPM_FILTER=$filter" >> "$GITHUB_ENV"
echo "VERCEL_APPS=$apps" >> "$GITHUB_ENV"
# The app checks below run over every app when VERCEL_APPS is empty,
# so skip them when the change built no app (only a package).
if [ -z "$filter" ] || [ -n "$apps" ]; then
echo "CHECK_APPS=true" >> "$GITHUB_ENV"
fi
echo "scope: ${filter:-every workspace member}"
# Every app's `eslint .` (components.yml ran it in a per-app job that also
# repeated this job's typecheck, test and build). `--if-present`: not
# every member has a lint script.
- run: pnpm -r $PNPM_FILTER --if-present run lint
# `tsc -b`, never `tsc --noEmit`: the app tsconfig is a solution file, and
# --noEmit on a solution file checks nothing and exits 0.
- run: pnpm -r $PNPM_FILTER typecheck
# A component app's `codegen` is core's `meroctl app codegen` (its typed
# client from the committed ABI), at the release scripts/install-meroctl.sh
# pins. Cached by that script's hash, so a run that does not move the pin
# does not download it.
- uses: actions/cache@v4
with:
path: ${{ runner.temp }}/meroctl
key: meroctl-${{ runner.os }}-${{ hashFiles('scripts/install-meroctl.sh') }}
- name: Install meroctl
env:
MEROCTL_ROOT: ${{ runner.temp }}/meroctl
run: |
scripts/install-meroctl.sh
echo "$MEROCTL_ROOT/bin" >> "$GITHUB_PATH"
# Regenerating and diffing is what turns a contract/frontend mismatch into
# a failed build rather than a runtime 500. It needs no node and no wasm —
# it reads the committed ABI, which components.yml's `rust` job proves
# is current.
- name: Assert the generated clients are current
run: |
# `--if-present`: only an app that calls its contract through a
# generated client has the script, and pnpm refuses a filtered run in
# which no selected package has it.
pnpm -r $PNPM_FILTER --if-present run codegen
# Same reason as the ABI gate: untracked generated output is invisible
# to `git diff`, so a new app could pass with no client committed.
git add --intent-to-add -- 'apps/*/app/src/generated' 2>/dev/null || true
if ! git diff --quiet -- 'apps/*/app/src/generated'; then
echo "::error::a generated client is stale. Run 'scripts/install-meroctl.sh', then 'pnpm -r codegen', and commit."
git --no-pager diff -- 'apps/*/app/src/generated'
exit 1
fi
echo "generated clients match the committed ABIs"
- run: pnpm -r $PNPM_TEST_CONCURRENCY $PNPM_FILTER test
- run: pnpm -r $PNPM_FILTER build
- run: pnpm -r $PNPM_FILTER --if-present run check:bundle
- run: pnpm -r $PNPM_FILTER --if-present run format:check
# `pnpm -r build` succeeding does not mean Vercel will serve anything: it
# uploads whatever `outputDirectory` names, and an empty or wrong path is
# not an error. mero-sign deployed that way — its `vercel.json` pointed at
# `apps/mero-sign/build`, which no build ever wrote. This asserts every
# app's declared output directory is the one its build produced, and that
# each carries the SPA rewrite its client-side router needs.
- name: Assert vercel.json matches the real build output
if: env.CHECK_APPS == 'true'
# shellcheck disable=SC2086 - word-splitting the list is the point
run: scripts/check-vercel-output.sh $VERCEL_APPS
# Reads vitest's report for each app's node shield gate, so a skipped,
# deleted or excluded gate fails by name, and a new app cannot skip it.
- name: Assert every app's node shield gate ran and passed
if: env.CHECK_APPS == 'true'
# shellcheck disable=SC2086 - word-splitting the list is the point
run: python3 scripts/check-node-shield-gate.py $VERCEL_APPS
# Every app's HTML is served `no-cache`, but a service worker answers
# before that header is read. mero-chat's precached index.html, so the
# first open after a deploy ran the previous build and an invite opened
# from the desktop landed on a screen the release had removed. This fails
# a build whose worker could serve a page older than the deploy.
- name: Assert no service worker serves a stale page
if: env.CHECK_APPS == 'true'
# shellcheck disable=SC2086 - word-splitting the list is the point
run: python3 scripts/check-service-workers.py $VERCEL_APPS
# The conformance rig: every admin and RPC call, on a node and on an account,
# against the newest core release built with mock attestation. Its own
# workflow because it also runs nightly and by hand with a core ref; here it
# runs when the `conformance` filter matches. Not a required check.
conformance:
name: Conformance
needs: changes
if: needs.changes.outputs.conformance == 'true'
uses: ./.github/workflows/conformance.yml
# The one check to require. A job skipped because the change does not reach
# it is a pass; a failure or a cancellation anywhere is not.
ok:
name: CI OK
needs: [changes, metadata, frontend, conformance]
if: always()
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Every needed job passed or was out of scope
env:
NEEDS: ${{ toJSON(needs) }}
run: |
jq -r 'to_entries[] | "\(.key): \(.value.result)"' <<<"$NEEDS"
if jq -e 'any(.[]; .result == "failure" or .result == "cancelled")' <<<"$NEEDS" >/dev/null; then
echo "::error::a CI job failed or was cancelled"
exit 1
fi