-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
151 lines (120 loc) · 4.46 KB
/
Makefile
File metadata and controls
151 lines (120 loc) · 4.46 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# =============================================================================
# Amber System - Makefile
# =============================================================================
# Common commands for development, testing, and deployment.
# =============================================================================
.PHONY: help install dev test lint format clean docker-up docker-down docker-build migrate verify verify-backend verify-frontend
# Default target
help:
@echo "Amber System (Hybrid GraphRAG)"
@echo ""
@echo "Usage: make [target]"
@echo ""
@echo "Development:"
@echo " install Install production dependencies"
@echo " dev Install development dependencies"
@echo " run Run the API server locally"
@echo ""
@echo "Testing:"
@echo " test Run all tests"
@echo " test-unit Run unit tests only"
@echo " test-int Run integration tests only"
@echo " coverage Run tests with coverage report"
@echo ""
@echo "Code Quality:"
@echo " lint Run linter (ruff)"
@echo " format Format code (ruff)"
@echo " typecheck Run type checker (mypy)"
@echo " verify Run full quality gate (backend + frontend)"
@echo " verify-backend Run backend quality gate only"
@echo " verify-frontend Run frontend quality gate only"
@echo ""
@echo "Docker:"
@echo " docker-up Start all services"
@echo " docker-down Stop all services"
@echo " docker-build Build Docker images"
@echo " docker-logs View service logs"
@echo ""
@echo "Database:"
@echo " migrate Run database migrations"
@echo " migrate-new Create new migration"
@echo ""
@echo "Cleanup:"
@echo " clean Remove build artifacts"
# =============================================================================
# Development
# =============================================================================
install:
pip install -r requirements.txt
dev:
pip install -e ".[dev]"
run:
uvicorn src.api.main:app --reload --host 0.0.0.0 --port 8000
# =============================================================================
# Testing
# =============================================================================
test:
pytest tests/ -v
test-unit:
pytest tests/unit/ -v
test-int:
pytest tests/integration/ -v
coverage:
pytest tests/ --cov=src --cov-report=html --cov-report=term-missing
@echo "Coverage report: htmlcov/index.html"
# =============================================================================
# Code Quality
# =============================================================================
lint:
ruff check src/ tests/
format:
ruff check --fix src/ tests/
ruff format src/ tests/
typecheck:
mypy src/
verify:
bash scripts/verify.sh all
verify-backend:
bash scripts/verify.sh backend
verify-frontend:
bash scripts/verify.sh frontend
# =============================================================================
# Docker
# =============================================================================
docker-up:
docker compose up -d
@echo "Waiting for services to be healthy..."
@sleep 10
docker compose ps
docker-down:
docker compose down
docker-build:
docker compose build
docker-logs:
docker compose logs -f
docker-clean:
docker compose down -v --remove-orphans
# =============================================================================
# Database
# =============================================================================
migrate:
alembic upgrade head
migrate-new:
@read -p "Migration message: " msg; \
alembic revision --autogenerate -m "$$msg"
# =============================================================================
# API Key Management
# =============================================================================
generate-key:
python -c "from src.shared.security import generate_api_key; print(f'New API key: {generate_api_key()}')"
# =============================================================================
# Cleanup
# =============================================================================
clean:
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
find . -type f -name ".coverage" -delete 2>/dev/null || true