-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMakefile
More file actions
135 lines (104 loc) · 5.09 KB
/
Makefile
File metadata and controls
135 lines (104 loc) · 5.09 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
# ContextGO — developer task runner
# Usage: make <target>
# Run `make help` for a full target listing.
PYTHON := python3
PIP := $(PYTHON) -m pip
PYTEST := $(PYTHON) -m pytest
RUFF := ruff
SCRIPTS := scripts
TESTS := tests
BENCHMARKS := docs/benchmarks
.PHONY: help install install-remote dev-check \
lint format type-check \
test test-fast test-cov \
smoke smoke-installed health bench e2e \
build dist check-dist \
release-dry-run \
clean clean-dist clean-native clean-all
# ---------------------------------------------------------------------------
# Default target
# ---------------------------------------------------------------------------
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}' | sort
@echo ""
@echo " Core workflow: install → lint → test → smoke → build"
# ---------------------------------------------------------------------------
# Installation
# ---------------------------------------------------------------------------
install: ## Install package and dev dependencies (editable)
$(PIP) install -e ".[dev]"
install-remote: ## Also install optional remote/httpx extra
$(PIP) install -e ".[dev,remote]"
# ---------------------------------------------------------------------------
# Code quality
# ---------------------------------------------------------------------------
lint: ## Run ruff check and format-check (non-destructive)
$(RUFF) check src/contextgo/ $(SCRIPTS)/ $(TESTS)/ $(BENCHMARKS)/
$(RUFF) format --check src/contextgo/ $(SCRIPTS)/ $(TESTS)/ $(BENCHMARKS)/
format: ## Auto-format and auto-fix with ruff
$(RUFF) format src/contextgo/ $(SCRIPTS)/ $(TESTS)/ $(BENCHMARKS)/
$(RUFF) check --fix src/contextgo/ $(SCRIPTS)/ $(TESTS)/ $(BENCHMARKS)/
type-check: ## Run mypy type checking (informational)
$(PYTHON) -m mypy src/contextgo/ --ignore-missing-imports || true
dev-check: lint ## Full pre-commit check: syntax + lint
bash -n $(SCRIPTS)/*.sh
$(PYTHON) -m py_compile src/contextgo/*.py $(SCRIPTS)/*.py
# ---------------------------------------------------------------------------
# Testing
# ---------------------------------------------------------------------------
test: ## Run full pytest suite with coverage
$(PYTEST) $(TESTS) \
--cov=src/contextgo --cov-report=term-missing --cov-report=xml -v
test-fast: ## Run tests without coverage (faster iteration)
$(PYTEST) $(TESTS) -v --no-cov
test-cov: test ## Run tests and open HTML coverage report
$(PYTHON) -m coverage html
@echo "Coverage report: htmlcov/index.html"
# ---------------------------------------------------------------------------
# Runtime verification
# ---------------------------------------------------------------------------
smoke: ## Run smoke suite in sandboxed mode
$(PYTHON) src/contextgo/context_cli.py smoke --sandbox
smoke-installed: ## Run installed runtime and installed CLI wrapper smoke
$(PYTHON) $(SCRIPTS)/smoke_installed_runtime.py
$(PYTHON) $(SCRIPTS)/smoke_installed_cli.py
health: ## Run health check via CLI
$(PYTHON) src/contextgo/context_cli.py health
e2e: ## Run end-to-end quality gate
$(PYTHON) $(SCRIPTS)/e2e_quality_gate.py
bench: ## Run benchmark harness (Python vs native-wrapper)
PYTHONPATH=docs $(PYTHON) -m benchmarks --mode both --iterations 1 --warmup 0 --query benchmark --format text
# ---------------------------------------------------------------------------
# Build and distribution
# ---------------------------------------------------------------------------
build: ## Build sdist and wheel into dist/
$(PIP) install --quiet build
$(PYTHON) -m build
check-dist: build ## Validate distribution with twine
$(PIP) install --quiet twine
twine check dist/*
release-dry-run: check-dist ## Validate release artifacts without uploading
@echo "dist/ contents:"
@ls -lh dist/
@echo ""
@echo "VERSION: $$(cat VERSION)"
@echo "Release dry-run passed — push a v* tag to trigger the Release workflow."
# ---------------------------------------------------------------------------
# Cleanup
# ---------------------------------------------------------------------------
clean: ## Remove Python bytecode and cache directories
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete 2>/dev/null || true
find . -type f -name ".coverage" -delete 2>/dev/null || true
find . -type d -name "htmlcov" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name ".mypy_cache" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name ".ruff_cache" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name ".pytest_cache" -exec rm -rf {} + 2>/dev/null || true
rm -rf artifacts/ 2>/dev/null || true
clean-dist: ## Remove build artifacts
rm -rf dist/ build/ *.egg-info src/*.egg-info
clean-native: ## Remove Rust/Go build artifacts
rm -rf native/session_scan/target/ 2>/dev/null || true
rm -f native/session_scan_go/session_scan_go native/session_scan_go/coverage.out 2>/dev/null || true
clean-all: clean clean-dist clean-native ## Full clean (bytecode + build + native)