-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
105 lines (77 loc) · 2.3 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
# Miscellaneous tools:
# Software tests, Documentation builder, Virtual environment builder
# ------
# Common
# ------
$(eval venvpath := .venv)
$(eval pip := $(venvpath)/bin/pip)
$(eval python := $(venvpath)/bin/python)
$(eval bumpversion := $(venvpath)/bin/bumpversion)
$(eval twine := $(venvpath)/bin/twine)
$(eval sphinx := $(venvpath)/bin/sphinx-build)
$(eval nose2 := $(venvpath)/bin/nose2)
$(eval coverage := $(venvpath)/bin/coverage)
$(eval black := $(venvpath)/bin/black)
$(eval isort := $(venvpath)/bin/isort)
$(eval proselint := $(venvpath)/bin/proselint)
setup-virtualenv:
@test -e $(python) || python3 -m venv $(venvpath)
@$(pip) install wheel
# -------
# Testing
# -------
setup-test: setup-virtualenv
@$(pip) install --editable=.[test]
test: setup-test
@$(nose2) \
$(options) \
--verbose \
beradio
test-coverage:
$(MAKE) test options="--with-coverage --coverage-report=term-missing"
$(coverage) xml
# --with-doctest --doctest-tests --doctest-extension=rst \
# --with-coverage --cover-package=beradio --cover-tests \
# --cover-html --cover-html-dir=coverage/html --cover-xml --cover-xml-file=coverage/coverage.xml
# -------------
# Documentation
# -------------
setup-docs: setup-virtualenv
$(pip) install --requirement=requirements-docs.txt
docs-html: setup-docs
@$(pip) install --editable=.
touch doc/source/index.rst
export SPHINXBUILD="$(shell pwd)/$(sphinx)"; cd doc; make html
# ---------
# Releasing
# ---------
#
# Release targets for convenient release cutting.
#
# Synopsis::
#
# make release bump={patch,minor,major}
#
setup-release: setup-virtualenv
$(pip) install --requirement=requirements-release.txt
bumpversion:
$(bumpversion) $(bump)
push:
git push && git push --tags
build:
$(python) -m build
upload:
$(twine) upload --skip-existing dist/*{.tar.gz,.whl}
release: setup-release bumpversion push build upload
# ----------------------
# Formatting and linting
# ----------------------
format: setup-virtualenv
$(pip) install --requirement=requirements-utils.txt
$(black) .
$(isort) .
lint: setup-virtualenv
$(pip) install --requirement=requirements-utils.txt
$(black) --check beradio testing
$(isort) --check beradio testing
$(proselint) *.rst doc/source/**/*.rst