forked from gsd-build/gsd-2
-
Notifications
You must be signed in to change notification settings - Fork 0
251 lines (209 loc) · 6.98 KB
/
ci.yml
File metadata and controls
251 lines (209 loc) · 6.98 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
# CI workflow — builds, tests, and gates merges to main
name: CI
on:
push:
branches: [main]
paths-ignore:
- '.github/workflows/ai-triage.yml'
- '.github/workflows/build-native.yml'
- '.github/workflows/cleanup-dev-versions.yml'
- '.github/workflows/pipeline.yml'
- 'LICENSE'
pull_request:
branches: [main]
paths-ignore:
- '.github/workflows/ai-triage.yml'
- '.github/workflows/build-native.yml'
- '.github/workflows/cleanup-dev-versions.yml'
- '.github/workflows/pipeline.yml'
- 'LICENSE'
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
detect-changes:
timeout-minutes: 2
runs-on: blacksmith-4vcpu-ubuntu-2404
outputs:
docs-only: ${{ steps.check.outputs.docs-only }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check if only documentation changed
id: check
env:
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
PUSH_BEFORE_SHA: ${{ github.event.before }}
EVENT_NAME: ${{ github.event_name }}
HEAD_SHA: ${{ github.sha }}
run: |
if [ "$EVENT_NAME" = "pull_request" ]; then
BASE="$PR_BASE_SHA"
else
BASE="$PUSH_BEFORE_SHA"
fi
FILES=$(git diff --name-only "$BASE" "$HEAD_SHA" 2>/dev/null || git diff --name-only HEAD~1)
echo "Changed files:"
echo "$FILES"
NON_DOCS=$(echo "$FILES" | grep -vE '\.(md|markdown)$' | grep -vE '^docs/' | grep -vE '^LICENSE$' || true)
if [ -z "$NON_DOCS" ]; then
echo "docs-only=true" >> "$GITHUB_OUTPUT"
echo "::notice::Only documentation files changed — skipping build/test"
else
echo "docs-only=false" >> "$GITHUB_OUTPUT"
echo "Non-docs files changed:"
echo "$NON_DOCS"
fi
docs-check:
timeout-minutes: 5
runs-on: blacksmith-4vcpu-ubuntu-2404
needs: detect-changes
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Scan documentation for prompt injection
run: bash scripts/docs-prompt-injection-scan.sh --diff origin/main
lint:
timeout-minutes: 5
needs: detect-changes
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 2
- name: Scan for hardcoded secrets
run: bash scripts/secret-scan.sh --diff origin/main
- name: Scan for base64-encoded secrets
run: bash scripts/base64-scan.sh --diff origin/main
- name: Ensure .wtf/ is not checked in
run: |
if [ -d ".wtf" ]; then
echo "::error::.wtf/ directory must not be checked in"
exit 1
fi
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '24'
- name: Validate skill references
run: node scripts/check-skill-references.mjs
- name: Require tests with source changes
if: github.event_name == 'pull_request'
env:
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
run: bash scripts/require-tests.sh
build:
timeout-minutes: 15
needs: detect-changes
if: needs.detect-changes.outputs.docs-only != 'true'
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '24'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Install web host dependencies
run: npm --prefix web ci
- name: Build
run: npm run build
- name: Build web host
run: npm run build:web-host
- name: Typecheck extensions
run: npm run typecheck:extensions
- name: Validate package is installable
run: npm run validate-pack
- name: Run unit tests
run: npm run test:unit
- name: Run package tests
run: npm run test:packages
- name: Run integration tests
run: npm run test:integration
- name: Check test coverage thresholds
run: npm run test:coverage
windows-portability:
timeout-minutes: 15
needs: detect-changes
if: >-
needs.detect-changes.outputs.docs-only != 'true'
runs-on: blacksmith-4vcpu-windows-2025
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '24'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Typecheck extensions
run: npm run typecheck:extensions
- name: Run unit tests
run: npm run test:unit
- name: Run package tests
run: npm run test:packages
rtk-portability:
timeout-minutes: 20
needs: detect-changes
if: needs.detect-changes.outputs.docs-only != 'true'
strategy:
fail-fast: false
matrix:
include:
- label: linux
os: blacksmith-4vcpu-ubuntu-2404
- label: windows
os: blacksmith-4vcpu-windows-2025
- label: macos
os: macos-15
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '24'
cache: 'npm'
- name: Install dependencies
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'
run: npm ci
- name: Validate managed RTK install
run: >-
node --experimental-strip-types --input-type=module -e
"const mod = await import('./src/rtk.ts');
const path = mod.getManagedRtkPath(process.platform);
if (!mod.validateRtkBinary(path)) {
console.error('Managed RTK validation failed:', path);
process.exit(1);
}
console.log('Managed RTK validated at', path);"
- name: Run RTK-focused portability tests
run: >-
node --import ./src/resources/extensions/gsd/tests/resolve-ts.mjs
--experimental-strip-types --experimental-test-isolation=process --test
src/tests/rtk.test.ts
src/tests/rtk-execution-seams.test.ts
src/tests/postinstall.test.ts
src/tests/app-smoke.test.ts
src/resources/extensions/gsd/tests/custom-verification.test.ts
src/resources/extensions/gsd/tests/verification-gate.test.ts
- name: Generate RTK benchmark evidence
if: matrix.label == 'linux'
run: node scripts/rtk-benchmark.mjs --output .artifacts/rtk-benchmark.md
- name: Upload RTK benchmark artifact
if: matrix.label == 'linux'
uses: actions/upload-artifact@v4
with:
name: rtk-benchmark-linux
path: .artifacts/rtk-benchmark.md