-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
134 lines (93 loc) · 2.83 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
SHELL=/bin/bash
.DEFAULT_GOAL := help
# ---------------------------------
# Project specific targets
# ---------------------------------
#
# Add any targets specific to the current project in here.
# -------------------------------
# Common targets for DEV projects
# -------------------------------
#
# Edit these targets so they work as expected on the current project.
#
# Remember there may be other tools which use these targets, so if a target is not suitable for
# the current project, then keep the target and simply make it do nothing.
help: ## This help dialog.
help: help-display
clean: ## Remove unneeded files generated from the various build tasks.
clean: build-clean
reset: ## Reset your local environment. Useful after switching branches, etc.
reset: venv-check venv-wipe install-local
check: ## Check for any obvious errors in the project's setup.
check: pipdeptree-check
format: ## Run this project's code formatters.
format: ruff-format
lint: ## Lint the project.
lint: ruff-lint
test: ## Run unit and integration tests.
test: django-test
test-report: ## Run and report on unit and integration tests.
test-report: coverage-clean test coverage-report
test-lowest: ## Run tox with lowest (oldest) package dependencies.
test-lowest: tox-test-lowest
package: ## Builds source and wheel packages
package: clean build-package
# ---------------
# Utility targets
# ---------------
#
# Targets which are used by the common targets. You likely want to customise these per project,
# to ensure they're pointing at the correct directories, etc.
# Build
build-clean:
rm -rf build
rm -rf dist
rm -rf .eggs
find . -maxdepth 1 -name '*.egg-info' -exec rm -rf {} +
build-package:
python -m build
twine check --strict dist/*
check-wheel-contents dist/*.whl
# Virtual Environments
venv-check:
ifndef VIRTUAL_ENV
$(error Must be in a virtualenv)
endif
venv-wipe: venv-check
if ! pip list --format=freeze | grep -v "^pip=\|^setuptools=\|^wheel=" | xargs pip uninstall -y; then \
echo "Nothing to remove"; \
fi
# Installs
install-local: pip-install-local
# Pip
pip-install-local: venv-check
pip install -r requirements/local.txt
# Coverage
coverage-report: coverage-combine coverage-html
coverage report --show-missing
coverage-combine:
coverage combine
coverage-html:
coverage html
coverage-clean:
rm -rf htmlcov
rm -f .coverage
# ruff
ruff-lint:
ruff check
ruff format --check
ruff-format:
ruff check --fix-only
ruff format
# pipdeptree
pipdeptree-check:
pipdeptree --warn fail >/dev/null
# Project testing
django-test:
PYTHONWARNINGS=all coverage run $$(which django-admin) test --pythonpath $$(pwd) --settings tests.settings tests
tox-test-lowest:
tox --recreate --override testenv.uv_resolution=lowest
# Help
help-display:
@awk '/^[\-[:alnum:]]*: ##/ { split($$0, x, "##"); printf "%20s%s\n", x[1], x[2]; }' $(MAKEFILE_LIST)