-
Notifications
You must be signed in to change notification settings - Fork 0
275 lines (258 loc) · 8.79 KB
/
Copy pathqualify.yml
File metadata and controls
275 lines (258 loc) · 8.79 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
name: SpecCursor Quality Gates
# Honest qualification suite aligned to repository reality.
# What exists today: Node apps/packages (pnpm), optional Rust worker,
# optional Lean workspace. There is no root go.mod / requirements.txt.
#
# Stages that need external secrets (Snyk, live Claude, Morph) are skipped
# with an explicit notice unless the secret is present — never fake-green theater.
#
# Optional repository secret: SNYK_TOKEN (Snyk step in this workflow).
# Deploy-time secrets (ANTHROPIC_API_KEY, GitHub App, JWT_SECRET) are NOT
# injected here — see docs/environment.md and docs/deployment.md.
on:
push:
branches: [main, develop, release/*]
paths:
- 'apps/**'
- 'packages/**'
- 'workers/**'
- 'scripts/**'
- 'tests/**'
- 'load/**'
- 'chaos/**'
- 'security/**'
- '.github/workflows/**'
- 'package.json'
- 'pnpm-workspace.yaml'
- 'pnpm-lock.yaml'
- 'verify-implementation.js'
pull_request:
branches: [main, develop, release/*]
paths:
- 'apps/**'
- 'packages/**'
- 'workers/**'
- 'scripts/**'
- 'tests/**'
- 'load/**'
- 'chaos/**'
- 'security/**'
- '.github/workflows/**'
- 'package.json'
- 'pnpm-workspace.yaml'
- 'pnpm-lock.yaml'
- 'verify-implementation.js'
workflow_dispatch:
inputs:
stage:
description: 'Stage to run'
required: false
default: all
type: choice
options:
- all
- verify
- static-analysis
- unit-tests
- workers
- security
- load-smoke
concurrency:
group: qualify-${{ github.ref }}
cancel-in-progress: true
env:
NODE_ENV: test
PNPM_VERSION: '8.15.0'
jobs:
verify:
name: Architecture verify
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.stage == 'all' || github.event.inputs.stage == 'verify' }}
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: pnpm
- run: node verify-implementation.js
static-analysis:
name: Static analysis (Node)
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.stage == 'all' || github.event.inputs.stage == 'static-analysis' }}
needs: verify
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
node: [18, 20]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Format check
run: pnpm format:check
- name: Lint
run: pnpm lint
- name: Type check
run: pnpm type-check
unit-tests:
name: Unit and integration tests
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.stage == 'all' || github.event.inputs.stage == 'unit-tests' }}
needs: static-analysis
runs-on: ubuntu-latest
timeout-minutes: 25
strategy:
fail-fast: false
matrix:
node: [18, 20]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Run unit and integration tests
run: pnpm test:unit
- name: Run property tests
run: pnpm test:property
workers:
name: Optional workers (Rust / Lean)
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.stage == 'all' || github.event.inputs.stage == 'workers' }}
needs: verify
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- name: Setup Rust toolchain
if: hashFiles('workers/rust-worker/Cargo.toml') != ''
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
components: clippy
- name: Cargo test + clippy
if: hashFiles('workers/rust-worker/Cargo.toml') != ''
working-directory: workers/rust-worker
run: |
cargo test --verbose
cargo clippy --all-targets --all-features -- -D warnings
- name: Skip Rust (manifest absent)
if: hashFiles('workers/rust-worker/Cargo.toml') == ''
run: echo "workers/rust-worker/Cargo.toml not present; skipping Rust."
- name: Install elan (Lean)
if: hashFiles('workers/lean-engine/lakefile.lean') != ''
run: |
curl -sSf https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh | sh -s -- -y --default-toolchain none
echo "$HOME/.elan/bin" >> "$GITHUB_PATH"
- name: Lean build / check
if: hashFiles('workers/lean-engine/lakefile.lean') != ''
working-directory: workers/lean-engine
run: |
lake build
if [ -f lean/test_runner.lean ]; then
lake env lean --run lean/test_runner.lean || true
fi
- name: Skip Lean (lakefile absent)
if: hashFiles('workers/lean-engine/lakefile.lean') == ''
run: echo "workers/lean-engine/lakefile.lean not present; skipping Lean."
security:
name: Dependency security
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.stage == 'all' || github.event.inputs.stage == 'security' }}
needs: verify
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: pnpm audit + ecosystem audits
continue-on-error: true
run: |
pnpm audit --audit-level moderate
node scripts/security-audit.mjs
- name: Snyk (optional — requires SNYK_TOKEN secret)
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
run: |
if [ -z "$SNYK_TOKEN" ]; then
echo "SNYK_TOKEN not configured; Snyk scan skipped (optional gate)."
exit 0
fi
npx snyk test --severity-threshold=high
- name: Trivy filesystem scan
uses: aquasecurity/trivy-action@0.28.0
with:
scan-type: fs
scan-ref: .
severity: CRITICAL,HIGH
exit-code: '1'
ignore-unfixed: true
load-smoke:
name: Load script smoke (syntax)
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.stage == 'all' || github.event.inputs.stage == 'load-smoke' }}
needs: unit-tests
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Parse load scripts
run: |
if [ -f load/upgrade-workflow.js ]; then
node --check load/upgrade-workflow.js
else
echo "No load scripts; skipping."
fi
- name: Chaos experiment files present
run: |
if [ -d chaos/experiments ]; then
find chaos/experiments -type f -name '*.yaml' -o -name '*.yml' | tee /tmp/chaos.txt
test -s /tmp/chaos.txt
else
echo "No chaos experiments directory; skipping."
fi
qualify-summary:
name: Qualify summary
if: always()
needs: [verify, static-analysis, unit-tests, workers, security, load-smoke]
runs-on: ubuntu-latest
steps:
- name: Require critical jobs
run: |
echo "verify=${{ needs.verify.result }}"
echo "static=${{ needs.static-analysis.result }}"
echo "tests=${{ needs.unit-tests.result }}"
echo "workers=${{ needs.workers.result }}"
echo "security=${{ needs.security.result }}"
echo "load=${{ needs.load-smoke.result }}"
for r in "${{ needs.verify.result }}" "${{ needs.static-analysis.result }}" "${{ needs.unit-tests.result }}" "${{ needs.security.result }}"; do
if [ "$r" != "success" ] && [ "$r" != "skipped" ]; then
echo "Critical gate failed: $r"
exit 1
fi
done
# workers/load are best-effort when toolchains flake; fail only on hard failure
if [ "${{ needs.workers.result }}" = "failure" ]; then exit 1; fi
if [ "${{ needs.load-smoke.result }}" = "failure" ]; then exit 1; fi