-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
67 lines (45 loc) · 3.07 KB
/
Copy pathMakefile
File metadata and controls
67 lines (45 loc) · 3.07 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
.PHONY: help start down reset check test qa-required migration migrate smoke smoke-moderation api-key lint fix type audit load
help:
@awk 'BEGIN{FS=":.*##"} /^[a-zA-Z_-]+:.*##/{printf "%-14s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
# ── Stack ──────────────────────────────────────────────────────────────────
start: ## Build and start the stack
docker compose up --build -d
down: ## Stop the stack (keep volumes)
docker compose down
reset: ## Stop the stack and remove volumes
docker compose down -v
check: ## Ensure the database container is running
@services="$$(docker compose ps --status running --services)"; \
echo "$$services" | grep -qx "db" || { \
echo "Database not running. Run 'make start' first."; \
exit 1; \
}
# ── Development ────────────────────────────────────────────────────────────
migration: check ## Create a new migration (name=...)
@if [ -z "$(name)" ]; then echo "Usage: make migration name=..."; exit 1; fi
docker compose run --rm --build -v $(CURDIR):/app api alembic revision --autogenerate -m "$(name)"
migrate: check ## Apply pending migrations
docker compose run --rm --build -v $(CURDIR):/app api alembic upgrade head
api-key: check ## Create an API key
docker compose run --rm --build api uv run python -m app.auth.cli
# ── Quality ────────────────────────────────────────────────────────────────
lint: ## Lint (no fixes)
docker compose run --rm --build api uv run ruff check .
fix: ## Auto-fix lint and format
docker compose run --rm --build -v $(CURDIR):/app api sh -c 'uv run ruff check --fix . && uv run ruff format .'
type: ## Type check
docker compose run --rm --build api uv run mypy
audit: ## Dependency security audit
docker compose run --rm --build api uv run pip-audit
qa-required: lint type audit ## Run all required quality checks (lint, types, security)
# ── Testing ────────────────────────────────────────────────────────────────
test: check ## Run tests with coverage
docker compose run --rm --build -v $(CURDIR):/app api uv run pytest --cov
smoke: check ## End-to-end smoke test (also runs moderation smoke at the end)
bash scripts/e2e_smoke.sh
smoke-moderation: ## Live moderation smoke test only (requires OPENAI_API_KEY)
docker compose run --rm --build api env PYTHONPATH=/app uv run python scripts/moderation_smoke.py
load: ## Locust load test UI (HOST=http://localhost:8000, requires TEXET_API_KEY)
uv run locust --host $${HOST:-http://localhost:8000}
load-hub: ## Hub load test UI (HOST=..., requires HUB_API_KEY and DATABASE_URL_STAGING)
TEST_MODE=true uv run locust -f locust_hub.py --host $${HOST:?HOST is required}