-
Notifications
You must be signed in to change notification settings - Fork 0
379 lines (308 loc) · 10.5 KB
/
Copy pathci.yml
File metadata and controls
379 lines (308 loc) · 10.5 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
name: CI
on:
push:
branches: [main, master]
pull_request:
jobs:
verify-deployment-manifest:
name: Verify deployment manifests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install root tooling
run: npm ci
- name: Validate manifests (schema, no legacy Solana/devnet)
run: npm run verify:deployment
- name: Validate mainnet security audit register
run: npm run verify:security-audit
- name: Reject devnet / Solana address patterns in production config
run: |
if grep -rE '"devnet"|"cluster"[[:space:]]*:[[:space:]]*"devnet"' frontend/src/contracts --include='*.json' 2>/dev/null; then
echo "Found devnet references in frontend contract JSON"
exit 1
fi
if test -f frontend/src/contracts/deployed-addresses.json || test -f frontend/src/contracts/reputation-addresses.json; then
echo "Legacy Solana-style address JSON must be removed"
exit 1
fi
echo "No legacy devnet JSON config in frontend/src/contracts"
- name: Verify lockfiles required in CI
run: |
if [ ! -f Cargo.lock ]; then
echo "Cargo.lock is required"
exit 1
fi
if [ ! -f package-lock.json ]; then
echo "package-lock.json is required"
exit 1
fi
if [ ! -f frontend/package-lock.json ]; then
echo "frontend/package-lock.json is required"
exit 1
fi
if [ ! -f relayer/package-lock.json ]; then
echo "relayer/package-lock.json is required"
exit 1
fi
echo "All required lockfiles present"
supply-chain:
name: Supply chain integrity
runs-on: ubuntu-latest
needs: verify-deployment-manifest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: npm
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install cargo audit tools
run: |
cargo install cargo-audit --locked
cargo install cargo-deny --locked
- name: Run cargo audit
run: cargo audit
- name: Run cargo deny
run: cargo deny check
- name: Run npm audit (root)
run: npm audit --audit-level=moderate
continue-on-error: true
- name: Run npm audit (frontend)
run: npm audit --audit-level=moderate
working-directory: frontend
continue-on-error: true
- name: Run npm audit (relayer)
run: npm audit --audit-level=moderate
working-directory: relayer
continue-on-error: true
- name: Run npm audit (circuits)
run: npm audit --audit-level=moderate
working-directory: circuits
continue-on-error: true
scanner:
name: Build scanner WASM
runs-on: ubuntu-latest
needs: verify-deployment-manifest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: npm
- name: Install root tooling (tsx)
run: npm ci
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-scanner-ci-${{ hashFiles('scanner/Cargo.lock') }}
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Install wasm-pack
run: |
mkdir -p "$RUNNER_TEMP/bin"
WASM_PACK_INSTALL_DIR="$RUNNER_TEMP/bin" WASM_PACK_TARGET="x86_64-unknown-linux-musl" bash scripts/install-wasm-pack.sh
echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH"
- name: Build scanner WASM
run: npm run build:scanner
- name: Verify scanner artifact hashes
run: npx tsx scripts/verify-artifact-manifest.ts --scanner --strict
- name: Upload scanner WASM
uses: actions/upload-artifact@v4
with:
name: scanner-wasm
path: frontend/public/pkg/
retention-days: 7
circuit-regression:
name: Circuit regression (heavy)
runs-on: ubuntu-latest
needs: verify-deployment-manifest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install Circom
run: |
curl -Ls https://github.com/iden3/circom/releases/download/v2.1.9/circom-linux-amd64 -o /usr/local/bin/circom
chmod +x /usr/local/bin/circom
circom --version
- name: Install circuit dependencies
run: |
npm ci
npm ci --prefix v2
npm ci --prefix v3
working-directory: circuits
- name: Install root tooling (tsx)
run: npm ci
- name: Fetch circuit release artifacts
run: npm run fetch:circuits
continue-on-error: true
- name: Build circuit witness artifacts
run: |
npm run build --prefix v2
npm run build --prefix v3
working-directory: circuits
- name: Run circuit regression tests
run: npm run test:circuits -- --witness-only
- name: Verify artifact manifest (circuits + VK binding)
run: npx tsx scripts/verify-artifact-manifest.ts --circuits --vk-binding
continue-on-error: true
frontend:
name: Frontend build
runs-on: ubuntu-latest
needs: [verify-deployment-manifest, scanner]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: npm
cache-dependency-path: frontend/package-lock.json
- uses: actions/download-artifact@v4
with:
name: scanner-wasm
path: frontend/public/pkg/
- name: Install dependencies
working-directory: frontend
run: npm ci
- name: Install root tooling (tsx)
run: npm ci
- name: Fetch circuit artifacts
run: npm run fetch:circuits
- name: Verify frontend circuit runtime artifacts
run: npx tsx scripts/verify-artifact-manifest.ts --frontend-circuits --strict --vk-binding
- name: Verify frontend env matches manifest
run: |
eval "$(npx tsx scripts/export-manifest-env.ts testnet)"
npx tsx scripts/verify-deployment-manifest.ts --network testnet
cd frontend && npm run verify:deployment -- --network testnet
- name: Verify scanner WASM hashes
run: npx tsx scripts/verify-artifact-manifest.ts --scanner --strict
- name: Lint
working-directory: frontend
run: npm run lint
- name: Typecheck
working-directory: frontend
run: npx tsc -b --noEmit
- name: Typecheck and build
working-directory: frontend
env:
VITE_STELLAR_NETWORK: testnet
SKIP_FRONTEND_PREBUILD: "1"
run: npm run build
- name: Run unit tests
working-directory: frontend
run: npx vitest run --reporter=verbose
contracts:
name: Soroban contracts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
# Install both WASM targets so the build works regardless of which one the
# installed Stellar CLI defaults to (<=23.x: wasm32-unknown-unknown,
# >=24.x: wasm32v1-none).
targets: wasm32-unknown-unknown, wasm32v1-none
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run clippy (deny warnings, all targets)
run: cargo clippy --workspace --all-targets -- -D warnings
- name: Run contract unit + property tests
run: cargo test --workspace --locked
- name: Install Stellar CLI
run: |
mkdir -p "$RUNNER_TEMP/bin"
STELLAR_CLI_INSTALL_DIR="$RUNNER_TEMP/bin" STELLAR_CLI_TARGET="x86_64-unknown-linux-gnu" bash scripts/install-stellar-cli.sh
echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH"
- name: Build contracts (release WASM)
run: stellar contract build
- name: Install root tooling (tsx)
run: npm ci
- name: Verify on-chain WASM hashes match manifest
run: npx tsx scripts/verify-deployment-manifest.ts --network testnet --check-wasm
continue-on-error: true
asp:
name: ASP service
runs-on: ubuntu-latest
defaults:
run:
working-directory: asp
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: npm
cache-dependency-path: asp/package-lock.json
- name: Install dependencies
run: npm ci
- name: Typecheck
run: npm run typecheck
# Engine reconcile, set/tree byte-compatibility, policy, store. The live indexer
# is never run in CI (it would send real testnet transactions).
- name: Unit tests
run: npm test
relayer:
name: Relayer market
runs-on: ubuntu-latest
defaults:
run:
working-directory: relayer
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: npm
cache-dependency-path: relayer/package-lock.json
- name: Install dependencies
run: npm ci
- name: Typecheck
run: npm run typecheck
- name: Unit tests
run: npm test
ci-success:
name: CI success gate
runs-on: ubuntu-latest
if: always()
needs:
- verify-deployment-manifest
- supply-chain
- scanner
- circuit-regression
- frontend
- contracts
- asp
- relayer
steps:
- name: Fail if any required job failed
run: |
if [ "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}" = "true" ]; then
echo "One or more required CI jobs failed."
exit 1
fi
echo "All required CI jobs succeeded."