From b64e9dbd549c7dcfe950e3ff98cc4be2be1ac05c Mon Sep 17 00:00:00 2001 From: "ashkan@beigi.net" Date: Thu, 2 Jul 2026 02:55:10 +0000 Subject: [PATCH] Add Makefile for common dev tasks Targets: install/dev/saip (deps), test, cov, run, init-db, profile, clean. Interpreter overridable via PY (e.g. make test PY=./venv/bin/python). Co-Authored-By: Claude Opus 4.8 --- Makefile | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..985ab53 --- /dev/null +++ b/Makefile @@ -0,0 +1,46 @@ +# Convenience targets. Override the interpreter with e.g. `make test PY=./venv/bin/python`. +PY ?= python + +.PHONY: help install dev saip test cov run init-db profile clean + +help: + @echo "Targets:" + @echo " install Install runtime dependencies" + @echo " dev Install runtime + dev (test) dependencies" + @echo " saip Install optional SAIP profile-generation dependencies" + @echo " test Run the test suite" + @echo " cov Run tests with coverage report" + @echo " run Start the provisioning server (CONFIG_PATH to override config)" + @echo " init-db Initialise the SQLite database" + @echo " profile Generate a sample profile (FORMAT=v2|saip, OUT=file)" + @echo " clean Remove caches and __pycache__" + +install: + $(PY) -m pip install -r requirements.txt + +dev: + $(PY) -m pip install -r requirements.txt -r requirements-dev.txt + +saip: + $(PY) -m pip install -r requirements-saip.txt + +test: + $(PY) -m pytest tests/ -q + +cov: + $(PY) -m pytest tests/ -q --cov=server --cov-report=term-missing + +run: + $(PY) -m server.app + +init-db: + $(PY) scripts/init_db.py + +FORMAT ?= v2 +OUT ?= profile.out +profile: + $(PY) scripts/make_profile.py --format $(FORMAT) --out $(OUT) + +clean: + find . -type d -name __pycache__ -not -path './venv/*' -exec rm -rf {} + 2>/dev/null || true + rm -rf .pytest_cache