-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
197 lines (150 loc) · 7.35 KB
/
Makefile
File metadata and controls
197 lines (150 loc) · 7.35 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
SHELL := /bin/bash
.DEFAULT_GOAL := help
.ONESHELL:
UV_OPTS ?=
UV ?= uv $(UV_OPTS)
.EXPORT_ALL_VARIABLES:
.PHONY: help install dev clean lint fmt test docs
.PHONY: type-check ruff security
.PHONY: docs-serve docs-clean docs-pretalx
.PHONY: install-uv install-prek upgrade
.PHONY: ci
.PHONY: act act-ci act-docs act-list
.PHONY: test-cov test-fast test-seq build destroy
.PHONY: pretalx-generate-http-client pretalx-codegen pretalx-sync-schema
.PHONY: test-pretalx-client
help: ## Display this help text for Makefile
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
# =============================================================================
# Setup & Installation
# =============================================================================
##@ Setup & Installation
install-uv: ## Install latest version of UV
@echo "=> Installing uv"
@curl -LsSf https://astral.sh/uv/install.sh | sh
@echo "=> uv installed"
install-prek: ## Install prek and install hooks
@echo "=> Installing prek hooks"
@$(UV) run prek install
@$(UV) run prek install --hook-type commit-msg
@$(UV) run prek install --hook-type pre-push
@echo "=> prek hooks installed"
@$(UV) run prek autoupdate
@echo "=> prek installed"
install: ## Install package
@echo "=> Installing package"
@$(UV) sync
@echo "=> Installation complete"
dev: ## Run the example Django dev server (clean slate + migrate + bootstrap + seed + runserver)
@rm -f examples/db.sqlite3
@$(UV) run python examples/manage.py migrate --run-syncdb -v 0
@$(UV) run python examples/manage.py bootstrap_conference --config conference.example.toml --update || true
@$(UV) run python examples/seed.py
@echo ""
@echo "=> Dev server: http://localhost:8000/admin/ (admin / admin)"
@$(UV) run python examples/manage.py runserver
upgrade: ## Upgrade all dependencies to the latest stable versions
@echo "=> Upgrading prek"
@$(UV) run prek autoupdate
@$(UV) lock --upgrade
@echo "=> Dependencies upgraded"
# =============================================================================
# Code Quality
# =============================================================================
##@ Code Quality
lint: ## Runs Ruff linter with auto-fix
@$(UV) run --no-sync ruff check --fix .
fmt: ## Runs Ruff format and lint with fixes
@$(UV) run --no-sync ruff format .
@$(UV) run --no-sync ruff check --fix .
ruff: ## Runs Ruff with unsafe fixes
@$(UV) run --no-sync ruff check . --unsafe-fixes --fix
type-check: ## Run ty type checker
@$(UV) run --no-sync ty check
ci: fmt type-check test ## Run all CI checks locally (format, lint, type-check, test)
security: ## Run zizmor GitHub Actions security scanner
@echo "=> Running zizmor security scan on GitHub Actions workflows"
@uvx zizmor .github/workflows/
# =============================================================================
# Testing
# =============================================================================
##@ Testing
test: ## Run the tests
@PYTHONDONTWRITEBYTECODE=1 $(UV) run --no-sync pytest
test-cov: ## Run tests with coverage report
@PYTHONDONTWRITEBYTECODE=1 $(UV) run --no-sync pytest --cov=src/django_program --cov-report=html --cov-report=term
test-fast: ## Run tests without coverage (faster, stop on first failure)
@PYTHONDONTWRITEBYTECODE=1 $(UV) run --no-sync pytest -x -q
test-seq: ## Run tests sequentially (no parallelism, verbose)
@PYTHONDONTWRITEBYTECODE=1 $(UV) run --no-sync pytest -n0 -v
test-pretalx-client: ## Run pretalx-client package tests
@PYTHONDONTWRITEBYTECODE=1 $(UV) run --no-sync pytest packages/pretalx-client/tests/ -v
# =============================================================================
# Pretalx Codegen
# =============================================================================
##@ Pretalx Codegen
pretalx-generate-http-client: ## Generate HTTP client from OpenAPI schema
@$(UV) run python scripts/pretalx/generate_http_client.py
pretalx-codegen: ## Full codegen pipeline (validate + models + HTTP client)
@$(UV) run python scripts/pretalx/validate_schema.py
@$(UV) run python scripts/pretalx/generate_client.py
@$(UV) run python scripts/pretalx/generate_http_client.py
pretalx-sync-schema: pretalx-codegen ## Alias for pretalx-codegen (used by CI workflow)
# =============================================================================
# Documentation
# =============================================================================
##@ Documentation
docs: docs-clean ## Build all documentation (django-program + pretalx-client)
@echo "=> Building pretalx-client documentation (first, for intersphinx)"
@$(UV) sync --group docs
@$(UV) run sphinx-build -M html packages/pretalx-client/docs packages/pretalx-client/docs/_build/ -E -a -j auto --keep-going
@echo "=> Building django-program documentation"
@$(UV) run sphinx-build -M html docs docs/_build/ -E -a -j auto --keep-going
docs-serve: docs-clean ## Serve documentation with live reload
@echo "=> Serving documentation"
@$(UV) sync --group docs
@$(UV) run sphinx-autobuild docs docs/_build/ -j auto --port 0
docs-pretalx: ## Build pretalx-client documentation only
@echo "=> Building pretalx-client documentation"
@$(UV) sync --group docs
@rm -rf packages/pretalx-client/docs/_build
@$(UV) run sphinx-build -M html packages/pretalx-client/docs packages/pretalx-client/docs/_build/ -E -a -j auto --keep-going
docs-clean: ## Clean all documentation build assets
@echo "=> Cleaning documentation build assets"
@rm -rf docs/_build packages/pretalx-client/docs/_build
@echo "=> Removed existing documentation build assets"
# =============================================================================
# Build & Release
# =============================================================================
##@ Build & Release
build: ## Build package
@$(UV) build
clean: ## Autogenerated file cleanup
@echo "=> Cleaning up autogenerated files"
@rm -rf .pytest_cache .ruff_cache .hypothesis build/ dist/ .eggs/
@find . -name '*.egg-info' -exec rm -rf {} + 2>/dev/null || true
@find . -name '*.egg' -exec rm -rf {} + 2>/dev/null || true
@find . -name '*.pyc' -exec rm -rf {} + 2>/dev/null || true
@find . -name '*.pyo' -exec rm -rf {} + 2>/dev/null || true
@find . -name '*~' -exec rm -rf {} + 2>/dev/null || true
@find . -name '__pycache__' -exec rm -rf {} + 2>/dev/null || true
@rm -rf .coverage coverage.xml coverage.json htmlcov/
$(MAKE) docs-clean
destroy: ## Destroy the virtual environment
@rm -rf .venv
# =============================================================================
# Local GitHub Actions
# =============================================================================
##@ Local GitHub Actions (act)
act: ## Run all CI workflows locally with act
@echo "=> Running CI workflows locally with act"
@act -l 2>/dev/null || (echo "Error: 'act' not installed. Install with: brew install act" && exit 1)
@act push --container-architecture linux/amd64
act-ci: ## Run CI workflow locally
@echo "=> Running CI workflow locally"
@act push -W .github/workflows/ci.yml --container-architecture linux/amd64
act-docs: ## Run docs workflow locally
@echo "=> Running docs workflow locally"
@act push -W .github/workflows/docs.yml --container-architecture linux/amd64
act-list: ## List available act jobs
@act -l