-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
71 lines (54 loc) · 3.19 KB
/
Makefile
File metadata and controls
71 lines (54 loc) · 3.19 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
.DEFAULT_GOAL := help
SHELL := /bin/bash
PYTHON := python3
SRC := src/swachhzero
TESTS := tests
.PHONY: help install dev lint format test test-unit test-integration coverage clean docker-build docker-up docker-down docs serve migrate
## —— 🌍 SwachhZero ——————————————————————————————————————————
help: ## Display this help message
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
## —— Installation ————————————————————————————————————————————
install: ## Install production dependencies
$(PYTHON) -m pip install -e .
dev: ## Install development dependencies
$(PYTHON) -m pip install -e ".[dev,test,docs]"
pre-commit install
## —— Code Quality ————————————————————————————————————————————
lint: ## Run all linters (ruff, mypy)
ruff check $(SRC) $(TESTS)
mypy $(SRC)
format: ## Auto-format code with ruff
ruff format $(SRC) $(TESTS)
ruff check --fix $(SRC) $(TESTS)
## —— Testing —————————————————————————————————————————————————
test: ## Run all tests
pytest $(TESTS) -v --tb=short
test-unit: ## Run unit tests only
pytest $(TESTS)/unit -v --tb=short
test-integration: ## Run integration tests only
pytest $(TESTS)/integration -v --tb=short
coverage: ## Run tests with coverage report
pytest $(TESTS) --cov=$(SRC) --cov-report=term-missing --cov-report=html:htmlcov --cov-fail-under=80
## —— Cleanup —————————————————————————————————————————————————
clean: ## Remove build artifacts and caches
rm -rf build/ dist/ *.egg-info .eggs/
rm -rf .pytest_cache .mypy_cache .ruff_cache htmlcov/
rm -rf .coverage coverage.xml
find . -type d -name __pycache__ -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
## —— Docker ——————————————————————————————————————————————————
docker-build: ## Build Docker images
docker compose build
docker-up: ## Start all services
docker compose up -d
docker-down: ## Stop all services
docker compose down -v
## —— Documentation ———————————————————————————————————————————
docs: ## Build documentation
cd docs && mkdocs build
## —— Server ——————————————————————————————————————————————————
serve: ## Start the API server (development)
uvicorn swachhzero.api.app:create_app --host 0.0.0.0 --port 8000 --reload --factory
## —— Database ————————————————————————————————————————————————
migrate: ## Run database migrations
alembic upgrade head