-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
99 lines (74 loc) · 3.89 KB
/
Makefile
File metadata and controls
99 lines (74 loc) · 3.89 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
.PHONY: help setup dev test lint migrate migration 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}'
# ──────────────────────────────────────
# Setup
# ──────────────────────────────────────
setup: ## First-time project setup
@echo "🔧 Installing dependencies..."
pip install -e ".[dev]"
@echo "📋 Copying .env.example to .env..."
@cp -n .env.example .env 2>/dev/null || true
@echo "🗄️ Running database migrations..."
alembic upgrade head
@echo "✅ Setup complete. Run 'make dev' to start."
# ──────────────────────────────────────
# Development
# ──────────────────────────────────────
dev: ## Start dev server with hot reload
uvicorn backend.main:app --reload --host 0.0.0.0 --port 8000
dev-worker: ## Start Celery worker (when ready)
@echo "Worker not yet implemented"
# ──────────────────────────────────────
# Testing
# ──────────────────────────────────────
test: ## Run test suite
pytest -v --tb=short
test-cov: ## Run tests with coverage
pytest -v --cov=backend --cov-report=html --cov-report=term
# ──────────────────────────────────────
# Code Quality
# ──────────────────────────────────────
lint: ## Run linters
ruff check backend/ tests/
ruff format --check backend/ tests/
format: ## Auto-format code
ruff check --fix backend/ tests/
ruff format backend/ tests/
typecheck: ## Run type checker
mypy backend/
# ──────────────────────────────────────
# Database
# ──────────────────────────────────────
migrate: ## Run pending migrations
alembic upgrade head
migration: ## Create new migration (usage: make migration m="description")
alembic revision --autogenerate -m "$(m)"
migrate-down: ## Rollback last migration
alembic downgrade -1
db-reset: ## Drop and recreate database (DESTRUCTIVE)
@echo "⚠️ This will destroy all data. Press Ctrl+C to cancel."
@sleep 3
alembic downgrade base
alembic upgrade head
# ──────────────────────────────────────
# Docker
# ──────────────────────────────────────
docker-up: ## Start all services with Docker Compose
docker compose up -d
docker-down: ## Stop all services
docker compose down
docker-build: ## Rebuild Docker images
docker compose build
docker-logs: ## Tail Docker logs
docker compose logs -f
# ──────────────────────────────────────
# Cleanup
# ──────────────────────────────────────
clean: ## Remove build artifacts and caches
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find . -type d -name .pytest_cache -exec rm -rf {} + 2>/dev/null || true
find . -type d -name .mypy_cache -exec rm -rf {} + 2>/dev/null || true
find . -type d -name .ruff_cache -exec rm -rf {} + 2>/dev/null || true
find . -type d -name htmlcov -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete 2>/dev/null || true