-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
62 lines (48 loc) · 2.04 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
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
MODULE := $(shell basename ${ROOT_DIR} | tr - _)
VERSION := $(shell awk '/^version =/ {print $$3}' pyproject.toml)
VENV_DIR := ${HOME}/.venv/${MODULE}
VENV_BIN := ${VENV_DIR}/bin
PYTHON ?= python3
PIP := ${VENV_DIR}/bin/pip
SPHINX_FLAGS := -b html ./docs public
SPHINX_WEBSITE_FLAGS := --port 8100 --host localhost --open-browser --watch ${MODULE}
all: unittest coverage lint
${VENV_BIN}:
${PYTHON} -m venv ${VENV_DIR}
. ${VENV_BIN}/activate; pip install poetry
. ${VENV_BIN}/activate; poetry install
virtualenv: ${VENV_BIN}
clean:
@rm -rf build dist .DS_Store .pytest_cache .cache .eggs .coverage coverage.xml public
@find . -name '__pycache__' -print0 | xargs -0r rm -rf
@find . -name '*.egg-info' -print0 | xargs -0r rm -rf
@find . -name '*.pyc' -print0 | xargs -0r rm -rf
@find . -name '*.tox' -print0 | xargs -0r rm -rf
@find . -name 'htmlcov' -print0 | xargs -0r rm -rf
build: virtualenv
. ${VENV_BIN}/activate; poetry build
doc-devel: virtualenv
export PYTHONPATH=${ROOT_DIR}
. ${VENV_BIN}/activate; vaskitsa documentation generate ${ROOT_DIR}
. ${VENV_BIN}/activate; sphinx-autobuild ${SPHINX_WEBSITE_FLAGS} ${SPHINX_FLAGS}
doc: virtualenv
export PYTHONPATH=${ROOT_DIR}
. ${VENV_BIN}/activate; vaskitsa documentation generate ${ROOT_DIR}
. ${VENV_BIN}/activate; sphinx-build ${SPHINX_FLAGS}
unittest: virtualenv
. ${VENV_BIN}/activate && poetry run coverage run --source "${MODULE}" --module pytest
coverage: virtualenv
. ${VENV_BIN}/activate && poetry run coverage html
. ${VENV_BIN}/activate && poetry run coverage report
lint: virtualenv
. ${VENV_BIN}/activate && poetry run ruff "${MODULE}" tests
. ${VENV_BIN}/activate && poetry run flake8
. ${VENV_BIN}/activate && poetry run pycodestyle "${MODULE}" tests
. ${VENV_BIN}/activate && poetry run mypy "${MODULE}" tests
publish: virtualenv clean build
. ${VENV_BIN}/activate && poetry publish
tag-release:
git tag --annotate ${VERSION} --message "Publish release ${VERSION}"
git push origin ${VERSION}
.PHONY: all test