-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathMakefile
More file actions
216 lines (176 loc) · 6.72 KB
/
Makefile
File metadata and controls
216 lines (176 loc) · 6.72 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
# Python command - uses venv if available, otherwise system python
VENV_PYTHON := .venv/bin/python
PYTHON := $(shell if [ -f $(VENV_PYTHON) ]; then echo $(VENV_PYTHON); else command -v python3 2> /dev/null || command -v python 2> /dev/null; fi)
.PHONY: help
help: ## Show this help message
@echo 'Usage: make [target]'
@echo ''
@echo 'Available targets:'
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-20s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.PHONY: test
test: ## Run core tests (fast, no package builds)
@$(PYTHON) -m pytest tests/ \
-n auto \
--ignore=tests/test_integration.py \
--ignore=tests/test_synthetic.py
.PHONY: test-synthetic
test-synthetic: ## Run synthetic package tests
@$(PYTHON) -m pytest tests/test_synthetic.py -n auto
.PHONY: test-integration
test-integration: ## Run integration tests with external packages
@$(PYTHON) -m pytest tests/test_integration.py -n auto
.PHONY: test-all
test-all: ## Run all tests (core + synthetic + integration)
@$(PYTHON) -m pytest tests/ -n auto
.PHONY: test-coverage
test-coverage: ## Run tests with coverage report
@$(PYTHON) -m pytest \
--cov=great_docs \
--cov-report=term-missing \
--cov-report=html \
tests/ -v
.PHONY: test-verbose
test-verbose: ## Run tests with verbose output
@$(PYTHON) -m pytest tests/ -vv
.PHONY: lint
lint: ## Run ruff formatter and linter
@$(PYTHON) -m ruff format
@$(PYTHON) -m ruff check --fix
.PHONY: format
format: ## Format code with ruff
@$(PYTHON) -m ruff format
.PHONY: check-format
check-format: ## Check code formatting without making changes
@$(PYTHON) -m ruff format --check
@$(PYTHON) -m ruff check
.PHONY: type-check
type-check: ## Run type checking with mypy
@$(PYTHON) -m mypy great_docs --python-version 3.8
@$(PYTHON) -m mypy great_docs --python-version 3.9
@$(PYTHON) -m mypy great_docs --python-version 3.10
@$(PYTHON) -m mypy great_docs --python-version 3.11
@$(PYTHON) -m mypy great_docs --python-version 3.12
.PHONY: type-check-renderer
type-check-renderer: ## Run type checking with pyright on the renderer
@$(PYTHON) -m pyright great_docs/_renderer/_render
.PHONY: check
check: lint test ## Run all checks (lint and test)
.PHONY: clean
clean: clean-build clean-pyc clean-test ## Remove all build, test, coverage and Python artifacts
.PHONY: clean-build
clean-build: ## Remove build artifacts
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +
.PHONY: clean-pyc
clean-pyc: ## Remove Python file artifacts
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
.PHONY: clean-test
clean-test: ## Remove test and coverage artifacts
rm -fr .tox/
rm -f .coverage
rm -fr htmlcov/
rm -fr .pytest_cache
rm -fr .mypy_cache/
.PHONY: build
build: clean ## Build source and wheel distribution
@$(PYTHON) -m build
.PHONY: dist
dist: build ## Alias for build
.PHONY: install
install: ## Install the package in editable mode
@pip install -e .
.PHONY: install-dev
install-dev: ## Install package with development dependencies
@pip install -e ".[dev]"
.PHONY: uninstall
uninstall: ## Uninstall the package
@pip uninstall -y great-docs
.PHONY: reinstall
reinstall: uninstall install ## Reinstall the package
.PHONY: publish-test
publish-test: clean build ## Publish to TestPyPI
@python -m twine upload --repository testpypi dist/*
.PHONY: publish
publish: clean build ## Publish to PyPI
@python -m twine upload dist/*
.PHONY: test-install
test-install: build ## Test installation in a clean environment
@echo "Testing installation from wheel..."
@pip install --force-reinstall dist/great_docs*.whl
@great-docs --version
@great-docs --help
.PHONY: test-cli
test-cli: ## Test the CLI in a temp directory
@echo "Testing CLI installation..."
@mkdir -p /tmp/test_great_docs
@cd /tmp/test_great_docs && great-docs init --force
@echo "CLI test passed"
@rm -rf /tmp/test_great_docs
.PHONY: dev-setup
dev-setup: ## Set up development environment
@pip install -e ".[dev]"
@echo "Development environment ready"
.PHONY: docs-build
docs-build: ## Build documentation with Quarto
@cd docs && quarto render
.PHONY: docs-preview
docs-preview: ## Preview documentation locally
@cd docs && quarto preview
.PHONY: docs-install
docs-install: ## Install documentation dependencies
@pip install -e ".[docs]"
.PHONY: site-build
site-build: ## Build the great-docs site
@great-docs build
.PHONY: hub-build
hub-build: ## Full build of the Great Docs Gauntlet (200 packages, port 3333)
@$(PYTHON) test-packages/render_all.py --build
.PHONY: hub-resume
hub-resume: ## Resume an interrupted full GDG build (skip already-ok packages)
@$(PYTHON) test-packages/render_all.py --build --skip-ok
.PHONY: hub-rebuild
hub-rebuild: ## Selective GDG rebuild: make hub-rebuild PKG="gdtest_minimal gdtest_github_icon"
@test -n "$(PKG)" || (echo "Usage: make hub-rebuild PKG=\"name1 name2\"" && exit 1)
@$(PYTHON) test-packages/render_all.py --build --only $(PKG)
.PHONY: hub-refresh
hub-refresh: ## Reassemble GDG hub pages (updates test coverage, no rebuild)
@$(PYTHON) -c "\
import sys; sys.path.insert(0, 'test-packages'); \
from build_state import load_state; \
from render_all import assemble_hub, STATE_FILE, _result_from_state; \
from synthetic.catalog import ALL_PACKAGES; \
state = load_state(STATE_FILE); \
pkgs = state.get('packages', {}); \
results = [_result_from_state(n, pkgs[n]) for n in ALL_PACKAGES if n in pkgs]; \
assemble_hub(results, state=state)" 2>/dev/null || \
echo "No build state found. Run 'make hub-build' first."
.PHONY: hub-open
hub-open: ## Open the Great Docs Gauntlet in the default browser
@open test-packages/_rendered/_hub/index.html 2>/dev/null || \
xdg-open test-packages/_rendered/_hub/index.html 2>/dev/null || \
echo "GDG page: test-packages/_rendered/_hub/index.html"
.PHONY: hub-serve
hub-serve: ## Serve the Great Docs Gauntlet locally (port 3333)
@$(PYTHON) test-packages/render_all.py --serve
.PHONY: hub-state
hub-state: ## Show GDG build state summary
@$(PYTHON) -c "\
import sys, json; sys.path.insert(0, 'test-packages'); \
from build_state import load_state, summary; \
from pathlib import Path; \
p = Path('test-packages/_rendered/_build_state.json'); \
s = load_state(p); \
info = summary(s); info['last_run_id'] = s.get('last_run_id'); \
print(json.dumps(info, indent=2))" 2>/dev/null || \
echo "No build state found. Run 'make hub-build' first."
.PHONY: hub-deploy
hub-deploy: ## Trigger GDG hub deployment to GitHub Pages (requires gh CLI)
@gh workflow run deploy.yml --repo rich-iannone/gdg \
-f great_docs_ref=$$(git rev-parse --abbrev-ref HEAD) && \
echo "Deployment triggered. Watch at: https://github.com/rich-iannone/gdg/actions"