-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
129 lines (104 loc) · 4.77 KB
/
Copy pathMakefile
File metadata and controls
129 lines (104 loc) · 4.77 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
# One entrypoint for the test environment — see docs/test-environment-automation.md.
#
# CI does not call these targets yet: it runs its own step list against a
# Postgres service container rather than this compose stack. Converging the two
# is Phase 2. Until then `test-all` deliberately mirrors CI's step order, so
# drift between them is at least visible.
#
# Typical loop:
# make doctor # can this machine run the suite at all?
# make up # ephemeral Postgres on a discovered port, writes .env.test
# make test # full suite, e2e tier enforced (not silently skipped)
# make down # tear down, then assert nothing leaked
SHELL := /usr/bin/env bash
ENV_FILE := .env.test
# Load .env.test into the recipe's environment. Recipes run one shell per line,
# so this has to be inlined into each command rather than set once at the top.
LOAD_ENV = set -a; . ./$(ENV_FILE); set +a;
REQUIRE_ENV = @test -f $(ENV_FILE) || { \
echo "no $(ENV_FILE) — run 'make up' first (or 'bash scripts/dev/env.sh <DSN>')"; \
exit 1; }
.DEFAULT_GOAL := help
.PHONY: help bootstrap doctor env-status clean-check up down down-all nuke deps test test-unit test-all conformance acceptance acceptance-ui browser browser-deps web cli adapters bench
help: ## Show this help
@echo "ADP test environment"
@echo
@grep -hE '^[a-z-]+:.*?## ' $(MAKEFILE_LIST) \
| awk 'BEGIN{FS=":.*?## "}{printf " \033[1m%-14s\033[0m %s\n", $$1, $$2}'
@echo
bootstrap: ## Provision a bare Debian/Ubuntu machine to run the suite (needs root/sudo)
@bash scripts/dev/bootstrap.sh
doctor: ## Preflight: is this machine able to run the suite?
@bash scripts/dev/doctor.sh
env-status: ## Report the health of the adp-dev environment
@bash scripts/dev/env-status.sh $(ARGS)
clean-check: ## Assert no state leaked from a previous run
@bash scripts/dev/verify-clean.sh
up: ## Bring up the ephemeral dependency stack, write .env.test
@bash scripts/dev/up.sh
down: ## Tear down this checkout's stack and verify it is gone
@bash scripts/dev/down.sh
down-all: ## Tear down every adp-test-* stack on this machine
@bash scripts/dev/down.sh --all
deps: ## Install node dependencies (server, web, cli, and adapters)
npm ci --prefix server
npm ci --prefix server/web
npm ci --prefix cli
npm ci --prefix adapters
test-unit: ## Unit + integration tiers only (no database needed)
npm test --prefix server
test: ## Full suite with the e2e tier enforced (needs 'make up')
$(REQUIRE_ENV)
@$(LOAD_ENV) npm run typecheck --prefix server
@$(LOAD_ENV) npm test --prefix server
conformance: ## The gh gate: real, unmodified gh against a live server
$(REQUIRE_ENV)
@$(LOAD_ENV) bash server/conformance/run.sh
acceptance: ## The §2.1 definition-of-done walkthrough (docs/manual-test-plan.md)
$(REQUIRE_ENV)
@$(LOAD_ENV) bash server/acceptance/run.sh
acceptance-ui: ## ...including the web UI, driven by a real browser
$(REQUIRE_ENV)
@$(MAKE) web
@$(MAKE) browser
@$(LOAD_ENV) ADP_ACCEPTANCE_UI=1 bash server/acceptance/run.sh
browser: ## Download the pinned Chromium build Playwright drives
@if [ -x "$${ADP_CHROMIUM_PATH:-}" ]; then \
echo "using ADP_CHROMIUM_PATH=$$ADP_CHROMIUM_PATH — skipping the pinned download"; \
else \
npx --prefix server playwright install chromium; \
fi
browser-deps: ## Install Chromium's system libraries (needs root)
npx --prefix server playwright install-deps chromium
web: ## Typecheck and build the supervision UI
npm run typecheck --prefix server/web
npm run build --prefix server/web
cli: ## Typecheck, build, and test the adp CLI (no database needed)
npm run typecheck --prefix cli
npm run build --prefix cli
npm test --prefix cli
adapters: ## Test the scanner-as-gate adapters (no database needed)
npm test --prefix adapters
bench: ## Regenerate the benchmark report from bench/runs/ and assert it is unchanged
npm run report --prefix bench
@git diff --exit-code bench/report/ || { \
echo "bench/report/ is stale — commit the regenerated report"; exit 1; }
test-all: ## Everything CI runs: build, full suite, web, cli, adapters, conformance + acceptance
$(REQUIRE_ENV)
@$(LOAD_ENV) npm run typecheck --prefix server
@$(LOAD_ENV) npm run build --prefix server
@$(LOAD_ENV) npm run migrate --prefix server
@$(LOAD_ENV) npm test --prefix server
@$(MAKE) web
@$(MAKE) cli
@$(MAKE) adapters
@$(MAKE) bench
@$(LOAD_ENV) bash server/conformance/run.sh
@$(LOAD_ENV) bash server/acceptance/run.sh
nuke: ## Full teardown: every stack, all generated files, deps and caches
-@bash scripts/dev/down.sh --all
-@bash scripts/dev/verify-clean.sh --fix
rm -rf server/node_modules server/dist server/web/node_modules server/web/dist cli/node_modules cli/dist adapters/node_modules
rm -rf $(ENV_FILE) .adp-test
rm -rf $${GH_CACHE_DIR:-$$HOME/.cache/adp-conformance-gh}
@echo "nuked — 'make deps && make up' to start over"