-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
125 lines (87 loc) · 4.16 KB
/
Makefile
File metadata and controls
125 lines (87 loc) · 4.16 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
.PHONY: help dev backend frontend install test lint clean docker-up docker-down
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
# --- Development ---
install: ## Install all dependencies
@command -v uv >/dev/null 2>&1 || { echo "uv not found. Install: curl -LsSf https://astral.sh/uv/install.sh | sh"; exit 1; }
cd backend && uv venv .venv && uv pip install --python .venv/bin/python -e ".[dev]"
cd frontend && npm ci
cd e2e && npm ci
dev: ## Start development servers (backend + frontend)
@echo "Starting backend on :8000 and frontend on :5173..."
cd backend && .venv/bin/uvicorn src.main:app --reload --port 8000 &
cd frontend && npm run dev &
wait
backend: ## Start backend only
cd backend && .venv/bin/uvicorn src.main:app --reload --port 8000
frontend: ## Start frontend only
cd frontend && npm run dev
# --- Testing ---
test: test-backend test-frontend ## Run all tests
test-backend: ## Run backend tests
cd backend && .venv/bin/pytest -v --tb=short
test-backend-cov: ## Run backend tests with coverage
cd backend && .venv/bin/pytest --cov=src --cov-report=html --cov-report=term
test-frontend: ## Run frontend unit tests
cd frontend && npm run test:unit -- --run
test-frontend-cov: ## Run frontend tests with coverage
cd frontend && npm run test:unit -- --run --coverage
test-e2e: ## Run E2E tests with Playwright
cd e2e && npx playwright test
test-e2e-ui: ## Run E2E tests with Playwright UI
cd e2e && npx playwright test --ui
test-e2e-headed: ## Run E2E tests in headed mode
cd e2e && npx playwright test --headed
# --- Code Quality ---
lint: ## Run all linters
cd backend && .venv/bin/ruff check src/ tests/
cd backend && .venv/bin/ruff format --check src/ tests/
cd frontend && npm run lint
cd frontend && npm run type-check
format: ## Format all code
cd backend && .venv/bin/ruff format src/ tests/
cd backend && .venv/bin/ruff check --fix src/ tests/
typecheck: ## Run type checking
cd backend && .venv/bin/mypy src/
cd frontend && npm run type-check
# --- Docker ---
docker-up: ## Start all services with Docker
docker compose up -d --build
docker-down: ## Stop all Docker services
docker compose down
docker-dev: ## Start dev environment with Docker
docker compose -f docker-compose.dev.yml up -d --build
docker-test: ## Run tests in Docker
docker compose -f docker-compose.test.yml up --build --abort-on-container-exit
docker-logs: ## Show Docker logs
docker compose logs -f
# --- Database ---
db-migrate: ## Create a new migration
cd backend && .venv/bin/alembic revision --autogenerate -m "$(msg)"
db-upgrade: ## Apply migrations
cd backend && .venv/bin/alembic upgrade head
db-downgrade: ## Rollback last migration
cd backend && .venv/bin/alembic downgrade -1
# --- Build / Distribution ---
build-dist: ## Build distribution ZIP (online, requires internet at install time)
./scripts/build-online-mac-and-linux.sh
build-dist-offline: ## Build offline distribution ZIPs for Linux/macOS (Windows: use build-windows.ps1 on Windows host)
./scripts/build-mac-and-linux.sh linux
./scripts/build-mac-and-linux.sh macos-arm64
./scripts/build-mac-and-linux.sh macos-x86_64
build-dist-offline-linux: ## Build offline distribution ZIP for Linux x86_64
./scripts/build-mac-and-linux.sh linux
build-dist-offline-macos-arm64: ## Build offline distribution ZIP for macOS ARM64
./scripts/build-mac-and-linux.sh macos-arm64
build-dist-offline-macos-x86_64: ## Build offline distribution ZIP for macOS x86_64
./scripts/build-mac-and-linux.sh macos-x86_64
build-dist-offline-windows: ## Build offline distribution ZIP for Windows x86_64 (must run on Windows)
@echo "Windows build must run on a Windows host."
@echo "Run: powershell -ExecutionPolicy Bypass -File scripts/build-windows.ps1"
@echo "Or use CI: the build.yml workflow builds this automatically on windows-latest."
# --- Cleanup ---
clean: ## Clean build artifacts
rm -rf backend/.pytest_cache backend/.mypy_cache backend/htmlcov
rm -rf frontend/dist frontend/node_modules/.vite
rm -rf e2e/playwright-report e2e/test-results
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true