-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
94 lines (74 loc) · 2.7 KB
/
Copy pathMakefile
File metadata and controls
94 lines (74 loc) · 2.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
# TheraPy dev tasks. Run `make` (or `make help`) to list targets.
#
# Source (incl. the PWA static assets) and tests are bind-mounted into the
# container, so UI/code/test edits are live — no image rebuild needed except
# when dependencies change (then `make rebuild`).
#
# UI edit (JS/CSS/HTML) → just reload the browser
# Python edit → `make restart`
# Test edit → `make test` / `make e2e` (pytest reads it directly)
#
# Tests live under tests/suites/{unit,integration,e2e} and are auto-marked by
# folder. Select any subset with ARGS, e.g.:
# make test ARGS="-k memory -x" make e2e ARGS="-k hold" make unit
COMPOSE := docker compose
SVC := therapy
EXEC := $(COMPOSE) exec -T $(SVC)
RUN := $(EXEC) uv run
VENV := .venv/bin
ARGS ?=
.DEFAULT_GOAL := help
.PHONY: help
help: ## List available targets
@grep -hE '^[a-zA-Z0-9_-]+:.*?## ' $(MAKEFILE_LIST) \
| sort \
| awk 'BEGIN{FS=":.*?## "}{printf " \033[36m%-12s\033[0m %s\n", $$1, $$2}'
# ---- Container lifecycle ----------------------------------------------------
.PHONY: up
up: ## Build if needed + (re)start the stack in the background
$(COMPOSE) up -d --build $(SVC)
.PHONY: rebuild
rebuild: ## Force a clean image rebuild (use when dependencies change)
$(COMPOSE) build --no-cache $(SVC)
$(COMPOSE) up -d $(SVC)
.PHONY: restart
restart: ## Restart the server to pick up Python edits (no rebuild)
$(COMPOSE) restart $(SVC)
.PHONY: down
down: ## Stop the stack
$(COMPOSE) down
.PHONY: status
status: ## Show container status + health
$(COMPOSE) ps
.PHONY: logs
logs: ## Follow the server logs
$(COMPOSE) logs -f $(SVC)
.PHONY: shell
shell: ## Open an interactive shell in the running container
$(COMPOSE) exec $(SVC) bash
# ---- Tests & quality --------------------------------------------------------
# ARGS passes extra pytest flags: `make test ARGS="-k memory"`, `make e2e ARGS="-k hold"`.
.PHONY: test
test: ## Unit + integration in the container (the real test bed)
$(RUN) pytest $(ARGS)
.PHONY: unit
unit: ## Just the unit suite
$(RUN) pytest -m unit $(ARGS)
.PHONY: integration
integration: ## Just the integration suite
$(RUN) pytest -m integration $(ARGS)
.PHONY: e2e
e2e: ## ALL browser e2e (auto-installs Chromium if missing)
$(RUN) playwright install chromium >/dev/null
$(RUN) pytest -m e2e $(ARGS)
.PHONY: test-fast
test-fast: ## Quick framework-free run on the host slim venv
$(VENV)/python -m pytest $(ARGS)
.PHONY: lint
lint: ## Ruff lint (host)
$(VENV)/ruff check .
.PHONY: acceptance
acceptance: ## Run the phase-4 acceptance script (host)
$(VENV)/python scripts/phase4_acceptance.py
.PHONY: check
check: lint test-fast ## Fast pre-push gate: lint + framework-free tests (host)