-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathMakefile
More file actions
96 lines (75 loc) · 3.58 KB
/
Copy pathMakefile
File metadata and controls
96 lines (75 loc) · 3.58 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
# ============================================================================
# PyGBSentry — Makefile for common development tasks
# ============================================================================
# Usage:
# make help — show available commands
# make install — install all dependencies (backend + frontend)
# make lint — run ruff linter
# make format — auto-format code with ruff
# make typecheck — run mypy type checker
# make test — run pytest with coverage
# make security — run bandit security scanner
# make docker-up — start all services via docker-compose
# make docker-down — stop all docker services
# ============================================================================
.PHONY: help install setup lint format typecheck test security docker-up docker-down clean doctor
PYTHON ?= python
PNPM ?= pnpm
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}'
install: ## Install all dependencies
cd backend && $(PYTHON) -m pip install -r requirements.txt
cd frontend && $(PNPM) install
setup: ## One-command setup: generate .env + install deps + init database
$(PYTHON) tools/generate_env.py --non-interactive
cd backend && $(PYTHON) -m pip install -r requirements.txt
cd frontend && $(PNPM) install
cd backend && $(PYTHON) app/initial_data.py
@echo ""
@echo "Setup complete! Start the server with:"
@echo " make dev (local development)"
@echo " make docker-up (Docker deployment)"
dev: ## Start development servers (backend + frontend)
cd backend && $(PYTHON) -m app.main &
cd frontend && $(PNPM) run dev &
@echo "Backend: http://localhost:8000 Frontend: http://localhost:5173"
docker-init: ## Docker one-command deploy: generate .env + build + start
$(PYTHON) tools/generate_env.py --docker --non-interactive
docker compose up -d --build
@echo "PyGBSentry is running at http://localhost"
doctor: ## Run deployment diagnostics
./deploy/setup.sh doctor
install-dev: ## Install development dependencies
cd backend && $(PYTHON) -m pip install -r requirements.txt ruff mypy bandit pytest pytest-asyncio pytest-cov pytest-mock
cd frontend && $(PNPM) install
lint: ## Run ruff linter
cd backend && ruff check app/ tests/
format: ## Auto-format code
cd backend && ruff format app/ tests/
cd backend && ruff check app/ tests/ --fix
typecheck: ## Run mypy type checker
cd backend && mypy app/ --ignore-missing-imports
test: ## Run tests with coverage
cd backend && pytest tests/ -v --cov=app --cov-report=term-missing --cov-fail-under=70
test-unit: ## Run only unit tests (skip integration)
cd backend && pytest tests/ -v --ignore=tests/integration
test-integration: ## Run integration tests
cd backend && pytest tests/integration/ -v
security: ## Run security scanners
cd backend && bandit -r app/ -f custom --severity-level medium
cd backend && pip-audit -r requirements.txt
docker-up: ## Start all services
docker-compose up -d
docker-down: ## Stop all services
docker-compose down
clean: ## Clean build artifacts
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 .ruff_cache -exec rm -rf {} + 2>/dev/null || true
rm -f backend/coverage.xml backend/.coverage
rm -f backend/bandit_report.sarif
migrate: ## Run database migrations
cd backend && alembic upgrade head
migrate-rollback: ## Rollback last migration
cd backend && alembic downgrade -1