-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
356 lines (283 loc) · 11.9 KB
/
Copy pathMakefile
File metadata and controls
356 lines (283 loc) · 11.9 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
# ============================================================================
# Makefile for Audex Project
# ============================================================================
# Description: Unified command interface for development, build, and deployment
# ============================================================================
.PHONY: help
.DEFAULT_GOAL := help
# ============================================================================
# Variables
# ============================================================================
PYTHON := python3
UV := uv
MKDOCS := mkdocs
SCRIPTS_DIR := scripts
PACKAGING_DIR := packaging/linux
# Colors
BLUE := \033[0;34m
GREEN := \033[0;32m
YELLOW := \033[1;33m
NC := \033[0m
# ============================================================================
# Help
# ============================================================================
help: ## Show this help message
@echo "$(BLUE)Audex Project Makefile$(NC)"
@echo ""
@echo "$(GREEN)Available targets:$(NC)"
@echo ""
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf " $(YELLOW)%-20s$(NC) %s\n", $$1, $$2}'
@echo ""
@echo "$(GREEN)Examples:$(NC)"
@echo " make install # Install dependencies"
@echo " make dev-gen # Generate all code"
@echo " make build # Build Python package"
@echo " make test # Run tests"
@echo " make bump VERSION=1.0.4 # Bump version"
@echo ""
# ============================================================================
# Development Setup
# ============================================================================
install: ## Install project dependencies with uv
@echo "$(BLUE)Installing dependencies... $(NC)"
$(UV) sync
@echo "$(GREEN)✓ Dependencies installed$(NC)"
install-dev: ## Install development dependencies
@echo "$(BLUE)Installing development dependencies...$(NC)"
$(UV) sync --extra dev
@echo "$(GREEN)✓ Development dependencies installed$(NC)"
install-docs: ## Install documentation dependencies
@echo "$(BLUE)Installing documentation dependencies...$(NC)"
$(UV) sync --extra docs
@echo "$(GREEN)✓ Documentation dependencies installed$(NC)"
install-all: ## Install all dependencies (including dev and docs)
@echo "$(BLUE)Installing all dependencies...$(NC)"
$(UV) sync --all-extras
@echo "$(GREEN)✓ All dependencies installed$(NC)"
setup: install-all ## Complete development setup
@echo "$(GREEN)✓ Development environment ready$(NC)"
# ============================================================================
# Code Generation
# ============================================================================
dev-gen: ## Generate all code (filters + stubs)
@echo "$(BLUE)Generating code...$(NC)"
@sh $(SCRIPTS_DIR)/dev.sh all gen
@echo "$(GREEN)✓ Code generation complete$(NC)"
dev-gen-filters: ## Generate entity filters
@sh $(SCRIPTS_DIR)/dev.sh filters gen
dev-gen-stubs: ## Generate entity stubs
@sh $(SCRIPTS_DIR)/dev.sh stubs gen
dev-clean: ## Clean all generated code
@sh $(SCRIPTS_DIR)/dev.sh all clean --force
dev-clean-filters: ## Clean generated filters
@sh $(SCRIPTS_DIR)/dev.sh filters clean --force
dev-clean-stubs: ## Clean generated stubs
@sh $(SCRIPTS_DIR)/dev.sh stubs clean --force
# ============================================================================
# Code Quality
# ============================================================================
format: ## Format code with black and isort
@echo "$(BLUE)Formatting code...$(NC)"
$(UV) run black audex/
$(UV) run isort audex/
@echo "$(GREEN)✓ Code formatted$(NC)"
lint: ## Run linters (ruff, mypy)
@echo "$(BLUE)Running linters...$(NC)"
$(UV) run ruff check audex/
$(UV) run mypy audex/
@echo "$(GREEN)✓ Linting complete$(NC)"
type-check: ## Run type checking with mypy
@echo "$(BLUE)Type checking...$(NC)"
$(UV) run mypy audex/
@echo "$(GREEN)✓ Type checking complete$(NC)"
check: format lint ## Run all code quality checks
# ============================================================================
# Testing
# ============================================================================
test: ## Run all tests
@echo "$(BLUE)Running tests...$(NC)"
$(UV) run pytest
@echo "$(GREEN)✓ Tests passed$(NC)"
test-cov: ## Run tests with coverage report
@echo "$(BLUE)Running tests with coverage...$(NC)"
$(UV) run pytest --cov=audex --cov-report=html --cov-report=term
@echo "$(GREEN)✓ Coverage report generated: htmlcov/index.html$(NC)"
test-watch: ## Run tests in watch mode
$(UV) run pytest-watch
# ============================================================================
# Build
# ============================================================================
build: ## Build Python package (wheel + sdist)
@echo "$(BLUE)Building Python package...$(NC)"
@sh $(SCRIPTS_DIR)/build.sh python
@echo "$(GREEN)✓ Package built$(NC)"
build-clean: ## Clean and rebuild Python package
@echo "$(BLUE)Cleaning and building...$(NC)"
@sh $(SCRIPTS_DIR)/build.sh python --clean
@echo "$(GREEN)✓ Clean build complete$(NC)"
build-docs: ## Build documentation with MkDocs
@echo "$(BLUE)Building documentation...$(NC)"
@sh $(SCRIPTS_DIR)/build.sh docs
@echo "$(GREEN)✓ Documentation built: site/$(NC)"
build-deb-arm64: ## Build DEB package for ARM64
@echo "$(BLUE)Building DEB for ARM64...$(NC)"
@sh $(SCRIPTS_DIR)/build.sh deb arm64
@echo "$(GREEN)✓ DEB package built$(NC)"
build-deb-amd64: ## Build DEB package for AMD64
@echo "$(BLUE)Building DEB for AMD64...$(NC)"
@sh $(SCRIPTS_DIR)/build.sh deb amd64
@echo "$(GREEN)✓ DEB package built$(NC)"
build-deb: build-deb-arm64 build-deb-amd64 ## Build DEB packages for all architectures
build-all: build build-docs ## Build everything (Python + docs)
# ============================================================================
# Version Management
# ============================================================================
bump: ## Bump version (usage: make bump VERSION=1.0.4)
ifndef VERSION
@echo "$(YELLOW)Error: VERSION is required$(NC)"
@echo "Usage: make bump VERSION=1.0.4"
@exit 1
endif
@echo "$(BLUE)Bumping version to $(VERSION)...$(NC)"
@sh $(SCRIPTS_DIR)/bump.sh $(VERSION)
@echo "$(GREEN)✓ Version bumped to $(VERSION)$(NC)"
bump-dry: ## Dry-run version bump (usage: make bump-dry VERSION=1.0.4)
ifndef VERSION
@echo "$(YELLOW)Error: VERSION is required$(NC)"
@echo "Usage: make bump-dry VERSION=1.0.4"
@exit 1
endif
@sh $(SCRIPTS_DIR)/bump.sh $(VERSION) --dry-run
bump-no-push: ## Bump version without pushing to remote
ifndef VERSION
@echo "$(YELLOW)Error: VERSION is required$(NC)"
@echo "Usage: make bump-no-push VERSION=1.0.4"
@exit 1
endif
@sh $(SCRIPTS_DIR)/bump.sh $(VERSION) --no-push
# ============================================================================
# Deployment
# ============================================================================
deploy-test: ## Deploy to TestPyPI
@echo "$(BLUE)Deploying to TestPyPI...$(NC)"
@sh $(SCRIPTS_DIR)/deploy.sh pypi test
@echo "$(GREEN)✓ Deployed to TestPyPI$(NC)"
deploy-pypi: ## Deploy to production PyPI
@echo "$(BLUE)Deploying to PyPI...$(NC)"
@sh $(SCRIPTS_DIR)/deploy.sh pypi prod
@echo "$(GREEN)✓ Deployed to PyPI$(NC)"
deploy-docs: ## Deploy documentation to GitHub Pages
@echo "$(BLUE)Deploying documentation...$(NC)"
@sh $(SCRIPTS_DIR)/deploy.sh docs
@echo "$(GREEN)✓ Documentation deployed$(NC)"
test-deb-arm64: ## Test DEB package on ARM64
@sh $(SCRIPTS_DIR)/deploy.sh deb arm64
test-deb-amd64: ## Test DEB package on AMD64
@sh $(SCRIPTS_DIR)/deploy.sh deb amd64
# ============================================================================
# Documentation
# ============================================================================
docs-serve: ## Serve documentation locally
@echo "$(BLUE)Starting documentation server...$(NC)"
$(MKDOCS) serve
docs-build: build-docs ## Alias for build-docs
docs-deploy: deploy-docs ## Alias for deploy-docs
# ============================================================================
# Cleaning
# ============================================================================
clean: ## Clean build artifacts
@echo "$(BLUE)Cleaning build artifacts...$(NC)"
@rm -rf dist/ build/ *.egg-info .pytest_cache .mypy_cache .ruff_cache
@rm -rf site/ htmlcov/ .coverage
@find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
@echo "$(GREEN)✓ Cleaned$(NC)"
clean-all: clean dev-clean ## Clean everything (build + generated code)
@echo "$(GREEN)✓ All artifacts cleaned$(NC)"
# ============================================================================
# Development Workflow
# ============================================================================
dev: install-all dev-gen ## Complete development setup with code generation
@echo "$(GREEN)✓ Development environment ready$(NC)"
check-all: format lint test ## Run all checks (format + lint + test)
@echo "$(GREEN)✓ All checks passed$(NC)"
pre-commit: check-all ## Run pre-commit checks
@echo "$(GREEN)✓ Pre-commit checks passed$(NC)"
pre-release: clean-all build-all test ## Prepare for release
@echo "$(GREEN)✓ Ready for release$(NC)"
# ============================================================================
# Release Workflow
# ============================================================================
release: ## Full release workflow (bump + build + deploy)
ifndef VERSION
@echo "$(YELLOW)Error: VERSION is required$(NC)"
@echo "Usage: make release VERSION=1.0.4"
@exit 1
endif
@echo "$(BLUE)Starting release workflow for version $(VERSION)...$(NC)"
@$(MAKE) pre-release
@$(MAKE) bump VERSION=$(VERSION)
@echo "$(GREEN)✓ Release complete! GitHub Actions will handle deployment.$(NC)"
release-manual: ## Manual release (bump + build + manual deploy)
ifndef VERSION
@echo "$(YELLOW)Error: VERSION is required$(NC)"
@echo "Usage: make release-manual VERSION=1.0.4"
@exit 1
endif
@$(MAKE) pre-release
@$(MAKE) bump-no-push VERSION=$(VERSION)
@$(MAKE) deploy-pypi
@echo "$(YELLOW)Remember to push manually:$(NC)"
@echo " git push origin main"
@echo " git push origin v$(VERSION)"
# ============================================================================
# CI/CD Simulation
# ============================================================================
ci: ## Simulate CI pipeline locally
@echo "$(BLUE)Running CI pipeline...$(NC)"
@$(MAKE) install-all
@$(MAKE) check-all
@$(MAKE) build-all
@echo "$(GREEN)✓ CI pipeline passed$(NC)"
# ============================================================================
# Utilities
# ============================================================================
shell: ## Open uv shell
$(UV) run bash
info: ## Show project information
@echo "$(BLUE)Project Information:$(NC)"
@echo ""
@echo "Python version:"
@$(PYTHON) --version
@echo ""
@echo "uv version:"
@$(UV) --version
@echo ""
@echo "Project dependencies:"
@$(UV) tree
update: ## Update dependencies
@echo "$(BLUE)Updating dependencies...$(NC)"
$(UV) sync --upgrade
@echo "$(GREEN)✓ Dependencies updated$(NC)"
lock: ## Update lock file
@echo "$(BLUE)Updating lock file...$(NC)"
$(UV) lock
@echo "$(GREEN)✓ Lock file updated$(NC)"
# ============================================================================
# Docker (if needed in future)
# ============================================================================
docker-build: ## Build Docker image
@echo "$(BLUE)Building Docker image...$(NC)"
docker build -t audex:latest .
@echo "$(GREEN)✓ Docker image built$(NC)"
docker-run: ## Run Docker container
docker run --rm -it audex:latest
# ============================================================================
# Quick Commands (Aliases)
# ============================================================================
b: build ## Alias for build
t: test ## Alias for test
c: check ## Alias for check
f: format ## Alias for format
l: lint ## Alias for lint
i: install ## Alias for install