-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
172 lines (133 loc) · 6.08 KB
/
Makefile
File metadata and controls
172 lines (133 loc) · 6.08 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# Makefile
APP_ENV ?= dev
ENV_FILE := .env.$(APP_ENV)
# Check if .env exists
ifeq (,$(wildcard $(ENV_FILE)))
$(error $(ENV_FILE) is missing. Please create it based on .env.example)
endif
# Load environment variables from .env
include $(ENV_FILE)
export
.PHONY: mypy clean help
#################################################################################
## Docker Commands
#################################################################################
docker-build: ## Build the Docker image for the 'app' service
@echo "Building Docker image for 'app' service =$(APP_ENV).."
COMPOSE_BAKE=true docker compose -f docker/docker-compose.yml build \
--build-arg APP_ENV=$(APP_ENV) \
app
@echo "Docker image github-issues built."
docker-up: ## Start Docker containers
@echo "Starting Docker containers with $(ENV_FILE)..."
docker compose --env-file $(ENV_FILE) -f docker/docker-compose.yml up -d
@echo "Docker containers started."
docker-down: ## Stop and remove Docker containers
@echo "Stopping Docker containers..."
docker compose --env-file $(ENV_FILE) -f docker/docker-compose.yml down
@echo "Docker containers stopped."
#################################################################################
## PostgreSQL Commands
#################################################################################
init-db: ## Initialize the PostgreSQL database
@echo "Initializing PostgreSQL database for $(APP_ENV)..."
APP_ENV=$(APP_ENV) uv run src/database/init_db.py
@echo "PostgreSQL database initialized."
drop-tables: ## Drop all tables in the PostgreSQL database
@echo "Dropping all tables in the PostgreSQL database for $(APP_ENV)..."
APP_ENV=$(APP_ENV) uv run src/database/drop_tables.py
@echo "All tables dropped successfully."
ingest-github-issues: ## Ingest GitHub issues
@echo "Ingesting GitHub issues for $(APP_ENV)..."
APP_ENV=$(APP_ENV) uv run src/data_pipeline/ingestion_raw_data.py
@echo "GitHub issues ingested successfully."
#################################################################################
## Qdrant Commands
#################################################################################
create-collection: ## Create Qdrant collection
@echo "Creating Qdrant collection for $(APP_ENV)..."
APP_ENV=$(APP_ENV) uv run src/vectorstore/create_collection.py
@echo "Qdrant collection created successfully."
create-indexes: ## Create Qdrant collection
@echo "Creating Qdrant indexes for $(APP_ENV)..."
APP_ENV=$(APP_ENV) uv run src/vectorstore/create_index.py
@echo "Qdrant indexes created successfully."
delete-collection: ## Delete Qdrant collection
@echo "Deleting Qdrant collection for $(APP_ENV)..."
APP_ENV=$(APP_ENV) uv run src/vectorstore/delete_collection.py
@echo "Qdrant collection deleted successfully."
ingest-embeddings: ## Ingest embeddings into Qdrant
@echo "Ingesting embeddings into Qdrant for $(APP_ENV)..."
APP_ENV=$(APP_ENV) uv run src/data_pipeline/ingest_embeddings.py
@echo "Embeddings ingested successfully."
#################################################################################
## Graph Commands
#################################################################################
query-graph: ## Query the graph
@echo "Querying the graph for $(APP_ENV)..."
APP_ENV=$(APP_ENV) uv run src/agents/graph.py
@echo "Querying the graph completed."
#################################################################################
## Testing Commands
#################################################################################
all-tests: ## Run all tests
@echo "Running all tests..."
APP_ENV=$(APP_ENV) uv run pytest
@echo "All tests completed."
unit-tests: ## Run only unit tests
@echo "Running unit tests..."
APP_ENV=$(APP_ENV) uv run pytest tests/unit
@echo "Unit tests completed."
integration-tests: ## Run only integration tests
@echo "Running integration tests..."
APP_ENV=$(APP_ENV) uv run pytest tests/integration
@echo "Integration tests completed."
################################################################################
## Pre-commit Commands
################################################################################
pre-commit-run: ## Run pre-commit hooks
@echo "Running pre-commit hooks..."
pre-commit run --all-files
@echo "Pre-commit checks complete."
################################################################################
## Linting and Formatting
################################################################################
all-lint-format: ruff-lint mypy clean ## Run all linting and formatting commands
ruff-check: ## Check Ruff formatting
@echo "Checking Ruff formatting..."
uv run ruff format --check .
@echo "Ruff checks complete."
ruff-format: ## Format code with Ruff
@echo "Formatting code with Ruff..."
uv run ruff format .
@echo "Formatting complete."
ruff-lint: ## Run Ruff linter with auto-fix
@echo "Running Ruff linter..."
uv run ruff check . --fix --exit-non-zero-on-fix
@echo "Ruff checks complete."
mypy: ## Run MyPy static type checker
@echo "Running MyPy static type checker..."
uv run mypy
@echo "MyPy static type checker complete."
clean: ## Clean up cached generated files
@echo "Cleaning up generated files..."
find . -type d -name "__pycache__" -exec rm -rf {} +
find . -type d -name ".pytest_cache" -exec rm -rf {} +
find . -type d -name ".ruff_cache" -exec rm -rf {} +
find . -type d -name ".mypy_cache" -exec rm -rf {} +
find . -type d -name ".langgraph_api" -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
@echo "Cleanup complete."
lint-makefile: ## Lint Makefile for missing help comments
@echo "Linting Makefile for missing help comments..."
chmod +x scripts/lint-makefile.sh
scripts/lint-makefile.sh
@echo "Linting complete."
################################################################################
## Help Command
################################################################################
help: ## Display this help message
@echo "Default target: $(.DEFAULT_GOAL)"
@echo "Available targets:"
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.DEFAULT_GOAL := help