-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (82 loc) · 3.16 KB
/
Copy pathci.yml
File metadata and controls
87 lines (82 loc) · 3.16 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
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
typescript:
name: TypeScript (Node ${{ matrix.node }})
runs-on: ubuntu-latest
strategy:
matrix:
node: ["18", "20", "22"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- run: npm ci
working-directory: packages/ts
- run: npm run build
working-directory: packages/ts
- run: npm test
working-directory: packages/ts
rust:
name: Rust
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- run: cargo fmt --all -- --check
working-directory: crates/validator
- run: cargo clippy --all-targets -- -D warnings
working-directory: crates/validator
- run: cargo test
working-directory: crates/validator
# Curated≡vendored parity gate (README "Toward 1.0.0" item 2 / DESIGN.md §2.3).
#
# The de-duplicated curated schemas (schemas/curated/*.json + core.json) are the single sources of
# truth the validator loads; the vendored originals (schemas/vendored/) are the verbatim upstream
# quote. This job enforces the two stay in lock-step:
# 1. Bundler determinism: regenerate schemas/curated/bundled/ from the authored sources and assert
# the committed output is byte-identical — catches "edited core.json but forgot to re-bundle +
# commit". (The Rust-side snapshot drift guard, vendored_parity.rs, is the downstream analog:
# it asserts that same committed bundled output matches the embedded _vendored snapshot.)
# 2. Outcome parity: run the curated≡vendored corpus comparison explicitly so the guarantee is a
# named status check (also exercised by the typescript job's full `npm test`).
curated-parity:
name: Curated parity
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
- run: npm ci
- name: Re-bundle curated schemas
run: npm run bundle
- name: Committed bundled output is fresh
run: git diff --exit-code -- schemas/curated/bundled/
- name: Curated ≡ vendored outcome parity
run: npm run test:curated-parity -w @jsonstat-validator/ts
wasm:
name: WebAssembly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- uses: actions/setup-node@v4
with:
node-version: "22"
# Build the TS surface first: the Wasm parity test imports @jsonstat-validator/ts.
- run: npm ci
- run: npm run build -w @jsonstat-validator/ts
# `npm test` runs `pretest` (wasm-pack -t web -> packages/wasm/pkg, with the getrandom cfg set
# in tools/build.mjs) then the TS<->Wasm corpus parity test (packages/wasm/test/parity.test.ts).
- run: npm test -w @jsonstat-validator/wasm