Repository navigation
Expand file tree
/
Copy pathtox.ini
More file actions
422 lines (366 loc) · 13.8 KB
/
Copy pathtox.ini
File metadata and controls
422 lines (366 loc) · 13.8 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
[tox]
requires = tox-uv
env_list = lint, unit, integration, ai, ui
# ── Quality gates ────────────────────────────────────────────────────
[testenv:lint]
description = Run prek (ruff, mypy, pydoclint, uv-lock)
skip_install = true
allowlist_externals = prek
commands = prek run --all-files {posargs}
pass_env =
SKIP
FORCE_COLOR
PY_COLORS
# ── Test suites ──────────────────────────────────────────────────────
[testenv:unit]
description = Unit tests with coverage (parallel via pytest-xdist)
extras = dev, gateway
commands =
pytest -n 2 --dist loadfile --cov=src/apme_engine --cov-report=term-missing --cov-fail-under=70 {posargs}
pass_env =
APME_TEST_DATABASE_URL
PYTEST_XDIST_WORKER
[testenv:integration]
description = Integration tests (requires OPA binary on PATH)
extras = dev, gateway
commands =
pytest -m integration tests/integration/test_daemon_pipeline.py -v --tb=long {posargs}
pass_env =
OPA_USE_PODMAN
APME_TEST_DATABASE_URL
APME_DATABASE_URL
[testenv:integration-local]
description = Run integration tests with a disposable local PostgreSQL container
skip_install = true
allowlist_externals = bash
pass_env =
APME_DATABASE_URL
APME_TEST_DATABASE_URL
APME_INTEGRATION_POSTGRES_CONTAINER
APME_POSTGRES_DB
APME_POSTGRES_IMAGE
APME_POSTGRES_PASSWORD
APME_POSTGRES_PORT
APME_POSTGRES_USER
OPA_USE_PODMAN
commands =
bash containers/ci/run-integration-with-postgres.sh {posargs}
[testenv:postgres-check]
description = Verify that the CI PostgreSQL service is reachable
skip_install = true
allowlist_externals = bash
commands = bash containers/ci/check-postgres.sh
[testenv:e2e]
description = End-to-end pod scan (rebuild, start pod, scan, assert violations)
skip_install = true
allowlist_externals = bash
pass_env =
APME_ABBENAY_HOST_PORT
APME_CACHE_HOST_PATH
XDG_CACHE_HOME
XDG_CONFIG_HOME
XDG_RUNTIME_DIR
commands = bash tests/integration/test_e2e.sh {posargs}
[testenv:ai]
description = AI extra tests (abbenay)
extras = dev, ai
commands =
python -c "import abbenay_grpc; print(abbenay_grpc.__name__)"
pytest tests/test_ai_escalation.py -v --tb=short {posargs}
[testenv:ui]
description = Playwright tests for the RHDH Local UI (requires tox up)
extras = dev, gateway
commands =
playwright install --with-deps chromium
pytest -m ui tests/test_ui_playwright.py -v --tb=long {posargs}
allowlist_externals = playwright
pass_env =
APME_UI_URL
APME_DATABASE_URL
APME_TEST_DATABASE_URL
APME_GATEWAY_*
[testenv:ui-native]
description = Legacy native UI browser checks (requires native UI + Gateway)
extras = dev, gateway
commands =
playwright install --with-deps chromium
pytest -m ui tests/test_native_ui_playwright.py -v --tb=long {posargs}
allowlist_externals = playwright
pass_env =
APME_NATIVE_UI_URL
APME_DATABASE_URL
APME_TEST_DATABASE_URL
APME_GATEWAY_*
[testenv:ui-workflow-pack]
description = Build/test the BUI host workflow and pack its release tarball
skip_install = true
allowlist_externals = npm
commands =
npm ci
npm run build
npm test -- {posargs}
npm pack ./frontend/packages/ui-workflow --pack-destination {env_tmp_dir}
python -c "import tarfile, pathlib, sys; d=pathlib.Path(sys.argv[1]); matches=sorted(d.glob('apme-ui-workflow-*.tgz')); sys.exit('no apme-ui-workflow-*.tgz in %s' % d) if not matches else None; tgz=matches[0]; tf=tarfile.open(tgz); names=set(tf.getnames()); tf.close(); need=set(('package/dist/index.js','package/dist/headless.js','package/dist/styles/workflow.css')); missing=sorted(need - names); sys.exit(('missing in tarball: %s' % missing) if missing else 0)" {env_tmp_dir}
[testenv:frontend-install]
description = Install the standalone Backstage workspace (no Portal/AAP checkout)
skip_install = true
allowlist_externals = npm
commands = npm install {posargs}
[testenv:frontend-ci]
description = Reproducibly install the standard UI workspace
skip_install = true
allowlist_externals = npm
commands = npm ci
[testenv:frontend-native-install]
description = Refresh the transitional native workspace lockfile
skip_install = true
allowlist_externals = npm
changedir = frontend
commands = npm install {posargs}
[testenv:frontend-native-ci]
description = Reproducibly install the native frontend workspace (frontend lockfile)
skip_install = true
allowlist_externals = npm
changedir = frontend
commands = npm ci --legacy-peer-deps
[testenv:frontend-build]
description = Build independently distributable client/workflow/Backstage packages
skip_install = true
allowlist_externals = npm
commands = npm run build {posargs}
[testenv:frontend-native-build]
description = Type-check and build the transitional native UI without running tests
skip_install = true
allowlist_externals = npm
changedir = frontend
commands = npm run build
[testenv:frontend-lint]
description = Lint, type-check, and format-check first-party UI TypeScript
skip_install = true
allowlist_externals = npm
commands =
npm run lint:ui
npm run typecheck
npm run format:check
[testenv:frontend-unit]
description = Client/host transport, workflow and package boundary regression tests
skip_install = true
allowlist_externals = npm
commands = npm test -- {posargs}
[testenv:frontend-audit]
description = Report npm dependency advisories (use -- --omit=dev for production dependencies)
skip_install = true
allowlist_externals = npm
commands = npm audit {posargs}
[testenv:portal-sdk-install]
description = Install the pinned Portal SDK without bulk install scripts, then build its test SQLite driver
skip_install = true
allowlist_externals = node, npm
pass_env = APME_PORTAL_CHECKOUT
changedir = {env:APME_PORTAL_CHECKOUT:{toxinidir}/../ansible-backstage-plugins}
set_env = YARN_ENABLE_SCRIPTS = false
commands =
node .yarn/releases/yarn-4.12.0.cjs install --immutable
npm rebuild better-sqlite3 --ignore-scripts=false
[testenv:portal-build]
description = Build APME-owned Portal adapters against an installed host SDK checkout
skip_install = true
allowlist_externals = npm, node
pass_env = APME_PORTAL_CHECKOUT
commands =
npm run build
node frontend/portal/scripts/build.mjs {posargs}
[testenv:portal-pack]
description = Build and pack standalone packages plus Portal-specific integration adapters
skip_install = true
allowlist_externals = npm, node
pass_env = APME_PORTAL_CHECKOUT
commands =
npm run build
node frontend/portal/scripts/build.mjs
node frontend/backstage/scripts/pack.mjs --with-portal {posargs}
[testenv:portal-pack-smoke]
description = Install and bundle packed Portal adapters outside both source workspaces
skip_install = true
allowlist_externals = npm, node
pass_env = APME_PORTAL_CHECKOUT
commands =
npm run build
node frontend/portal/scripts/build.mjs
node frontend/backstage/scripts/pack.mjs --with-portal --local --version 0.0.0-portal --output dist/portal-packages
node frontend/portal/scripts/verify.mjs {posargs}
[testenv:portal-adoption]
description = Prepare a reviewable Portal artifact-adoption patch without changing the host checkout
skip_install = true
allowlist_externals = node
pass_env = APME_PORTAL_CHECKOUT
commands = node frontend/portal/scripts/prepare-adoption.mjs {posargs}
[testenv:portal-unit]
description = Run Portal backend/common regressions; pass --frontend for UI regressions
skip_install = true
allowlist_externals = node
pass_env = APME_PORTAL_CHECKOUT
commands = node frontend/portal/scripts/test.mjs {posargs}
[testenv:frontend-release-upload]
description = Upload release assets with checksum-verified retries that preserve published bytes
skip_install = true
allowlist_externals = node
pass_env = GH_TOKEN, GITHUB_TOKEN, GH_HOST, GH_REPO
commands = node frontend/backstage/scripts/upload-release.mjs {posargs}
[testenv:frontend-pack]
description = Pack immutable UI packages and verify standalone dependency closure
skip_install = true
allowlist_externals = npm
commands =
npm run build
npm run pack -- {posargs}
[testenv:frontend-pack-smoke]
description = Clean install and bundle packed packages outside the checkout
skip_install = true
allowlist_externals = npm
commands =
npm run build
npm run pack -- --local
npm run pack:verify
[testenv:frontend-release-verify]
description = Verify release package manifests, checksums and dependency URLs
skip_install = true
allowlist_externals = npm
commands = npm run pack:verify:release -- {posargs}
[testenv:frontend-release-pack-smoke]
description = Build release-mode artifacts and verify their manifests and checksums
skip_install = true
allowlist_externals = npm
commands =
npm run build
npm run pack -- --version 0.0.0
npm run pack:verify:release -- --version 0.0.0
[testenv:frontend-dev]
description = Start the Backstage development harness against a local Gateway
skip_install = true
allowlist_externals = npm
commands = npm run dev -- {posargs}
[testenv:frontend-dev-build]
description = Build the Backstage development harness
skip_install = true
allowlist_externals = npm
commands = npm run build:dev
[testenv:frontend-rhdh-export]
description = Build checkout packages and export self-contained RHDH dynamic plugins
skip_install = true
allowlist_externals = npm, node
commands =
npm run build
node frontend/backstage/scripts/build-rhdh.mjs
[testenv:build-ui]
description = Build the RHDH Local image including checkout frontend/backend plugins
skip_install = true
allowlist_externals = podman
commands = podman build -t apme-ui:latest -f containers/rhdh/Dockerfile {posargs} .
[testenv:frontend-format]
description = Format the Backstage workspace
skip_install = true
allowlist_externals = npm
commands = npm run format
# ── Code generation ──────────────────────────────────────────────────
[testenv:openapi]
description = Export or check Gateway OpenAPI v1 artifact (docs/api/openapi.v1.json)
extras = gateway
commands = python scripts/export_openapi.py {posargs}
[testenv:grpc]
description = Regenerate gRPC stubs from proto files
skip_install = true
deps = grpcio-tools==1.84.0
allowlist_externals = bash
commands = bash scripts/gen_grpc.sh
# ── Developer tools ──────────────────────────────────────────────────
[testenv:graph]
description = Generate interactive ContentGraph HTML visualization
extras = dev
commands = python tools/visualize_graph.py {posargs}
# ── Pod lifecycle ────────────────────────────────────────────────────
[testenv:build-base]
description = Build the shared base Dockerfile locally without publishing
skip_install = true
allowlist_externals = docker
commands = docker buildx build --file containers/base/Dockerfile {posargs} .
[testenv:build]
description = Build all container images (podman)
skip_install = true
allowlist_externals = bash
commands = bash containers/podman/build.sh {posargs}
[testenv:release-supply-chain]
description = Generate local Python wheel SBOM (syft installed on demand)
skip_install = true
allowlist_externals = bash
commands = bash containers/ci/generate-python-sbom.sh --output-dir dist/sbom {posargs}
[testenv:up]
description = Build images and start the APME pod
skip_install = true
allowlist_externals = bash
pass_env =
APME_ABBENAY_HOST_PORT
XDG_CONFIG_HOME
commands =
bash containers/podman/build.sh {posargs}
bash containers/podman/up.sh
[testenv:down]
description = Stop the APME pod
skip_install = true
allowlist_externals = bash
commands = bash containers/podman/down.sh
[testenv:wipe]
description = Stop the APME pod and delete DB + session cache
skip_install = true
allowlist_externals = bash
commands = bash containers/podman/down.sh --wipe
[testenv:build-clean]
description = Wipe state and rebuild all images from scratch
skip_install = true
allowlist_externals = bash
commands =
bash containers/podman/down.sh --wipe
bash containers/podman/build.sh --no-cache
[testenv:up-clean]
description = Wipe state, rebuild from scratch, and start
skip_install = true
allowlist_externals = bash
pass_env =
APME_ABBENAY_HOST_PORT
XDG_CONFIG_HOME
commands =
bash containers/podman/down.sh --wipe
bash containers/podman/build.sh --no-cache
bash containers/podman/up.sh
[testenv:cli]
description = Run CLI in the pod (pass args via posargs)
skip_install = true
allowlist_externals = bash
commands = bash containers/podman/run-cli.sh {posargs}
# ── Product demo ─────────────────────────────────────────────────────
[testenv:pm]
description = Build, start, and open the UI (for product managers)
skip_install = true
allowlist_externals = bash, python
pass_env =
APME_ABBENAY_HOST_PORT
XDG_CONFIG_HOME
commands =
bash containers/podman/build.sh
bash containers/podman/up.sh
bash containers/podman/wait-for-pod.sh --health-check
python -m webbrowser http://localhost:8081
[testenv:ui-workflow-browser]
description = Chromium smoke for the shared BUI dev harness; the test serves the build when no URL is set (host acceptance in #833)
extras = dev, gateway
commands =
playwright install --with-deps chromium
pytest -m ui tests/test_workflow_ui_playwright.py --browser chromium -v --tb=long {posargs}
allowlist_externals = playwright
pass_env =
APME_WORKFLOW_UI_URL
[testenv:git-fetch-quota]
description = Required kernel quota tests for production Git snapshot fetches
extras = dev, gateway
set_env = APME_REQUIRE_GIT_QUOTA_TESTS=1
commands = pytest -q tests/test_safe_git_fetch_quota.py