-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
67 lines (53 loc) · 2.27 KB
/
Makefile
File metadata and controls
67 lines (53 loc) · 2.27 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
.PHONY: help install format lint typecheck test-unit test-dist test-cluster test ci clean all
# --- ANSI Color Codes ---
BLUE=\033[1;34m
GREEN=\033[1;32m
YELLOW=\033[1;33m
NC=\033[0m # No Color
# --- Helper Macro for Clean Output ---
define PRINT_STAGE
@echo "\n$(BLUE)=== $(1) ===$(NC)"
endef
# Default target
all: format lint typecheck test
help: ## Show this help menu
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'
install: ## Install dependencies using uv
$(call PRINT_STAGE, Installing Dependencies)
uv sync --all-extras --dev
format: ## Auto-format Python code using Ruff
$(call PRINT_STAGE, Formatting Code)
uv run ruff check --fix .
uv run ruff format .
lint: ## Run linters (Ruff and Markdown)
$(call PRINT_STAGE, Running Linters)
uv run ruff check .
uv run ruff format --check .
@if command -v markdownlint >/dev/null 2>&1; then \
markdownlint "**/*.md" --ignore ".venv"; \
elif command -v npx >/dev/null 2>&1; then \
npx --yes markdownlint-cli "**/*.md" --ignore ".venv"; \
else \
echo "$(YELLOW)⚠ 'markdownlint' and 'npx' not found. Skipping markdownlint. (Requires Node.js or markdownlint-cli)$(NC)"; \
fi
typecheck: ## Run static type checking with Mypy
$(call PRINT_STAGE, Running Type Checks)
uv run mypy .
test-unit: ## Run Tier 1 unit tests with coverage
$(call PRINT_STAGE, Running Tier 1: Unit Tests)
uv run pytest --cov
test-dist: ## Run Tier 2 distributed sandbox tests
$(call PRINT_STAGE, Running Tier 2: Distributed Sandbox)
bash scripts/test_distributed.sh
test-cluster: ## Spawn Tier 3 Multipass VM cluster for OS field testing
$(call PRINT_STAGE, Provisioning Tier 3: Field Test Cluster)
bash scripts/spawn_cluster.sh
test: test-unit test-dist ## Run all automated testing tiers (1 & 2)
@echo "\n$(GREEN)✔ All automated test tiers passed successfully.$(NC)"
ci: install lint typecheck test ## Run the exact pipeline executed by GitHub Actions
@echo "\n$(GREEN)✔ Local CI pipeline completed successfully. Clear to push!$(NC)"
clean: ## Remove cache directories and test artifacts
$(call PRINT_STAGE, Cleaning Workspace)
rm -rf .pytest_cache .mypy_cache .ruff_cache
find . -type d -name "__pycache__" -exec rm -rf {} +
@echo "$(GREEN)✔ Environment cleaned.$(NC)"