-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
229 lines (209 loc) · 13.3 KB
/
Makefile
File metadata and controls
229 lines (209 loc) · 13.3 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
# ============================================================================
# Makefile for GitFlow Analytics
# ============================================================================
# Modular Makefile system with specialized modules for different concerns
#
# Quick Start:
# make help - Show available targets
# make install - Install package in development mode
# make test - Run all tests (parallel)
# make quality - Run all quality checks (Ruff-first)
# make release-patch - Release patch version (3.13.1 → 3.13.2)
#
# Environment Support:
# make ENV=production test - Run tests in production mode
# make ENV=staging quality - Run quality checks for staging
#
# Migrated to modular system: 2024-12-08
# ============================================================================
# ============================================================================
# Module Includes
# ============================================================================
# Load all specialized modules in dependency order
-include .makefiles/common.mk # Core utilities, colors, environment
-include .makefiles/quality.mk # Ruff-first linting and formatting
-include .makefiles/testing.mk # Parallel testing with pytest-xdist
-include .makefiles/deps.mk # Dependency management (pip/setuptools)
-include .makefiles/release.mk # Version management and publishing
# ============================================================================
# Default Target
# ============================================================================
.DEFAULT_GOAL := help
# ============================================================================
# Help System
# ============================================================================
.PHONY: help help-all help-quality help-testing help-deps help-release
help: ## Show main help (this screen)
@echo "$(BLUE)════════════════════════════════════════$(NC)"
@echo "$(BLUE)GitFlow Analytics - Modular Makefile System$(NC)"
@echo "$(BLUE)════════════════════════════════════════$(NC)"
@echo ""
@echo "$(GREEN)🚀 Quick Start:$(NC)"
@echo " make install Install package in development mode"
@echo " make test Run all tests (parallel, 3-4x faster)"
@echo " make quality Run all quality checks (Ruff-first)"
@echo " make release-patch Release patch version"
@echo ""
@echo "$(GREEN)📋 Environment Support:$(NC)"
@echo " make ENV=production test - Production settings (strict, fast)"
@echo " make ENV=staging quality - Staging settings (balanced)"
@echo " make ENV=development test - Development settings (verbose, default)"
@echo ""
@echo "$(GREEN)📚 Detailed Help:$(NC)"
@echo " make help-quality Quality & linting targets"
@echo " make help-testing Testing & coverage targets"
@echo " make help-deps Dependency management targets"
@echo " make help-release Version & release targets"
@echo " make help-all Show all available targets"
@echo ""
@echo "$(GREEN)ℹ️ Information:$(NC)"
@echo " make env-info Show environment configuration"
@echo " make show-env Show release environment status"
@echo ""
@echo "$(YELLOW)💡 Performance Improvements:$(NC)"
@echo " • Ruff-first strategy: 10-200x faster linting"
@echo " • Parallel testing: 3-4x faster test execution"
@echo " • Environment-aware builds: optimized for dev/staging/prod"
@echo " • Modular architecture: faster, more maintainable"
help-all: ## Show all available targets with descriptions
@echo "$(BLUE)════════════════════════════════════════$(NC)"
@echo "$(BLUE)All Available Targets$(NC)"
@echo "$(BLUE)════════════════════════════════════════$(NC)"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf " $(CYAN)%-20s$(NC) %s\n", $$1, $$2}' | \
sort
help-quality: ## Show quality and linting targets
@echo "$(BLUE)════════════════════════════════════════$(NC)"
@echo "$(BLUE)Quality & Linting Targets$(NC)"
@echo "$(BLUE)════════════════════════════════════════$(NC)"
@echo " $(CYAN)lint$(NC) Run Ruff linter and formatter check"
@echo " $(CYAN)lint-fix$(NC) Auto-fix linting issues (ruff format + check --fix)"
@echo " $(CYAN)format$(NC) Auto-format code (alias for lint-fix)"
@echo " $(CYAN)type-check$(NC) Run mypy type checker"
@echo " $(CYAN)security-check$(NC) Run security checks with bandit"
@echo " $(CYAN)quality$(NC) Run all quality checks (ruff + mypy)"
@echo " $(CYAN)quality-gate$(NC) Legacy compatibility (quality + security)"
@echo " $(CYAN)quality-ci$(NC) Quality checks for CI/CD (strict, fail fast)"
@echo " $(CYAN)pre-publish$(NC) Comprehensive pre-release quality gate"
@echo " $(CYAN)clean-pre-publish$(NC) Complete pre-publish cleanup"
help-testing: ## Show testing and coverage targets
@echo "$(BLUE)════════════════════════════════════════$(NC)"
@echo "$(BLUE)Testing & Coverage Targets$(NC)"
@echo "$(BLUE)════════════════════════════════════════$(NC)"
@echo " $(CYAN)test$(NC) Run tests with parallel execution (default)"
@echo " $(CYAN)test-parallel$(NC) Run tests in parallel using all CPUs"
@echo " $(CYAN)test-serial$(NC) Run tests serially for debugging"
@echo " $(CYAN)test-fast$(NC) Run unit tests only in parallel (fastest)"
@echo " $(CYAN)test-coverage$(NC) Run tests with coverage report"
@echo " $(CYAN)test-unit$(NC) Run unit tests only"
@echo " $(CYAN)test-integration$(NC) Run integration tests only"
@echo " $(CYAN)test-tui$(NC) Run Terminal User Interface tests"
@echo " $(CYAN)test-cli$(NC) Run Command Line Interface tests"
@echo " $(CYAN)test-ml$(NC) Run Machine Learning tests"
@echo " $(CYAN)test-reports$(NC) Run report generation tests"
@echo " $(CYAN)test-config$(NC) Run configuration tests"
help-deps: ## Show dependency management targets
@echo "$(BLUE)════════════════════════════════════════$(NC)"
@echo "$(BLUE)Dependency Management Targets$(NC)"
@echo "$(BLUE)════════════════════════════════════════$(NC)"
@echo " $(CYAN)install$(NC) Install project in development mode"
@echo " $(CYAN)install-dev$(NC) Install project with development dependencies"
@echo " $(CYAN)install-prod$(NC) Install production dependencies only"
@echo " $(CYAN)deps-check$(NC) Check if dependencies are up to date"
@echo " $(CYAN)deps-update$(NC) Update all dependencies to latest versions"
@echo " $(CYAN)deps-freeze$(NC) Generate requirements.txt from current environment"
@echo " $(CYAN)deps-compile$(NC) Generate requirements.txt using pip-tools"
@echo " $(CYAN)deps-sync$(NC) Sync environment with requirements.txt"
@echo " $(CYAN)deps-outdated$(NC) Show outdated packages"
@echo " $(CYAN)deps-info$(NC) Display dependency information"
help-release: ## Show version and release targets
@echo "$(BLUE)════════════════════════════════════════$(NC)"
@echo "$(BLUE)Version & Release Targets$(NC)"
@echo "$(BLUE)════════════════════════════════════════$(NC)"
@echo ""
@echo "$(GREEN)Version Bumping:$(NC)"
@echo " $(CYAN)version$(NC) Show current version"
@echo " $(CYAN)patch$(NC) Bump patch version (X.Y.Z -> X.Y.Z+1)"
@echo " $(CYAN)minor$(NC) Bump minor version (X.Y.Z -> X.Y+1.0)"
@echo " $(CYAN)major$(NC) Bump major version (X.Y.Z -> X+1.0.0)"
@echo " $(CYAN)commit-version$(NC) Commit version bump and push to main"
@echo ""
@echo "$(GREEN)Build:$(NC)"
@echo " $(CYAN)build$(NC) Build package with uv build"
@echo " $(CYAN)clean$(NC) Remove build artifacts"
@echo " $(CYAN)release-check$(NC) Check prerequisites (git, uv, gh)"
@echo ""
@echo "$(GREEN)Publish Channels:$(NC)"
@echo " $(CYAN)publish-pypi$(NC) Publish to PyPI via uv (uses ~/.pypirc)"
@echo " $(CYAN)publish$(NC) Alias for publish-pypi"
@echo " $(CYAN)gh-release$(NC) Create GitHub release with auto-generated notes"
@echo " $(CYAN)publish-gh$(NC) Alias for gh-release"
@echo " $(CYAN)brew-update$(NC) Update Homebrew tap formula + push"
@echo " $(CYAN)publish-brew$(NC) Alias for brew-update"
@echo " $(CYAN)publish-test$(NC) Publish to TestPyPI for testing"
@echo ""
@echo "$(GREEN)One-Command Workflows:$(NC)"
@echo " $(CYAN)publish-all$(NC) build -> PyPI -> GitHub release -> Homebrew"
@echo " $(CYAN)release-all$(NC) patch + commit-version + publish-all"
@echo ""
@echo "$(GREEN)Release Prep Shortcuts (with quality gate):$(NC)"
@echo " $(CYAN)release-patch$(NC) Check + bump patch + quality build"
@echo " $(CYAN)release-minor$(NC) Check + bump minor + quality build"
@echo " $(CYAN)release-major$(NC) Check + bump major + quality build"
@echo " $(CYAN)release-verify$(NC) Show verification links after publish"
@echo " $(CYAN)release-dry-run$(NC) Preview what a release would do"
@echo ""
@echo "$(GREEN)CI-Friendly Usage:$(NC)"
@echo " make publish-all CONFIRM=yes Skip all interactive prompts"
@echo " make release-all CONFIRM=yes Full automated release pipeline"
# ============================================================================
# Legacy Compatibility Targets
# ============================================================================
# These targets maintain compatibility with the old Makefile interface
# while delegating to the new modular system
.PHONY: quality-gate test-cov version-patch version-minor version-major
quality-gate: quality-gate ## Legacy compatibility for quality-gate (runs quality + security)
test-cov: test-coverage ## Legacy compatibility for test-cov (runs test-coverage)
version-patch: patch ## Legacy compatibility for version-patch (runs patch)
version-minor: minor ## Legacy compatibility for version-minor (runs minor)
version-major: major ## Legacy compatibility for version-major (runs major)
# ============================================================================
# Project-Specific Overrides
# ============================================================================
# Any project-specific customizations can be added here
# These will override the module defaults if needed
# Example: Custom test target for specific GitFlow Analytics needs
# test-custom: ## Custom test configuration for GitFlow Analytics
# @echo "$(YELLOW)🧪 Running GitFlow Analytics custom tests...$(NC)"
# @$(PYTHON) -m pytest $(TEST_DIR)/ -n auto -v --custom-flag
# ============================================================================
# Migration Information
# ============================================================================
.PHONY: migration-info
migration-info: ## Show information about the modular migration
@echo "$(BLUE)════════════════════════════════════════$(NC)"
@echo "$(BLUE)GitFlow Analytics - Modular Migration Info$(NC)"
@echo "$(BLUE)════════════════════════════════════════$(NC)"
@echo ""
@echo "$(GREEN)✅ Migration Complete!$(NC)"
@echo ""
@echo "$(YELLOW)What Changed:$(NC)"
@echo " • Migrated from 477-line monolithic Makefile to modular system"
@echo " • Added Ruff-first strategy (10-200x faster linting)"
@echo " • Added parallel testing with pytest-xdist (3-4x faster)"
@echo " • Added environment-aware builds (dev/staging/production)"
@echo " • Added comprehensive release automation"
@echo " • Maintained full backward compatibility"
@echo ""
@echo "$(YELLOW)Performance Improvements:$(NC)"
@echo " • Linting: Black+multiple tools → Ruff (10-200x faster)"
@echo " • Testing: Serial → Parallel with all CPUs (3-4x faster)"
@echo " • Builds: Single mode → Environment-aware optimization"
@echo ""
@echo "$(YELLOW)New Capabilities:$(NC)"
@echo " • Environment support: make ENV=production test"
@echo " • Auto-fix: make lint-fix (format + fix issues)"
@echo " • Pre-publish gates: make pre-publish"
@echo " • Build metadata tracking: make build-metadata"
@echo ""
@echo "$(GREEN)All existing commands work exactly as before!$(NC)"