Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
75 lines (61 loc) · 2.36 KB
/
Copy pathMakefile
File metadata and controls
75 lines (61 loc) · 2.36 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
IMAGE_TAG ?= science-template:verify
UV ?= uv
.PHONY: init lock sync lint test docs smoke local-verify verify docker-build docker-verify docker-verify-rw clean
init:
python scripts/init_project.py
lock:
$(UV) lock
sync:
@if [ -f uv.lock ]; then \
$(UV) sync --group dev --group docs --frozen; \
else \
echo "WARNING: uv.lock missing; resolving dependencies from pyproject.toml"; \
$(UV) sync --group dev --group docs; \
fi
lint:
$(UV) run --no-sync ruff check .
test:
$(UV) run --no-sync pytest
docs:
$(UV) run --no-sync sphinx-build -W -b html docs/source docs/build/html
smoke:
$(UV) run --no-sync python app/main.py
local-verify: sync lint test docs smoke
verify: docker-verify
docker-build:
docker build -f .devcontainer/Dockerfile -t $(IMAGE_TAG) .
# Canonical gate: the checkout is read-only; all installation/build writes happen in /tmp/work.
docker-verify: docker-build
docker run --rm \
-v "$(CURDIR)":/work:ro \
-e HOME=/tmp \
-e XDG_CACHE_HOME=/tmp/.cache \
-e UV_CACHE_DIR=/tmp/uv-cache \
-e PYTHONNOUSERSITE=1 \
$(IMAGE_TAG) \
sh -lc 'cp -a /work /tmp/work \
&& cd /tmp/work \
&& if [ -f uv.lock ]; then uv sync --group dev --group docs --frozen; else echo "WARNING: uv.lock missing; resolving dependencies"; uv sync --group dev --group docs; fi \
&& uv run --no-sync ruff check . \
&& uv run --no-sync pytest \
&& uv run --no-sync sphinx-build -W -b html docs/source docs/build/html \
&& uv run --no-sync python app/main.py'
# Debug only: permits writes to the checkout and is intentionally not used by CI.
docker-verify-rw: docker-build
@echo "WARNING: read-write verification may create local artifacts."
docker run --rm \
-v "$(CURDIR)":/work \
-w /work \
-e HOME=/tmp \
-e XDG_CACHE_HOME=/tmp/.cache \
-e UV_CACHE_DIR=/tmp/uv-cache \
-e PYTHONNOUSERSITE=1 \
$(IMAGE_TAG) \
sh -lc 'if [ -f uv.lock ]; then uv sync --group dev --group docs --frozen; else echo "WARNING: uv.lock missing; resolving dependencies"; uv sync --group dev --group docs; fi \
&& uv run --no-sync ruff check . \
&& uv run --no-sync pytest \
&& uv run --no-sync sphinx-build -W -b html docs/source docs/build/html \
&& uv run --no-sync python app/main.py'
clean:
rm -rf .venv build dist .pytest_cache .ruff_cache docs/build src/*.egg-info
find . -type d -name "__pycache__" -prune -exec rm -rf {} +