-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
154 lines (116 loc) · 4.7 KB
/
Makefile
File metadata and controls
154 lines (116 loc) · 4.7 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
152
153
154
.PHONY: help install install-dev test test-unit test-integration test-e2e test-cov clean lint format type-check pre-commit build run dev docker-build docker-run docker-dev setup-dev setup-prod
# Default target
help: ## Show this help message
@echo "BotForge RAG - Available Commands:"
@echo ""
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
# Environment and dependency management
install: ## Install production dependencies
uv sync --no-dev
install-dev: ## Install all dependencies including development tools
uv sync --extra dev
install-test: ## Install test dependencies only
uv sync --extra test
# Development setup
setup-dev: install-dev ## Set up development environment
uv run pre-commit install
@echo "Development environment setup complete!"
@echo "Run 'make dev' to start the development server"
setup-prod: install ## Set up production environment
@echo "Production environment setup complete!"
@echo "Run 'make run' to start the production server"
# Testing
test: ## Run all tests
uv run pytest
test-unit: ## Run unit tests only
uv run pytest tests/unit/ -v
test-integration: ## Run integration tests only
uv run pytest tests/integration/ -v -m integration
test-e2e: ## Run end-to-end tests only
uv run pytest tests/e2e/ -v -m e2e
test-cov: ## Run tests with coverage report
uv run pytest --cov=src/botforge --cov-report=html --cov-report=term-missing
test-watch: ## Run tests in watch mode
uv run pytest-watch
# Code quality
lint: ## Run linting checks
uv run flake8 src/ tests/
uv run isort --check-only src/ tests/
uv run black --check src/ tests/
format: ## Format code with black and isort
uv run isort src/ tests/
uv run black src/ tests/
type-check: ## Run type checking with mypy
uv run mypy src/
pre-commit: ## Run pre-commit hooks
uv run pre-commit run --all-files
check: lint type-check test-unit ## Run all code quality checks
# Application management
run: ## Run the application in production mode
uv run uvicorn src.botforge.main:app --host 0.0.0.0 --port ${PORT:-8000}
dev: ## Run the application in development mode
uv run uvicorn src.botforge.main:app --reload --host 0.0.0.0 --port 8000
build: ## Build the application (prepare for deployment)
@echo "Building BotForge RAG application..."
uv sync --no-dev
@echo "Build complete!"
# Docker operations
docker-build: ## Build Docker image
docker build -t botforge-rag .
docker-build-dev: ## Build development Docker image
docker build -f deployment/docker/Dockerfile.dev -t botforge-rag:dev .
docker-run: ## Run Docker container
docker run -p 8000:8000 botforge-rag
docker-dev: ## Run development environment with Docker Compose
docker-compose -f deployment/docker/docker-compose.yml up --build
docker-prod: ## Run production environment with Docker Compose
docker-compose -f deployment/docker/docker-compose.prod.yml up -d
docker-down: ## Stop Docker containers
docker-compose -f deployment/docker/docker-compose.yml down
docker-compose -f deployment/docker/docker-compose.prod.yml down
# Database operations
db-migrate: ## Run database migrations
uv run python scripts/dev/migrate_db.py
db-seed: ## Seed database with sample data
uv run python scripts/dev/seed_db.py
db-reset: ## Reset database (development only)
uv run python scripts/dev/reset_db.py
# Cleanup
clean: ## Clean up build artifacts and cache
find . -type f -name "*.pyc" -delete
find . -type d -name "__pycache__" -delete
find . -type d -name "*.egg-info" -exec rm -rf {} +
rm -rf build/
rm -rf dist/
rm -rf htmlcov/
rm -rf .coverage
rm -rf .pytest_cache/
rm -rf .mypy_cache/
clean-all: clean ## Clean everything including virtual environment
rm -rf .venv/
# Documentation
docs: ## Generate documentation
@echo "Generating documentation..."
@echo "See docs/ directory for available documentation"
# Deployment
deploy-dev: ## Deploy to development environment
./scripts/dev/deploy-dev.sh
deploy-prod: ## Deploy to production environment
./scripts/prod/deploy-prod.sh
# Utilities
logs: ## Show application logs
docker-compose -f deployment/docker/docker-compose.yml logs -f
logs-prod: ## Show production logs
docker-compose -f deployment/docker/docker-compose.prod.yml logs -f
shell: ## Start interactive shell in development environment
uv run python
# Environment information
info: ## Show environment information
@echo "BotForge RAG Environment Information:"
@echo "======================================"
@echo "Python version: $(shell uv run python --version)"
@echo "UV version: $(shell uv --version)"
@echo "Project root: $(shell pwd)"
@echo "Virtual environment: $(shell uv run which python)"
@echo ""
@echo "Available commands: run 'make help' to see all commands"