-
Notifications
You must be signed in to change notification settings - Fork 0
535 lines (458 loc) · 18 KB
/
Copy pathci.yml
File metadata and controls
535 lines (458 loc) · 18 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
name: CI
on:
pull_request:
push:
branches:
- main
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
scripts:
name: Scripts
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Detect private guidance source contract
shell: bash
run: |
private_guidance_paths=(
AGENTS.md
scripts/check-agent-guidance.py
scripts/agent-preflight.py
)
present_count=0
for path in "${private_guidance_paths[@]}"; do
if [[ -f "$path" ]]; then
present_count=$((present_count + 1))
fi
done
if [[ "$present_count" -eq "${#private_guidance_paths[@]}" ]]; then
echo "READMATES_PRIVATE_AGENT_GUIDANCE=true" >> "$GITHUB_ENV"
elif [[ "$present_count" -eq 0 ]]; then
echo "READMATES_PRIVATE_AGENT_GUIDANCE=false" >> "$GITHUB_ENV"
echo "Private guidance tooling is intentionally absent; skipping its CI-only checks."
else
echo "Private guidance source contract is incomplete; refusing to weaken CI checks." >&2
exit 1
fi
- name: Agent tooling self-tests
if: env.READMATES_PRIVATE_AGENT_GUIDANCE == 'true'
run: |
python3 -B scripts/check-agent-guidance.py --self-test
python3 -B scripts/agent-preflight.py --self-test
- name: Agent guidance contract
if: env.READMATES_PRIVATE_AGENT_GUIDANCE == 'true'
run: python3 -B scripts/check-agent-guidance.py
- name: Deploy workflow contract self-tests
run: python3 -B scripts/check-deploy-workflow-contract.py --self-test
- name: Deploy workflow contract
run: python3 -B scripts/check-deploy-workflow-contract.py
- name: Flyway migration checker self-tests
run: python3 -B scripts/check-flyway-migration-immutability.py --self-test
- name: Flyway migration workflow contract
run: python3 -B scripts/check-flyway-migration-immutability.py --check-workflow .github/workflows/ci.yml
- name: Flyway migration history immutability
env:
READMATES_FLYWAY_EVENT_NAME: ${{ github.event_name }}
READMATES_FLYWAY_PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
READMATES_FLYWAY_PUSH_BEFORE_SHA: ${{ github.event.before }}
shell: bash
run: |
base_sha=""
case "${READMATES_FLYWAY_EVENT_NAME}" in
pull_request)
base_sha="${READMATES_FLYWAY_PR_BASE_SHA}"
;;
push)
base_sha="${READMATES_FLYWAY_PUSH_BEFORE_SHA}"
if [[ "$base_sha" =~ ^0+$ ]]; then
if ! base_sha="$(git rev-parse --verify --quiet 'HEAD^^{commit}')"; then
echo "Flyway comparison base is unavailable." >&2
exit 1
fi
fi
;;
*)
echo "Unsupported Flyway comparison event." >&2
exit 1
;;
esac
if [[ -z "$base_sha" ]]; then
echo "Flyway comparison base is empty." >&2
exit 1
fi
if ! base_sha="$(git rev-parse --verify --quiet "${base_sha}^{commit}")"; then
echo "Flyway comparison base cannot be resolved locally." >&2
exit 1
fi
python3 -B scripts/check-flyway-migration-immutability.py --base-ref "$base_sha"
- name: Install script tools
if: ${{ always() }}
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends ripgrep shellcheck
- name: Collect tracked shell scripts
if: ${{ always() }}
shell: bash
run: |
shell_script_list="$RUNNER_TEMP/readmates-tracked-shell-scripts.zlist"
git ls-files -z -- \
':(glob)scripts/**/*.sh' \
':(glob)deploy/oci/**/*.sh' \
> "$shell_script_list"
if [[ ! -s "$shell_script_list" ]]; then
echo "No tracked shell scripts found under scripts or deploy/oci." >&2
exit 1
fi
printf 'READMATES_TRACKED_SHELL_SCRIPTS=%s\n' "$shell_script_list" >> "$GITHUB_ENV"
- name: Bash syntax
if: ${{ always() }}
run: |
shell_script_list="${READMATES_TRACKED_SHELL_SCRIPTS:?tracked shell-script list is unavailable}"
while IFS= read -r -d '' shell_script; do
bash -n "$shell_script"
done < "$shell_script_list"
- name: ShellCheck
if: ${{ always() }}
run: |
shell_script_list="${READMATES_TRACKED_SHELL_SCRIPTS:?tracked shell-script list is unavailable}"
mapfile -d '' -t shell_scripts < "$shell_script_list"
shellcheck "${shell_scripts[@]}"
- name: aigen PII regression check
if: ${{ always() }}
run: bash scripts/aigen-pii-check.sh
- name: Validate Prometheus rules
if: ${{ always() }}
run: ./scripts/validate-prometheus-rules.sh
- name: Validate Prometheus configs
if: ${{ always() }}
run: ./scripts/validate-prometheus-config.sh
- name: Validate Tempo config
if: ${{ always() }}
run: bash scripts/validate-tempo-config.sh
- name: Validate production AI config
if: ${{ always() }}
run: bash scripts/validate-production-ai-config.sh
- name: Verify production AI config fixtures
if: ${{ always() }}
run: bash scripts/verify-production-ai-config-fixtures.sh
- name: Lint Grafana dashboards
if: ${{ always() }}
run: ./scripts/lint-grafana-dashboards.sh
public-release:
name: Public release safety
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Build candidate and verify public release fixtures
run: ./scripts/verify-public-release-fixtures.sh
- name: Run public release check
run: ./scripts/public-release-check.sh .tmp/public-release-candidate
frontend:
name: Frontend
runs-on: ubuntu-latest
defaults:
run:
working-directory: front
steps:
- name: Configure Git defaults
working-directory: .
run: git config --global init.defaultBranch main
- name: Check out repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24
- name: Set up pnpm from packageManager
working-directory: .
run: |
if command -v corepack >/dev/null 2>&1; then
corepack_cmd=(corepack)
else
corepack_cmd=(npx --yes corepack@0.35.0)
fi
"${corepack_cmd[@]}" enable
"${corepack_cmd[@]}" prepare "$(node -p "require('./package.json').packageManager")" --activate
"${corepack_cmd[@]}" pnpm --version
- name: Restore pnpm cache
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Install dependencies
working-directory: .
run: pnpm install --frozen-lockfile
- name: Lint
run: pnpm lint
- name: Front unit tests with coverage
run: pnpm test:coverage
- name: Upload coverage artifact
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: front-coverage
path: front/coverage/
retention-days: 14
- name: Build
run: pnpm build
- name: Check zod fixtures are up to date
run: |
pnpm zod:export-fixtures
git diff --exit-code tests/unit/__fixtures__/zod-schemas/
- name: Upload frontend reports
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: frontend-reports
path: |
front/test-results
front/playwright-report
front/coverage
if-no-files-found: ignore
frontend-visual-regression:
name: Frontend visual regression
runs-on: ubuntu-latest
defaults:
run:
working-directory: front
steps:
- name: Configure Git defaults
working-directory: .
run: git config --global init.defaultBranch main
- name: Check out repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24
- name: Set up pnpm from packageManager
working-directory: .
run: |
if command -v corepack >/dev/null 2>&1; then
corepack_cmd=(corepack)
else
corepack_cmd=(npx --yes corepack@0.35.0)
fi
"${corepack_cmd[@]}" enable
"${corepack_cmd[@]}" prepare "$(node -p "require('./package.json').packageManager")" --activate
"${corepack_cmd[@]}" pnpm --version
- name: Restore pnpm cache
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Install dependencies
working-directory: .
run: pnpm install --frozen-lockfile
- name: Run component visual regression tests
run: pnpm test:ct:docker
- name: Upload visual regression reports
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: frontend-visual-regression-reports
path: |
front/test-results
front/playwright-report
if-no-files-found: ignore
design-system:
name: Design system
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24
- name: Set up pnpm from packageManager
run: |
if command -v corepack >/dev/null 2>&1; then
corepack_cmd=(corepack)
else
corepack_cmd=(npx --yes corepack@0.35.0)
fi
"${corepack_cmd[@]}" enable
"${corepack_cmd[@]}" prepare "$(node -p "require('./package.json').packageManager")" --activate
"${corepack_cmd[@]}" pnpm --version
- name: Restore pnpm cache
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build and test design system
run: pnpm design:check
backend:
name: Backend
runs-on: ubuntu-latest
env:
# ubuntu-latest is 4 vCPU; matches the build.gradle.kts default of
# availableProcessors()/2. Set explicitly so the value is auditable
# and survives any future runner-spec change.
# Refs: docs/superpowers/specs/2026-05-16-readmates-build-test-speed-spec.md §4.3
READMATES_TEST_FORKS: "2"
steps:
- name: Configure Git defaults
run: git config --global init.defaultBranch main
- name: Check out repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Java
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
distribution: temurin
java-version: 25
- name: Set up Gradle
uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0
- name: Server quality gates (ktlint + detekt + tests + JaCoCo + architecture)
run: ./scripts/server-ci-check.sh
- name: Upload server reports
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: server-reports
path: |
server/build/reports/detekt/
server/build/reports/jacoco/
server/build/reports/ktlint/
retention-days: 14
- name: Upload backend reports
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: backend-reports
path: |
server/build/reports/tests
server/build/test-results
if-no-files-found: ignore
backend-integration:
name: Backend Integration
runs-on: ubuntu-latest
# Spec §7.3 followup option 2: move Testcontainers-backed integration
# tests out of the `backend` critical path. This job runs in parallel
# with `backend` (and `e2e`), so PR wall-clock is max(backend,
# backend-integration, e2e) ≈ unchanged, but the metric job (C1
# backend) drops to unit + arch + detekt + jacoco only.
# Both jobs are required for PR green status — integration coverage
# is preserved (spec §A6).
steps:
- name: Configure Git defaults
run: git config --global init.defaultBranch main
- name: Check out repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Java
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
distribution: temurin
java-version: 25
- name: Set up Gradle
uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0
- name: Integration tests (Testcontainers; Docker required)
working-directory: server
run: ./gradlew integrationTest
- name: Upload integration test results
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: backend-integration-reports
path: |
server/build/reports/tests
server/build/test-results
if-no-files-found: ignore
e2e:
name: E2E (${{ matrix.shard }})
runs-on: ubuntu-latest
env:
READMATES_CI_MYSQL_ROOT_PASSWORD: ${{ secrets.READMATES_CI_MYSQL_ROOT_PASSWORD }}
READMATES_CI_MYSQL_USER: ${{ secrets.READMATES_CI_MYSQL_USER }}
READMATES_CI_MYSQL_PASSWORD: ${{ secrets.READMATES_CI_MYSQL_PASSWORD }}
services:
mysql:
image: mysql:8.4
env:
MYSQL_ROOT_PASSWORD: ${{ secrets.READMATES_CI_MYSQL_ROOT_PASSWORD }}
MYSQL_ROOT_HOST: "%"
MYSQL_USER: ${{ secrets.READMATES_CI_MYSQL_USER }}
MYSQL_PASSWORD: ${{ secrets.READMATES_CI_MYSQL_PASSWORD }}
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -p$MYSQL_ROOT_PASSWORD --silent"
--health-interval=10s
--health-timeout=5s
--health-retries=12
strategy:
matrix:
include:
- shard: "1/3"
artifact_shard: "1-of-3"
- shard: "2/3"
artifact_shard: "2-of-3"
- shard: "3/3"
artifact_shard: "3-of-3"
steps:
- name: Configure Git defaults
run: git config --global init.defaultBranch main
- name: Check out repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24
- name: Set up pnpm from packageManager
run: |
if command -v corepack >/dev/null 2>&1; then
corepack_cmd=(corepack)
else
corepack_cmd=(npx --yes corepack@0.35.0)
fi
"${corepack_cmd[@]}" enable
"${corepack_cmd[@]}" prepare "$(node -p "require('./package.json').packageManager")" --activate
"${corepack_cmd[@]}" pnpm --version
- name: Restore pnpm cache
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Set up Java
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
distribution: temurin
java-version: 25
- name: Set up Gradle
uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Install Playwright browsers
run: pnpm --dir front exec playwright install --with-deps chromium
- name: Grant E2E database privileges
env:
MYSQL_PWD: ${{ env.READMATES_CI_MYSQL_ROOT_PASSWORD }}
run: |
mysql --protocol=TCP -h 127.0.0.1 -P 3306 -u root --execute \
"grant all privileges on \`readmates_e2e_%\`.* to '${READMATES_CI_MYSQL_USER}'@'%';"
- name: Run E2E tests (shard ${{ matrix.shard }})
env:
READMATES_E2E_DB_USER: ${{ env.READMATES_CI_MYSQL_USER }}
READMATES_E2E_DB_PASSWORD: ${{ env.READMATES_CI_MYSQL_PASSWORD }}
run: pnpm --dir front exec playwright test --shard=${{ matrix.shard }}
- name: Upload E2E reports
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: e2e-${{ matrix.artifact_shard }}-reports
path: |
front/test-results
front/playwright-report
if-no-files-found: ignore