-
Notifications
You must be signed in to change notification settings - Fork 184
/
Makefile
85 lines (62 loc) · 1.78 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
# ============
# Main targets
# ============
# -------------
# Configuration
# -------------
$(eval venvpath := .venv)
$(eval pip := $(venvpath)/bin/pip)
$(eval python := $(venvpath)/bin/python)
$(eval pytest := $(venvpath)/bin/pytest)
$(eval twine := $(venvpath)/bin/twine)
$(eval sphinx := $(venvpath)/bin/sphinx-build)
$(eval sphinx-autobuild := $(venvpath)/bin/sphinx-autobuild)
$(eval isort := $(venvpath)/bin/isort)
$(eval black := $(venvpath)/bin/black)
$(eval poe := $(venvpath)/bin/poe)
# Setup Python virtualenv
setup-virtualenv:
@test -e $(python) || python3 -m venv $(venvpath)
$(pip) install versioningit
# -------
# Testing
# -------
# Run the main test suite
test: install-tests
@$(poe) test
test-refresh: install-tests test
test-junit: install-tests
@$(pytest) -vvv tests --junit-xml .pytest_results/pytest.xml
test-coverage: install-tests
@$(pytest) --cov-report html:.pytest_results/htmlcov
# ----------------------
# Linting and Formatting
# ----------------------
format: install-tests
$(poe) format
# -------
# Release
# -------
# Release this piece of software
release:
poe release
# -------------
# Documentation
# -------------
# Build the documentation
docs-html: install-doctools
cd docs; make html
docs-serve:
cd docs/_build/html; python3 -m http.server
docs-autobuild: install-doctools
$(sphinx-autobuild) --open-browser docs docs/_build
# ===============
# Utility targets
# ===============
install-doctools:
@test -e $(python) || python3 -m venv $(venvpath)
$(pip) install --quiet --upgrade --requirement=docs/requirements.txt
install-tests: setup-virtualenv
@test -e $(pytest) || $(pip) install --editable=.[test,develop] --upgrade
@touch $(venvpath)/bin/activate
@mkdir -p .pytest_results