Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
51 lines (40 loc) · 1.6 KB
/
Copy pathMakefile
File metadata and controls
51 lines (40 loc) · 1.6 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
.DEFAULT_GOAL := help
PYTHON ?= python3
TAG_VERSION ?= $(or $(VERSION),$(filter v%,$(MAKECMDGOALS)))
RELEASE_KIND := $(filter major minor patch,$(MAKECMDGOALS))
.PHONY: help test quality check release-check tag release major minor patch
help:
@echo "PyFiberModes development commands"
@echo ""
@echo " make test Run the test suite"
@echo " make quality Run static quality checks"
@echo " make check Run tests, quality, and release checks"
@echo " make release-check Check version metadata consistency"
@echo " make tag VERSION=vX.Y.Z Create a release commit and annotated tag"
@echo " make release patch Create and push the next patch release"
@echo " make release minor Create and push the next minor release"
@echo " make release major Create and push the next major release"
ifneq ($(filter tag,$(MAKECMDGOALS)),)
ifneq ($(strip $(TAG_VERSION)),)
.PHONY: $(TAG_VERSION)
$(TAG_VERSION):
@:
endif
endif
test:
MPLBACKEND=Agg $(PYTHON) -m pytest
quality:
$(PYTHON) -m ruff check PyFiberModes tests tools
$(PYTHON) -m mypy
release-check:
$(PYTHON) tools/check_release.py $(if $(VERSION),--version $(VERSION),)
check: quality test release-check
tag:
$(PYTHON) tools/release_tag.py "$(TAG_VERSION)"
release:
@test "$(words $(RELEASE_KIND))" -eq 1 || { echo "usage: make release [patch|minor|major]" >&2; exit 2; }
@set -eu; release_tag="$$($(PYTHON) tools/next_release_version.py $(RELEASE_KIND))"; \
$(PYTHON) tools/release_tag.py "$$release_tag"; \
git push origin HEAD "refs/tags/$$release_tag"
major minor patch:
@: