-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
71 lines (61 loc) · 2.48 KB
/
Copy pathMakefile
File metadata and controls
71 lines (61 loc) · 2.48 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
.PHONY: install
install: ## Install the virtual environment and the pre-commit hooks
@echo "🚀 Creating virtual environment using uv"
@uv sync
@uv run pre-commit install
.PHONY: check
check: ## Run code quality tools
@echo "🚀 Checking lock file consistency with 'pyproject.toml'"
@uv lock --locked
@echo "🚀 Linting code: Running pre-commit"
@uv run pre-commit run --files $$(git ls-files --cached --others --exclude-standard)
@echo "🚀 Static type checking: Running ty"
@uv run ty check
@echo "🚀 Checking for obsolete dependencies: Running deptry"
@uv run deptry src
.PHONY: test
test: ## Test the code with pytest
@echo "🚀 Testing code: Running pytest"
@uv run python -m pytest --cov --cov-config=pyproject.toml --cov-report=xml
.PHONY: bench
bench: ## Run the performance benchmarks
@echo "🚀 Running benchmarks: pytest-benchmark"
@uv run python -m pytest -c pytest.benchmark.ini \
--benchmark-autosave --benchmark-json=benchmark_results.json
.PHONY: build
build: clean-build ## Build wheel file
@echo "🚀 Creating wheel file"
@uvx --from build pyproject-build --installer uv
.PHONY: clean-build
clean-build: ## Clean build artifacts
@echo "🚀 Removing build artifacts"
@uv run python -c "import shutil; import os; shutil.rmtree('dist') if os.path.exists('dist') else None"
.PHONY: publish
publish: ## Publish a release to PyPI (CI does this via trusted publishing)
@echo "🚀 Publishing."
@uvx twine upload --repository-url https://upload.pypi.org/legacy/ dist/*
.PHONY: docs-test
docs-test: ## Test if documentation can be built without warnings or errors
@uv run zensical build -s
.PHONY: docs
docs: ## Build and serve the documentation
@uv run zensical serve
.PHONY: ci
ci: check docs-test test ## Run everything CI runs, before pushing
@# docs-test before test, not after: the tests that read the built HTML
@# skip when site/ is missing, so in the other order they never run on a
@# clean tree, and a page that shipped its own macro call to the reader
@# passed the gate.
@# Name the branch: `make ci` is the last thing run before pushing, and a
@# green gate on the wrong branch is an easy mistake to make.
@branch=$$(git branch --show-current 2>/dev/null); \
if [ -n "$$branch" ]; then \
echo "✅ Ready to push on branch '$$branch'"; \
else \
echo "✅ Ready to push"; \
fi
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-12s\033[0m %s\n", $$1, $$2}'
.DEFAULT_GOAL := help