-
-
Notifications
You must be signed in to change notification settings - Fork 111
595 lines (532 loc) · 27.1 KB
/
Copy pathci.yml
File metadata and controls
595 lines (532 loc) · 27.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
name: CI
on:
push:
branches: [main]
paths:
- 'crates/**'
- 'client/**'
- 'lobby-worker/**'
- 'scripts/**'
- 'Cargo.*'
- '.cargo/**'
- 'Dockerfile'
- '.dockerignore'
- 'docker/**'
- '.github/workflows/ci.yml'
- '.github/workflows/deploy.yml'
- '.github/workflows/release.yml'
pull_request:
branches: [main]
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
rust-lint:
name: Rust lint (fmt, clippy, parser gate)
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
with:
# Full history so the parser-combinator gate can diff against origin/main.
fetch-depth: 0
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: wasm32-unknown-unknown
cache-shared-key: rust-debug
- name: Check formatting
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --workspace --exclude phase-tauri --all-targets --features engine/proptest -- -D warnings
- name: Parser combinator gate
# Diff-based gate: new parser code must use nom combinators, not
# string-matching methods. See crates/engine/src/parser/oracle_nom/PATTERNS.md.
run: |
BASE="${{ github.event.pull_request.base.sha || github.event.before }}"
if [ -z "$BASE" ] || [ "$BASE" = "0000000000000000000000000000000000000000" ]; then
BASE="origin/main"
fi
./scripts/check-parser-combinators.sh "$BASE"
- name: Skill doc gate (oracle-parser SKILL.md)
# Asserts .claude/skills/oracle-parser/SKILL.md still matches the
# parser source tree: documented paths/symbols exist and the §3
# priority table mirrors the `// Priority` slots in oracle.rs.
run: ./scripts/check-skill-doc.sh
- name: Engine authority gate
# Diff-based gate: new engine code must use single-authority helpers
# (keyword queries via game/keywords.rs) instead of raw state pokes.
run: |
BASE="${{ github.event.pull_request.base.sha || github.event.before }}"
if [ -z "$BASE" ] || [ "$BASE" = "0000000000000000000000000000000000000000" ]; then
BASE="origin/main"
fi
./scripts/check-engine-authorities.sh "$BASE"
- name: Test card-data load gate
# Diff-based gate: new test code must not reparse the full ~90 MB
# client/public/card-data.json (tens of seconds/test under nextest, and
# it self-skips in CI). Use support::shared_card_db() (fixture-backed).
run: |
BASE="${{ github.event.pull_request.base.sha || github.event.before }}"
if [ -z "$BASE" ] || [ "$BASE" = "0000000000000000000000000000000000000000" ]; then
BASE="origin/main"
fi
./scripts/check-test-card-data-load.sh "$BASE"
rust-test:
name: Rust tests (shard ${{ matrix.shard }}/2)
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
shard: [1, 2]
steps:
- uses: actions/checkout@v4
- name: Free runner disk for Rust test linking
# The nextest count partition splits execution, but each shard still
# runs `cargo test --no-run` for the whole workspace. Keep the Rust
# caches intact and reclaim only unused hosted-image payloads before
# setup-rust-toolchain restores/saves Cargo state.
run: |
echo "Disk before cleanup:"
df -h /
sudo rm -rf \
/usr/local/lib/android \
/usr/share/dotnet \
/opt/ghc \
/usr/local/.ghcup \
/opt/hostedtoolcache/CodeQL
if command -v docker >/dev/null 2>&1; then
docker system prune --all --force || true
fi
echo "Disk after cleanup:"
df -h /
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: wasm32-unknown-unknown
cache-shared-key: rust-debug
- uses: taiki-e/install-action@v2
with:
tool: cargo-nextest
- name: Run tests
# PROPTEST_CASES split: PRs run a smaller case count for fast feedback;
# pushes to main run the default (256) so any property regression is
# caught before it lands on the branch that feeds staging/preview.
env:
PROPTEST_CASES: ${{ github.event_name == 'pull_request' && '32' || '256' }}
run: cargo nextest run --profile ci --partition count:${{ matrix.shard }}/2 --workspace --exclude phase-tauri --exclude mtgish-import --features engine/proptest --status-level fail --final-status-level fail
card-data-gate:
name: Card data (generate, validate, coverage)
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: wasm32-unknown-unknown
cache-shared-key: rust-debug
- name: Set cache keys
id: cache-keys
run: echo "week=$(date +%Y-W%V)" >> "$GITHUB_OUTPUT"
- name: Cache MTGJSON data
# Scoped to AtomicCards.json under its own `mtgjson-atomic-` namespace —
# this job needs nothing else from data/mtgjson. The per-content
# namespace stops draft-pools (which populates only SetList + sets/,
# never AtomicCards) from clobbering this job's key with a partial dir.
#
# Exact weekly key, NO restore-keys: a new week misses, so the download
# step re-fetches fresh MTGJSON data (the weekly refresh we want); a
# restore-keys fallback would pin us to last week's AtomicCards forever
# because the download is file-existence-gated. Same-week runs reuse the
# exact-key hit.
id: mtgjson-cache
uses: actions/cache@v4
with:
path: data/mtgjson/AtomicCards.json
key: mtgjson-atomic-${{ steps.cache-keys.outputs.week }}
- name: Download MTGJSON data
# Gate on file existence, not cache-hit: actions/cache restore-keys can
# match a poisoned/partial entry (and CACHE_ON_FAILURE saves caches from
# failed runs), setting cache-hit=true while AtomicCards.json is absent.
# Gating the download on cache-hit then permanently skips it, breaking
# oracle-gen with "AtomicCards.json not found". Always run; fetch only
# when the file is missing so a poisoned cache self-heals.
run: |
if [ ! -f data/mtgjson/AtomicCards.json ]; then
mkdir -p data/mtgjson
source scripts/lib/mtgjson-fetch.sh
mtgjson_download AtomicCards.json data/mtgjson/AtomicCards.json
fi
- name: Cache generated card data
# Output of `oracle-gen` is deterministic given (MTGJSON input + engine
# source). Hash both into the key; on hit, skip the ~30k-card pass.
# Exact-match only (no restore-keys) — a stale hit would feed wrong
# card-data into the validate/coverage gates downstream. Cargo.lock is
# included so dep bumps that affect parsing (e.g. nom) invalidate.
id: cardgen-cache
uses: actions/cache@v4
with:
path: |
data/card-data.json
data/card-names.json
key: cardgen-${{ hashFiles('data/mtgjson/AtomicCards.json', 'crates/engine/src/**/*.rs', 'crates/engine/Cargo.toml', 'Cargo.lock') }}
- name: Generate card data
# All engine-backed tools in this job use the SAME (profile, features)
# pair — `[tool, cli]` — so the engine crate compiles exactly once and is
# reused as a cache hit by validate, coverage, and semantic-audit below.
# Mixing profiles/feature-sets (e.g. dev here, release elsewhere)
# re-fingerprints engine and forces a full recompile per variant.
if: steps.cardgen-cache.outputs.cache-hit != 'true'
run: |
cargo run --profile tool --features cli --bin oracle-gen -- data/ --stats --names-out data/card-names.json > data/card-data.json
- name: Validate card-data against engine schema
# PR-time gate — the same parse the WASM does at runtime, run against
# the freshly produced card-data. If a parser/schema change makes the
# engine unable to read its own output, fail the build before merge.
# Same [tool, cli] fingerprint as card-gen above → engine cache hit.
run: cargo run --profile tool --features cli --bin card-data-validate -- data/card-data.json
- name: Card support coverage report
# Same [tool, cli] fingerprint as card-gen above → engine cache hit.
run: |
cargo run --profile tool --features cli --bin coverage-report -- data/ --all > data/coverage-data.json
jq '{total_cards, supported_cards, coverage_pct, coverage_by_format}' data/coverage-data.json > data/coverage-summary.json
- name: Coverage regression check (engine vs parser-honesty)
# Fails the build if a previously-supported card loses support because
# the engine now lacks a handler (non-ParseWarning gap). Parser-honesty
# flips (new ParseWarning:*) and genuinely-gained cards are informational.
# Baseline is main's last-good coverage-data.json published to R2.
# On push-to-main the check is informational only: the merge has already
# happened, and failing here blocks the R2 baseline republish below,
# wedging main red until a manual baseline upload (the PR #2339 /
# PR #2802 ratchet deadlock). PR and merge_group runs remain blocking.
continue-on-error: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: |
./scripts/coverage-regression-check.sh \
"https://data.phase-rs.dev/preview/coverage-data.json" \
data/coverage-data.json \
--fail-on-engine
- name: Parse-detail diff vs base baseline
# PR-only review aid (NEVER blocks — continue-on-error): surfaces the
# field-level parse changes this PR introduces, for the reviewing LLM.
# Unlike the regression check above (supported flips only), this diffs
# the full parse_details tree.
#
# Baseline = the published coverage of the EXACT main commit this CI
# merge commit was built on (the merge commit's non-head parent),
# fetched by its engine-source hash; head = the coverage built above
# from that same merge commit. So head - baseline isolates EXACTLY this
# PR's parse changes, with no second coverage build and no cross-PR
# contamination — even when the PR is behind main, or has main merged
# into it (both sides move in lockstep because the base is read off the
# merge commit, not the frozen webhook base.sha). Path filter: identical
# engine-source hash => no parse
# change is possible => skip before the bin build. --features cli keeps
# the same [tool, cli] engine fingerprint as the steps above (lib cache
# hit; only the new bin links).
id: parsediff
if: github.event_name == 'pull_request'
continue-on-error: true
env:
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
PAYLOAD_BASE_SHA: ${{ github.event.pull_request.base.sha }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
set -euo pipefail
# Derive the baseline from the ACTUAL main commit this CI merge commit
# was built on — its non-head parent — NOT the webhook payload's
# base.sha. The payload value freezes at event-creation time, but the
# checked-out refs/pull/N/merge floats: GitHub recomputes it against
# main's tip whenever main advances or the contributor merges main into
# the branch. When the two diverge, head carries the newer main while a
# payload-base.sha baseline does not, so head - baseline leaks every
# intervening main parse change into this PR's diff (this contaminated
# #4303: a one-card autotap fix whose comment listed 25 unrelated
# cards). Reading the base off the merge commit's parent keeps both
# sides in lockstep no matter how stale (or main-merged) the PR is.
if git rev-parse --verify HEAD^2 >/dev/null 2>&1; then
P1="$(git rev-parse HEAD^1)"
P2="$(git rev-parse HEAD^2)"
# Parent order is not contractual across GitHub's merge-ref build, so
# pick whichever parent is NOT the PR head as the base (main) side.
if [ "$P1" = "$HEAD_SHA" ]; then BASE_SHA="$P2"; else BASE_SHA="$P1"; fi
else
# Unmergeable PR (no synthetic merge commit) — nothing to pin to;
# fall back to the payload base.sha.
BASE_SHA="$PAYLOAD_BASE_SHA"
fi
git fetch --no-tags --depth=1 origin "$BASE_SHA"
BASE_HASH="$(./scripts/engine-source-hash.sh "$BASE_SHA")"
HEAD_HASH="$(./scripts/engine-source-hash.sh HEAD)"
if [ "$BASE_HASH" = "$HEAD_HASH" ]; then
echo "Engine source unchanged vs base ($BASE_HASH) — no parse change possible; skipping."
echo "produced=false" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "$PR_NUMBER" > pr-number.txt
URL="https://data.phase-rs.dev/parse-baselines/coverage-data-${BASE_HASH}.json"
if curl -fsSL --retry 3 --retry-delay 2 "$URL" -o coverage-base.json; then
cargo run --profile tool --features cli --bin coverage-parse-diff -- \
coverage-base.json data/coverage-data.json \
--base-sha "$BASE_SHA" \
--markdown parse-diff.md --json parse-diff.json
else
# Baseline not published yet (base.sha only just merged) or aged out
# of retention. NEVER fall back to the lagging preview/ snapshot —
# that reintroduces cross-PR contamination. Emit a pending marker so
# reviewers can distinguish "attempted but baseline unavailable"
# from "parse-diff never ran."
printf '<!-- coverage-parse-diff -->\n### Parse changes introduced by this PR\n\n_Baseline pending for `%s` — this populates once main publishes its coverage snapshot (a few minutes after that commit landed)._\n' "$BASE_SHA" > parse-diff.md
fi
echo "produced=true" >> "$GITHUB_OUTPUT"
- name: Upload parse-diff artifact
# Consumed by .github/workflows/coverage-parse-diff-comment.yml, which
# posts the sticky PR comment from the trusted workflow_run context.
if: github.event_name == 'pull_request' && steps.parsediff.outputs.produced == 'true'
uses: actions/upload-artifact@v4
with:
name: parse-diff
if-no-files-found: ignore
retention-days: 3
path: |
parse-diff.md
parse-diff.json
pr-number.txt
- name: Run semantic audit
# Produces data/semantic-audit.json with structured findings for cards
# that parse cleanly but disagree semantically with their Oracle text.
# Only runs on push-to-main because the only consumer is the R2 upload
# below (also main-only) — on a PR the JSON is written and discarded.
# Pass data/ explicitly — the binary's default lookup is
# `client/public/card-data.json` which doesn't exist on the ci.yml
# path (card-data is generated directly into data/ above).
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: cargo semantic-audit data/
- name: Stamp shared card_data_hash on coverage + audit JSONs
# Embed the same card-data hash in both files so downstream consumers
# can verify they're reading a consistent R2 snapshot. Gated to main
# because the only consumer is the R2 upload below.
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
HASH=$(sha256sum data/card-data.json | awk '{print substr($1, 1, 16)}')
jq --arg h "$HASH" '. + {card_data_hash: $h}' data/semantic-audit.json > data/semantic-audit.json.tmp
mv data/semantic-audit.json.tmp data/semantic-audit.json
jq --arg h "$HASH" '. + {card_data_hash: $h}' data/coverage-data.json > data/coverage-data.json.tmp
mv data/coverage-data.json.tmp data/coverage-data.json
- name: Upload data to R2 (preview)
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
run: |
npx wrangler r2 object put phase-rs-data/preview/card-data.json --file data/card-data.json --remote --content-type application/json --cache-control "public, max-age=60, must-revalidate"
npx wrangler r2 object put phase-rs-data/preview/card-names.json --file data/card-names.json --remote --content-type application/json --cache-control "public, max-age=60, must-revalidate"
npx wrangler r2 object put phase-rs-data/preview/coverage-data.json --file data/coverage-data.json --remote --content-type application/json --cache-control "public, max-age=60, must-revalidate"
npx wrangler r2 object put phase-rs-data/preview/coverage-summary.json --file data/coverage-summary.json --remote --content-type application/json --cache-control "public, max-age=60, must-revalidate"
npx wrangler r2 object put phase-rs-data/preview/semantic-audit.json --file data/semantic-audit.json --remote --content-type application/json --cache-control "public, max-age=60, must-revalidate"
# changelog{,-meta}.json are committed to client/public/ (not generated
# into data/ like the files above), so the preview snapshot tracks main
# the moment a regenerated changelog lands — ahead of the nightly that
# carries it to production.
npx wrangler r2 object put phase-rs-data/preview/changelog.json --file client/public/changelog.json --remote --content-type application/json --cache-control "public, max-age=60, must-revalidate"
npx wrangler r2 object put phase-rs-data/preview/changelog-meta.json --file client/public/changelog-meta.json --remote --content-type application/json --cache-control "public, max-age=60, must-revalidate"
- name: Publish immutable parse-diff baseline to R2
# Content-addressed sibling of the mutable preview/coverage-data.json
# write above: an immutable copy keyed by THIS commit's engine-source
# hash. The PR-side "Parse-detail diff" step fetches the copy matching
# its CI merge commit's base parent's hash, so its baseline is the exact
# main that merge commit was built on — never the lagging preview/
# snapshot (which mixes in other PRs' changes). Identical-source commits
# dedupe to one object, so storage is
# bounded by distinct parser states, not commit count. best-effort
# (continue-on-error): a missed publish just defers a PR's comment to
# "baseline pending" until the next main push, never wedges main.
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
continue-on-error: true
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
run: |
set -euo pipefail
HASH="$(./scripts/engine-source-hash.sh HEAD)"
npx wrangler r2 object put "phase-rs-data/parse-baselines/coverage-data-${HASH}.json" \
--file data/coverage-data.json --remote --content-type application/json \
--cache-control "public, max-age=31536000, immutable"
draft-pools:
# Split out of card-data-gate because draft-pool-gen lives in draft-core and
# cannot take `--features cli` — it always needs its own `[tool, default]`
# engine fingerprint, distinct from the `[tool, cli]` build every other
# card-data tool shares. Keeping it inline forced a second full engine
# compile onto card-data-gate's critical path; here it runs in parallel.
# Its output (draft-pools.json) is not consumed by ci.yml — this is a
# main-only smoke test that draft-pool-gen still compiles and runs.
name: Draft pools (smoke)
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
# No wasm32 target: draft-pool-gen is a native binary. The target list
# isn't part of the rust-cache key, so omitting it still shares the
# rust-debug cache with card-data-gate.
cache-shared-key: rust-debug
- name: Set cache keys
id: cache-keys
run: echo "week=$(date +%Y-W%V)" >> "$GITHUB_OUTPUT"
- name: Cache MTGJSON data
# Scoped to SetList.json + the per-set files this job populates, under
# its own `mtgjson-sets-` namespace so it can't collide with
# card-data-gate's `mtgjson-atomic-` key (this job never fetches
# AtomicCards). Exact weekly key, NO restore-keys: a new week misses and
# re-fetches fresh set data; same-week runs reuse the exact-key hit.
uses: actions/cache@v4
with:
path: |
data/mtgjson/SetList.json
data/mtgjson/sets
key: mtgjson-sets-${{ steps.cache-keys.outputs.week }}
- name: Download MTGJSON SetList data
# fetch-draft-sets.sh enumerates draftable sets from SetList.json.
run: |
mkdir -p data/mtgjson
if [ ! -f data/mtgjson/SetList.json ]; then
source scripts/lib/mtgjson-fetch.sh
mtgjson_download SetList.json data/mtgjson/SetList.json
fi
- name: Download draft set data
run: ./scripts/fetch-draft-sets.sh
- name: Generate draft pools
# Profile `tool`, not `release`: release is the WASM-size profile
# (lto + codegen-units=1), the slowest compile in the repo, for a
# one-shot JSON transform.
run: cargo run --profile tool --bin draft-pool-gen -- data/mtgjson/sets data/draft-pools.json
wasm-check:
name: WASM compile check
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: wasm32-unknown-unknown
cache-shared-key: rust-debug
- name: WASM compile check
run: cargo check --package engine-wasm --target wasm32-unknown-unknown
tauri-check:
name: Tauri compile check
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache-shared-key: rust-tauri
cache-workspaces: |
. -> target
client/src-tauri -> target
- name: Install Linux Tauri build deps
# Required by phase-tauri's transitive dependencies (webkit2gtk, gtk).
# Without these, `cargo check -p phase-tauri` fails at the linker.
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev
- name: Stub frontend dist for tauri::generate_context!
# phase-tauri's build.rs runs `tauri::generate_context!()` which
# requires `frontendDist` (../dist per tauri.conf.json) to exist.
# An empty stub is enough for type-checking — we don't bundle assets.
run: |
mkdir -p client/dist
echo '<!doctype html><html></html>' > client/dist/index.html
- name: Stub phase-server sidecar + bundled resources for tauri-build
# tauri.conf.json declares `externalBin: ["binaries/phase-server"]`
# and bundled data resources, so tauri-build requires those paths to
# exist at check time. The real sidecar / data files are built in the
# release matrix; for PR-time compile checks we only need the paths to
# exist.
run: |
mkdir -p client/src-tauri/binaries client/public
touch client/src-tauri/binaries/phase-server-x86_64-unknown-linux-gnu
touch client/public/card-data.json
touch client/public/draft-pools.json
- name: Tauri compile check
# phase-tauri is excluded from the workspace clippy and nextest runs
# above (no proptest support, no tests). Without this step, compile
# errors in the desktop crate only surface at release time during the
# 30-45min build-tauri matrix. Catches them on every PR in ~3 min.
# Driven via --manifest-path because client/src-tauri is excluded
# from the root workspace, so `-p phase-tauri` cannot resolve it.
run: cargo check --locked --manifest-path client/src-tauri/Cargo.toml
rust-check:
name: Rust (fmt, clippy, test, coverage-gate)
runs-on: ubuntu-latest
timeout-minutes: 5
needs:
- rust-lint
- rust-test
- card-data-gate
- draft-pools
- wasm-check
- tauri-check
if: always()
steps:
- name: Check split Rust jobs
env:
RUST_LINT_RESULT: ${{ needs.rust-lint.result }}
RUST_TEST_RESULT: ${{ needs.rust-test.result }}
CARD_DATA_RESULT: ${{ needs.card-data-gate.result }}
DRAFT_POOLS_RESULT: ${{ needs.draft-pools.result }}
WASM_RESULT: ${{ needs.wasm-check.result }}
TAURI_RESULT: ${{ needs.tauri-check.result }}
run: |
results="$RUST_LINT_RESULT $RUST_TEST_RESULT $CARD_DATA_RESULT $DRAFT_POOLS_RESULT $WASM_RESULT $TAURI_RESULT"
# `skipped` is a pass: draft-pools is main-only and is skipped on PRs.
for result in $results; do
if [ "$result" != "success" ] && [ "$result" != "skipped" ]; then
echo "One or more split Rust jobs failed: $results"
exit 1
fi
done
lobby-worker-test:
name: Lobby worker (pnpm test)
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: lobby-worker/package-lock.json
- name: Install and test
run: |
cd lobby-worker
npm ci
pnpm test
frontend:
name: Frontend (lint, type-check, test)
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
cache-dependency-path: client/pnpm-lock.yaml
- name: Install dependencies
run: cd client && pnpm install --frozen-lockfile
- name: Lint
run: cd client && pnpm run lint
- name: Type check
run: cd client && pnpm run type-check
- name: Run tests with coverage
run: cd client && pnpm test -- --run --coverage