-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
117 lines (85 loc) · 2.29 KB
/
Makefile
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
.PHONY: \
setup setup-venv setup-requirements setup-pre-commit \
clean full-clean upgrade \
lint audit \
all-tests unittests doctests coverage \
change clog \
release build publish
PYTHON_VERSION := $(shell cat runtime.txt)
RELEASE_LEVELS := patch minor major
# SETUP
setup: setup-venv setup-requirements setup-pre-commit
setup-venv: version ?= $(cat runtime.txt)
setup-venv:
python$(PYTHON_VERSION) -m venv --clear --upgrade-deps .venv
export PATH := $(shell pwd)/.venv/bin:$(PATH)
setup-requirements: req ?= requirements.txt
setup-requirements:
pip install --isolated --no-input --quiet -r '$(req)'
setup-pre-commit:
pre-commit install --install-hooks
clean:
rm -rf MANIFEST build dist
full-clean: clean
rm -rf .venv .tox .nox .pytest_cache .mypy_cache .coverage*
upgrade:
pip-compile \
--upgrade \
--no-header \
--strip-extras \
--annotation-style line \
--output-file requirements/constraints.txt \
setup.cfg \
requirements/*.in
# LINTING
lint:
pre-commit run --all-files
audit:
safety check --file requirements/constraints.txt
# TESTS
all-tests:
tox $(args)
doctests:
xdoctest --quiet wtforms_html5
unittests:
python -m unittest discover
coverage:
coverage erase
coverage run -m unittest discover $(args)
coverage report
# CHANGELOG
change: issue ?= _$(shell < /dev/urandom tr -dc A-Za-z0-9 | head -c9)
change: type ?= feature
change: change_file := changes/$(issue).$(type).md
change:
touch '$(change_file)'
$(EDITOR) '$(change_file)'
clog:
towncrier --draft --version=Unreleased
# PACKAGING
release:
ifneq ($(filter $(part),$(RELEASE_LEVELS)),)
$(eval version = $(shell \
.venv/bin/bumpversion --dry-run --allow-dirty --list $(part) \
| grep '^current_version=' \
| cut -d= -f2 \
))
$(eval new = $(shell \
.venv/bin/bumpversion --dry-run --allow-dirty --list $(part) \
| grep '^new_version=' \
| cut -d= -f2 \
))
@echo "bump $(part) -> $(version) => $(new)"
towncrier --yes --version '$(new)'
if ! git diff --staged --exit-code; then \
git commit -m ':memo: add CHANGELOG for $(new)' --no-verify; \
fi
bumpversion '$(part)' --commit-args='--no-verify'
else
@echo "Given part '$(part)' is not a suported value: $(RELEASE_LEVELS)"
endif
build: clean
python -m build
publish: build
python -m twine check dist/*
python -m twine upload dist/*