-
Notifications
You must be signed in to change notification settings - Fork 2
448 lines (431 loc) · 14.7 KB
/
ci.yml
File metadata and controls
448 lines (431 loc) · 14.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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
jobs:
dependency-review:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/dependency-review-action@2031cfc080254a8a887f58cffee85186f0e49e48 # v4.9.0
actionlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: rhysd/actionlint@393031adb9afb225ee52ae2ccd7a5af5525e03e8 # v1.7.11
gemini-manifest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 22
- name: Validate Gemini extension manifest
run: node scripts/check_gemini_extension_manifest.mjs
workspace-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 20
cache: npm
- name: Install dependencies (npm ci with retry)
run: |
for attempt in 1 2 3; do
echo "npm ci attempt ${attempt}/3"
if npm ci; then
exit 0
fi
if [ "$attempt" -lt 3 ]; then
sleep $((attempt * 20))
fi
done
echo "npm ci failed after 3 attempts"
exit 1
- name: Build workspaces
run: npm run build
- name: Lint/typecheck workspaces
run: npm run lint:workspaces
spec-coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 20
cache: npm
- name: Install dependencies (npm ci with retry)
run: |
for attempt in 1 2 3; do
echo "npm ci attempt ${attempt}/3"
if npm ci; then
exit 0
fi
if [ "$attempt" -lt 3 ]; then
sleep $((attempt * 20))
fi
done
echo "npm ci failed after 3 attempts"
exit 1
- name: Validate OpenSpec traceability coverage
run: npm run check:spec-coverage
site-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 20
cache: npm
- name: Install dependencies (npm ci with retry)
run: |
for attempt in 1 2 3; do
echo "npm ci attempt ${attempt}/3"
if npm ci; then
exit 0
fi
if [ "$attempt" -lt 3 ]; then
sleep $((attempt * 20))
fi
done
echo "npm ci failed after 3 attempts"
exit 1
- name: Install site dependencies
run: npm --prefix site ci
- name: Build site and validate internal links
run: npm run check:site
tool-docs-freshness:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 20
cache: npm
- name: Install dependencies (npm ci with retry)
run: |
for attempt in 1 2 3; do
echo "npm ci attempt ${attempt}/3"
if npm ci; then
exit 0
fi
if [ "$attempt" -lt 3 ]; then
sleep $((attempt * 20))
fi
done
echo "npm ci failed after 3 attempts"
exit 1
- name: Regenerate and verify tool reference docs are committed
run: npm run check:tool-docs
mcpb-manifest-contract:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 20
cache: npm
- name: Install dependencies (npm ci with retry)
run: |
for attempt in 1 2 3; do
echo "npm ci attempt ${attempt}/3"
if npm ci; then
exit 0
fi
if [ "$attempt" -lt 3 ]; then
sleep $((attempt * 20))
fi
done
echo "npm ci failed after 3 attempts"
exit 1
- name: Validate MCPB manifest/tool contract
run: npm run check:mcpb-manifest
allure-labels:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 20
cache: npm
- name: Install dependencies (npm ci with retry)
run: |
for attempt in 1 2 3; do
echo "npm ci attempt ${attempt}/3"
if npm ci; then
exit 0
fi
if [ "$attempt" -lt 3 ]; then
sleep $((attempt * 20))
fi
done
echo "npm ci failed after 3 attempts"
exit 1
- name: Validate Allure hierarchy labels
run: npm run check:allure-labels
- name: Enforce Allure filename migration policy
run: npm run check:allure-filenames
allure-quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 20
cache: npm
- name: Install dependencies (npm ci with retry)
run: |
for attempt in 1 2 3; do
echo "npm ci attempt ${attempt}/3"
if npm ci; then
exit 0
fi
if [ "$attempt" -lt 3 ]; then
sleep $((attempt * 20))
fi
done
echo "npm ci failed after 3 attempts"
exit 1
- name: Validate Allure quality conventions
run: npm run check:allure-quality
codeql:
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Initialize CodeQL
uses: github/codeql-action/init@5c8a8a642e79153f5d047b10ec1cba1d1cc65699 # v3
with:
languages: javascript-typescript
config-file: ./.github/codeql/codeql-config.yml
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 20
cache: npm
- name: Install dependencies (npm ci with retry)
run: |
for attempt in 1 2 3; do
echo "npm ci attempt ${attempt}/3"
if npm ci; then
exit 0
fi
if [ "$attempt" -lt 3 ]; then
sleep $((attempt * 20))
fi
done
echo "npm ci failed after 3 attempts"
exit 1
- name: Build workspaces
run: npm run build
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@5c8a8a642e79153f5d047b10ec1cba1d1cc65699 # v3
semgrep:
uses: ./.github/workflows/semgrep.yml
permissions:
actions: read
contents: read
security-events: write
workspace-test:
runs-on: ubuntu-latest
needs: workspace-lint
permissions:
contents: read
id-token: write
strategy:
matrix:
node-version: [20, 22]
include:
- node-version: 20
coverage: true
- node-version: 22
coverage: false
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Install dependencies (npm ci with retry)
run: |
for attempt in 1 2 3; do
echo "npm ci attempt ${attempt}/3"
if npm ci; then
exit 0
fi
if [ "$attempt" -lt 3 ]; then
sleep $((attempt * 20))
fi
done
echo "npm ci failed after 3 attempts"
exit 1
- name: Build workspaces
run: npm run build
- name: Isolated package runtime smoke test
if: matrix.coverage
run: |
pack_dir="$(mktemp -d)"
run_dir="$(mktemp -d)"
core_tgz="$(cd packages/docx-core && npm pack --silent --pack-destination "$pack_dir")"
mcp_tgz="$(cd packages/docx-mcp && npm pack --silent --pack-destination "$pack_dir")"
safe_tgz="$(cd packages/safe-docx && npm pack --silent --pack-destination "$pack_dir")"
pushd "$run_dir"
npm init -y >/dev/null
for attempt in 1 2 3; do
echo "runtime smoke attempt ${attempt}/3"
rm -rf node_modules package-lock.json
if npm install --no-audit --no-fund "$pack_dir/$core_tgz" "$pack_dir/$mcp_tgz" "$pack_dir/$safe_tgz" >/dev/null \
&& ./node_modules/.bin/safe-docx --help; then
popd
rm -rf "$pack_dir" "$run_dir"
exit 0
fi
if [ "$attempt" -lt 3 ]; then
sleep $((attempt * 20))
fi
done
popd
rm -rf "$pack_dir" "$run_dir"
echo "runtime smoke failed after 3 attempts"
exit 1
- name: Test workspaces (with coverage)
if: matrix.coverage
run: |
npm run test:coverage -w @usejunior/docx-core
npm run test:coverage -w @usejunior/docx-mcp
npm run test:run -w @usejunior/safe-docx
npm run test:run -w @usejunior/safedocx-mcpb
- name: Test workspaces
if: ${{ !matrix.coverage }}
run: npm run test
- name: Generate package coverage dashboard + enforce ratchet
if: matrix.coverage
run: |
mkdir -p coverage
npm run coverage:packages:check > coverage/package-coverage-table.txt
cat coverage/package-coverage-table.txt
- name: Upload package coverage artifacts
if: ${{ matrix.coverage && always() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: package-coverage
if-no-files-found: error
path: |
coverage/package-coverage-baseline.json
coverage/package-coverage-summary.json
coverage/package-coverage-table.txt
packages/docx-core/coverage/coverage-summary.json
packages/docx-mcp/coverage/coverage-summary.json
packages/docx-core/coverage/lcov.info
packages/docx-mcp/coverage/lcov.info
- name: Upload coverage to Codecov
if: ${{ matrix.coverage && !cancelled() }}
continue-on-error: true
uses: codecov/codecov-action@75cd11691c0faa626561e295848008c8a7dddffe # v5
with:
files: ./packages/docx-core/coverage/lcov.info,./packages/docx-mcp/coverage/lcov.info
disable_search: true
use_oidc: true
fail_ci_if_error: false
verbose: true
- name: Upload allure results
if: matrix.coverage
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: allure-results
if-no-files-found: error
path: |
packages/docx-core/allure-results/
packages/docx-mcp/allure-results/
mcpb-bundle:
runs-on: ubuntu-latest
needs: workspace-test
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 20
cache: npm
- name: Install dependencies (npm ci with retry)
run: |
for attempt in 1 2 3; do
echo "npm ci attempt ${attempt}/3"
if npm ci; then
exit 0
fi
if [ "$attempt" -lt 3 ]; then
sleep $((attempt * 20))
fi
done
echo "npm ci failed after 3 attempts"
exit 1
- name: Sanitize npm auth for public npx fetches
run: |
unset NODE_AUTH_TOKEN
npm config delete //registry.npmjs.org/:_authToken || true
- name: Build and pack safe-docx MCP bundle
run: npm run pack:mcpb
- name: Upload MCPB bundle artifact (main only)
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: safe-docx-mcpb
if-no-files-found: error
path: packages/safe-docx-mcpb/safe-docx.mcpb
deploy-allure:
if: github.ref == 'refs/heads/main'
needs: workspace-test
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
concurrency:
group: pages
cancel-in-progress: true
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 20
cache: npm
- name: Install dependencies (npm ci with retry)
run: |
for attempt in 1 2 3; do
echo "npm ci attempt ${attempt}/3"
if npm ci; then
exit 0
fi
if [ "$attempt" -lt 3 ]; then
sleep $((attempt * 20))
fi
done
echo "npm ci failed after 3 attempts"
exit 1
- name: Download allure results
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: allure-results
path: packages
- name: Generate Allure report
run: npm run allure:generate
- name: Brand Allure report
run: npm run allure:brand
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3
with:
path: allure-report-repo
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4