Repository navigation
321 lines (268 loc) · 10.2 KB
/
Copy pathci.yml
File metadata and controls
321 lines (268 loc) · 10.2 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
# The release runs this same gate on the commit it releases.
workflow_call:
permissions:
contents: read
# nx-set-shas reads previous workflow runs to find the last green main commit
actions: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false
- uses: ./.github/actions/setup
- uses: nrwl/nx-set-shas@v4
- name: Check formatting
run: pnpm format:check
- name: Lint (no new oxlint warnings)
run: pnpm lint
- name: Validate agent skills and roles
run: pnpm skills:check
- name: Type-check
run: pnpm typecheck
- name: Test and build affected projects
run: pnpm exec nx affected -t test build
- name: Test devtools package
run: pnpm test:devtools
- name: Test devtools panel
run: pnpm test:panel
- name: Build Chrome extension
run: pnpm extension:build
- name: Check committed build output is current
run: |
stale=$(git status --porcelain -- extension/ui)
if [ -n "$stale" ]; then
echo "$stale"
echo "::error::Committed build output is stale. Run 'pnpm extension:build' and commit the result."
exit 1
fi
# The zip step of `pnpm extension:zip`, on the bundle built above. Without
# PANGULAR_EXTENSION_KEY it holds no key.pem, so the artifact is only for loading and
# checking by hand: nothing here uploads it to the Chrome Web Store.
- name: Zip the Chrome extension
run: node scripts/extension-zip.mjs
- name: Keep the extension zip
uses: actions/upload-artifact@v4
with:
name: chrome-extension
path: dist/pangular-inspector-extension.zip
if-no-files-found: error
retention-days: 14
- name: Smoke-test the CLI
run: node bin.mjs --help
node-22:
name: Package tests on Node.js 22
# `engines.node` allows 22.12 and later, while the build job runs the `.nvmrc` version.
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: ./.github/actions/setup
with:
node-version: 22
- name: Test devtools package
run: pnpm test:devtools
coverage:
name: Test coverage
# A report to read, not a gate: there is no threshold, and the build job is what fails a pull
# request on a broken test. v8 instrumentation slows every test, so the run gives each one
# 20 seconds instead of the default 5, which the slowest agent-tool tests went over.
runs-on: ubuntu-latest
timeout-minutes: 25
continue-on-error: true
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: ./.github/actions/setup
- name: Package tests with coverage
run: pnpm test:devtools --coverage --testTimeout=20000
- name: Panel tests with coverage
if: ${{ !cancelled() }}
run: pnpm test:panel --coverage --testTimeout=20000
# HTML under devtools/ and panel/, plus coverage-summary.json and lcov.info for each.
- name: Keep the coverage report
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: coverage
path: dist/coverage
if-no-files-found: ignore
retention-days: 14
windows:
name: Package tests on Windows
# The CLI, the hub and the source scans run on developers' Windows machines too, where paths
# use `\` and a drive letter.
runs-on: windows-latest
timeout-minutes: 30
defaults:
run:
shell: bash
env:
# pnpm runs package scripts with cmd.exe on Windows, and the root `prepare` script is
# written for a POSIX shell. Git Bash, not the WSL `bash` that comes first on PATH.
npm_config_script_shell: C:\Program Files\Git\bin\bash.exe
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: ./.github/actions/setup
- name: Test devtools package
run: pnpm test:devtools
axe:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: ./.github/actions/setup
- name: Install Chromium
run: pnpm exec playwright install --with-deps chromium
- name: Check the panel with axe
run: pnpm test:axe
# The committed extension/ui in extension/panel.html, reading the report test:axe wrote,
# and every status the panel bridge shows before it connects.
- name: Check the extension panel with axe
if: ${{ !cancelled() }}
run: pnpm test:axe:extension
# The e2e jobs below are slow, so they run only when the package, the panel, the SSR demo, the
# tools docs (e2e:mcp reads them) or the scripts and fixtures they use change. The engines-floor
# job runs only when what the packed package is built from changes. A diff that cannot be
# computed (a new branch, a force push) runs them all.
changes:
name: Changed paths
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
e2e: ${{ steps.diff.outputs.e2e }}
package: ${{ steps.diff.outputs.package }}
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false
- id: diff
env:
BASE: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
run: |
paths=(packages/devtools app e2e src apps/docs/src/content/agents angular.json package.json
scripts/e2e-security.mjs scripts/e2e-mcp.mjs pnpm-lock.yaml .github/workflows/ci.yml)
if git diff --quiet "$BASE" HEAD -- "${paths[@]}"; then
echo "e2e=false" >> "$GITHUB_OUTPUT"
else
echo "e2e=true" >> "$GITHUB_OUTPUT"
fi
# What the packed package is built from: the package, the panel it bundles and the toolchain.
packed=(packages/devtools app package.json pnpm-lock.yaml pnpm-workspace.yaml .nvmrc
.github/actions/setup .github/workflows/ci.yml)
if git diff --quiet "$BASE" HEAD -- "${packed[@]}"; then
echo "package=false" >> "$GITHUB_OUTPUT"
else
echo "package=true" >> "$GITHUB_OUTPUT"
fi
# The source tests can't run on 22.12 (Node runs .ts files only from 22.18, and the build tools
# need newer versions), so this job checks the packed package there instead.
engines-floor:
name: Packed package on Node.js 22.12
needs: changes
if: needs.changes.outputs.package == 'true'
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: ./.github/actions/setup
# `prepack` builds the library and the panel first, on the `.nvmrc` version.
- name: Pack the package
run: pnpm --filter @pangular-inspector/devtools pack --pack-destination "$RUNNER_TEMP/pack"
# The engines floor: the lowest version `engines.node` in packages/devtools/package.json allows.
# Keep the two in step.
- uses: actions/setup-node@v7
with:
node-version: 22.12.0
- name: Install the tarball into an empty project
working-directory: ${{ runner.temp }}
run: |
mkdir floor
cd floor
npm init -y > /dev/null
npm install --no-audit --no-fund "$RUNNER_TEMP"/pack/*.tgz
# The Node.js entry points from `exports` in packages/devtools/package.json. The browser
# entries (overlay, popup and the hooks) need a DOM. `http` is left out too: it imports
# the optional Angular peers, which load in plain Node.js only with `@angular/compiler`
# (JIT), and the app's build bundles it.
- name: Run the CLI and load the entry points
working-directory: ${{ runner.temp }}/floor
run: |
node --version
npx pangular --version
for entry in '' /devframe /config /cli /hub /ssr /vite; do
node -e "import('@pangular-inspector/devtools$entry')"
done
node -e "require('@pangular-inspector/devtools/hub')"
e2e-security:
name: Security e2e
needs: changes
if: needs.changes.outputs.e2e == 'true'
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: ./.github/actions/setup
# Playwright's own Chromium, as the axe job installs it.
- name: Install Chromium
run: pnpm exec playwright install --with-deps chromium
- name: Build the package
run: pnpm devtools:build-pkg
# Leak corpus, access gates and a production build, on ports 5231 to 5236.
- name: Check redaction and access
run: pnpm e2e:security
- name: Keep the captured channels
if: failure()
uses: actions/upload-artifact@v4
with:
name: e2e-security
path: dist/e2e-security
if-no-files-found: ignore
e2e-mcp:
name: MCP e2e
needs: changes
if: needs.changes.outputs.e2e == 'true'
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: ./.github/actions/setup
- name: Install Chromium
run: pnpm exec playwright install --with-deps chromium
# Builds the package and the SSR demo itself, then serves the demo on port 5150 (the variant
# hubs on 5151 to 5154) and checks every tool, resource and prompt, and agents/tools.md.
- name: Check the agent surface
run: pnpm e2e:mcp --report dist/e2e-mcp/report.json
- name: Keep the report
if: always()
uses: actions/upload-artifact@v4
with:
name: e2e-mcp
path: dist/e2e-mcp
if-no-files-found: ignore