-
Notifications
You must be signed in to change notification settings - Fork 1
487 lines (411 loc) · 16.7 KB
/
Copy pathci.yml
File metadata and controls
487 lines (411 loc) · 16.7 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
name: CI
on:
push:
branches: [main]
pull_request:
workflow_call:
inputs:
performance_baseline_revision:
description: Exact clean commit SHA used as the same-host release performance baseline
required: false
type: string
default: ''
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
NODE_VERSION: '22'
BUN_VERSION: '1.3.10'
jobs:
# ──────────────────────────────────────────────
# Lint — run ESLint across the workspace
# ──────────────────────────────────────────────
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- uses: oven-sh/setup-bun@v1
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Cache Bun store
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: bun-store-${{ runner.os }}-${{ hashFiles('bun.lock') }}
restore-keys: |
bun-store-${{ runner.os }}-
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Run ESLint
run: bun run lint
# ──────────────────────────────────────────────
# Typecheck — validate TypeScript across apps
# ──────────────────────────────────────────────
typecheck:
name: Typecheck
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- uses: oven-sh/setup-bun@v1
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Cache Bun store
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: bun-store-${{ runner.os }}-${{ hashFiles('bun.lock') }}
restore-keys: |
bun-store-${{ runner.os }}-
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Typecheck
run: |
bun run typecheck
bun --cwd=backend run typecheck:scripts
bun --cwd=backend run migration:typecheck
bun run typecheck:e2e
bun run typecheck:release-scripts
bun run smoke:findings-opensearch:typecheck
bun run smoke:telemetry-durability:typecheck
# ──────────────────────────────────────────────
# Unit Tests — bun test across the workspace
# ──────────────────────────────────────────────
test-unit:
name: Unit Tests
runs-on: ubuntu-latest
timeout-minutes: 25
services:
redis:
image: redis:7.4-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 5s
--health-retries 12
env:
MCP_RUNTIME_TEST_REDIS_URL: redis://127.0.0.1:6379
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- uses: oven-sh/setup-bun@v1
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Cache Bun store
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: bun-store-${{ runner.os }}-${{ hashFiles('bun.lock') }}
restore-keys: |
bun-store-${{ runner.os }}-
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Run release harness tests
run: bun test scripts/__tests__
- name: Run tests
run: bun run test
# ──────────────────────────────────────────────
# Tenant boundaries — named negative proof for the release gate
# ──────────────────────────────────────────────
tenant-boundaries:
name: Cross-Tenant Boundary Tests
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Cache Bun store
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: bun-store-${{ runner.os }}-${{ hashFiles('bun.lock') }}
restore-keys: |
bun-store-${{ runner.os }}-
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Backend ownership and redemption boundaries
run: >-
bun --cwd=backend test
src/api-keys/__tests__/api-keys.http.spec.ts
src/api-keys/__tests__/api-keys.service.spec.ts
src/integrations/__tests__/integrations.http.spec.ts
src/integrations/__tests__/integrations.repository.spec.ts
src/integrations/__tests__/integrations.service.spec.ts
src/mcp-servers/__tests__/mcp-servers.service.spec.ts
- name: Worker secret and file ownership boundaries
run: >-
bun --cwd=worker test
src/adapters/__tests__/secrets.adapter.test.ts
src/adapters/__tests__/file-storage.adapter.test.ts
# ──────────────────────────────────────────────
# Build — validate production build compiles
# ──────────────────────────────────────────────
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 10
needs: [typecheck]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- uses: oven-sh/setup-bun@v1
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Cache Bun store
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: bun-store-${{ runner.os }}-${{ hashFiles('bun.lock') }}
restore-keys: |
bun-store-${{ runner.os }}-
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build shared package
run: bun --cwd=packages/shared run build
- name: Build backend
run: bun --cwd=backend run build
- name: Build worker
run: bun --cwd=worker run build
- name: Build frontend
run: bun --cwd=frontend run build
# ──────────────────────────────────────────────
# API Contract — ensure OpenAPI spec is up to date
# ──────────────────────────────────────────────
api-contract:
name: API Contract Check
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- uses: oven-sh/setup-bun@v1
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Cache Bun store
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: bun-store-${{ runner.os }}-${{ hashFiles('bun.lock') }}
restore-keys: |
bun-store-${{ runner.os }}-
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Generate OpenAPI spec
run: bun --cwd=backend run generate:openapi
- name: Generate backend client
run: bun --cwd=packages/backend-client run generate
- name: Typecheck generated backend client
run: bun --cwd=packages/backend-client run typecheck
- name: Check for uncommitted API contract changes
run: |
if ! git diff --exit-code -- openapi.json packages/backend-client/src/client.ts; then
echo ""
echo "::error::OpenAPI or generated client is out of date. Regenerate both and commit the result."
exit 1
fi
# ──────────────────────────────────────────────
# Checked migrations — fresh, previous-release upgrade, and concurrent startup
# ──────────────────────────────────────────────
migration-smoke:
name: Checked Migration Smoke
runs-on: ubuntu-latest
timeout-minutes: 15
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: sentris_fresh
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres -d sentris_fresh"
--health-interval 5s
--health-timeout 5s
--health-retries 12
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Cache Bun store
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: bun-store-${{ runner.os }}-${{ hashFiles('bun.lock') }}
restore-keys: |
bun-store-${{ runner.os }}-
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Verify checked migration artifacts
run: bun --cwd=backend run migration:check
- name: Fresh database migration
env:
MIGRATION_SMOKE_DATABASE_URL: postgres://postgres:postgres@127.0.0.1:5432/sentris_fresh
run: bun --cwd=backend run migration:smoke:fresh
- name: Fresh database parity
env:
MIGRATION_SMOKE_DATABASE_URL: postgres://postgres:postgres@127.0.0.1:5432/sentris_fresh
run: bun --cwd=backend run migration:smoke:parity
- name: Create isolated upgrade database
run: >-
bun --cwd=backend -e "import pg from 'pg';
const client = new pg.Client('postgres://postgres:postgres@127.0.0.1:5432/postgres');
await client.connect();
await client.query('CREATE DATABASE sentris_upgrade');
await client.end();"
- name: Previous-release upgrade migration
env:
MIGRATION_SMOKE_DATABASE_URL: postgres://postgres:postgres@127.0.0.1:5432/sentris_upgrade
run: bun --cwd=backend run migration:smoke:upgrade
- name: Upgrade database parity
env:
MIGRATION_SMOKE_DATABASE_URL: postgres://postgres:postgres@127.0.0.1:5432/sentris_upgrade
run: bun --cwd=backend run migration:smoke:parity
- name: Create isolated concurrent-start database
run: >-
bun --cwd=backend -e "import pg from 'pg';
const client = new pg.Client('postgres://postgres:postgres@127.0.0.1:5432/postgres');
await client.connect();
await client.query('CREATE DATABASE sentris_concurrent');
await client.end();"
- name: Concurrent backend migration startup
env:
MIGRATION_SMOKE_DATABASE_URL: postgres://postgres:postgres@127.0.0.1:5432/sentris_concurrent
run: bun --cwd=backend run migration:smoke:concurrent
# ──────────────────────────────────────────────
# Production topology — real Temporal, DIND, telemetry, and target journey
# ──────────────────────────────────────────────
production-smoke:
name: Production Compose Release Smoke (${{ matrix.trust-profile }})
runs-on: ubuntu-latest
timeout-minutes: 180
needs: [lint, typecheck, test-unit, tenant-boundaries, build, api-contract, migration-smoke]
strategy:
fail-fast: false
matrix:
trust-profile: [trusted-local, hardened]
env:
CI: true
SENTRIS_INSTANCE: '0'
SENTRIS_TRUST_PROFILE: ${{ matrix.trust-profile }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- uses: oven-sh/setup-bun@v1
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Cache Bun store
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: bun-store-${{ runner.os }}-${{ hashFiles('bun.lock') }}
restore-keys: |
bun-store-${{ runner.os }}-
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Install Chromium for trusted-local browser journey
if: matrix.trust-profile == 'trusted-local'
run: bunx playwright install --with-deps chromium
- name: Run clean production topology and critical-journey smoke
run: bun run smoke:production-compose
# ──────────────────────────────────────────────
# Performance — same host, exact clean baseline/candidate revisions
# ──────────────────────────────────────────────
performance-pair:
name: Release Performance Pair
if: ${{ inputs.performance_baseline_revision != '' }}
runs-on: ubuntu-latest
timeout-minutes: 210
needs: [lint, typecheck, test-unit, tenant-boundaries, build, api-contract, migration-smoke]
env:
CI: 'true'
SENTRIS_INSTANCE: '0'
SENTRIS_TRUST_PROFILE: trusted-local
PERFORMANCE_BASELINE_REVISION: ${{ inputs.performance_baseline_revision }}
RELEASE_BENCHMARK_ADMIN_USERNAME: performance-admin
RELEASE_BENCHMARK_SAMPLE_COUNT: '10'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- uses: oven-sh/setup-bun@v1
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Cache Bun store
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: bun-store-${{ runner.os }}-${{ hashFiles('bun.lock') }}
restore-keys: |
bun-store-${{ runner.os }}-
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Install Chromium
run: bunx playwright install --with-deps chromium
- name: Prepare isolated benchmark credentials
shell: bash
run: |
password="$(openssl rand -hex 32)"
token="$(openssl rand -hex 32)"
echo "::add-mask::$password"
echo "::add-mask::$token"
echo "RELEASE_BENCHMARK_ADMIN_PASSWORD=$password" >> "$GITHUB_ENV"
echo "RELEASE_BENCHMARK_INTERNAL_TOKEN=$token" >> "$GITHUB_ENV"
- name: Resolve exact candidate revision
id: candidate
shell: bash
run: echo "revision=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
- name: Prepare exact baseline worktree
shell: bash
run: |
if [[ ! "$PERFORMANCE_BASELINE_REVISION" =~ ^[0-9a-f]{40}$ ]]; then
echo "::error::Performance baseline must be a full 40-character commit SHA."
exit 1
fi
git worktree add --detach \
"$RUNNER_TEMP/sentris-baseline" \
"$PERFORMANCE_BASELINE_REVISION"
- name: Collect and compare release performance
shell: bash
env:
CANDIDATE_REVISION: ${{ steps.candidate.outputs.revision }}
run: |
bun run performance:pair -- \
--baseline-root "$RUNNER_TEMP/sentris-baseline" \
--baseline-revision "$PERFORMANCE_BASELINE_REVISION" \
--candidate-root "$GITHUB_WORKSPACE" \
--candidate-revision "$CANDIDATE_REVISION" \
--output-dir "$RUNNER_TEMP/sentris-performance-pair"
- name: Upload performance evidence
uses: actions/upload-artifact@v4
if: always()
with:
name: release-performance-pair
path: ${{ runner.temp }}/sentris-performance-pair/*.json
if-no-files-found: warn
retention-days: 30