-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
30 lines (24 loc) · 884 Bytes
/
Copy pathMakefile
File metadata and controls
30 lines (24 loc) · 884 Bytes
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
.PHONY: test build release-check release
VERSION ?=
TAG := v$(VERSION)
PYTHON ?= python3
ifneq ($(wildcard .venv/bin/python),)
PYTHON := .venv/bin/python
endif
test:
$(PYTHON) -m pytest tests -q
build:
$(PYTHON) -m build --sdist --wheel
release-check:
@test -n "$(VERSION)" || { echo "VERSION is required. Use: make release VERSION=X.Y.Z" >&2; exit 1; }
@test -f pyproject.toml || { echo "Run this target from the repository root." >&2; exit 1; }
@$(PYTHON) packaging/release_check.py "$(VERSION)"
$(PYTHON) -m pytest tests -q
release: release-check
@if git rev-parse "refs/tags/$(TAG)" >/dev/null 2>&1; then \
echo "Tag $(TAG) already exists." >&2; \
exit 1; \
fi
@git tag -a "$(TAG)" -m "Release $(TAG)"
@git push --atomic origin "$$(git rev-parse --abbrev-ref HEAD)" "$(TAG)"
@echo "Pushed $(TAG). GitHub Actions will build artifacts and publish the release."