-
Notifications
You must be signed in to change notification settings - Fork 18
/
Makefile
77 lines (63 loc) · 2.62 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
.PHONY: clean clean-test clean-pyc clean-build test lint coverage upload dist bumpversion-patch bumpversion-minor bumpversion-major install install-dev
## remove all build, test, coverage and Python artifacts
clean: clean-build clean-pyc clean-test
## remove build artifacts
clean-build:
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg' -exec rm -f {} +
## remove Python file artifacts
clean-pyc:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
rm -rf .mypy_cache/
## remove test and coverage artifacts
clean-test:
rm -fr .tox/
rm -f .coverage
rm -fr htmlcov/
rm -fr .cache/
rm -fr .pytest_cache
## check style with flake8, black
lint: clean
pipenv run black . --check
pipenv run flake8 bwapi tests --exit-zero
## run tests with the default Python
test: lint
pipenv run pytest -vv --cov=bwapi
## check code coverage quickly with the default Python
coverage: clean
pipenv run pytest -vv --cov=bwapi --cov-report html --cov-report term
@echo '✨ 🍰 ✨ Open "htmlcov/index.html" in your browser to view report'
## upload wheel
upload: dist
pipenv run twine upload -r pypi dist/bwapi*
## increment the patch version, and tag in git
bumpversion-patch: clean
pipenv run bumpversion --verbose patch
## increment the minor version, and tag in git
bumpversion-minor: clean
pipenv run bumpversion --verbose minor
## increment the major version, and tag in git
bumpversion-major: clean
pipenv run bumpversion --verbose major
## builds source and wheel package
dist: clean
pipenv run python setup.py sdist bdist_wheel
## install the package to the pipenv virtualenv
install: clean
pipenv install
## install the package and all development dependencies to the pipenv virtualenv
install-dev: clean
pipenv install --dev
##############################################################################
# Self Documenting Commands #
##############################################################################
.DEFAULT_GOAL := show-help
# See <https://gist.github.com/klmr/575726c7e05d8780505a> for explanation.
.PHONY: show-help
show-help:
@echo "$$(tput bold)Available rules:$$(tput sgr0)";echo;sed -ne"/^## /{h;s/.*//;:d" -e"H;n;s/^## //;td" -e"s/:.*//;G;s/\\n## /---/;s/\\n/ /g;p;}" ${MAKEFILE_LIST}|LC_ALL='C' sort -f|awk -F --- -v n=$$(tput cols) -v i=19 -v a="$$(tput setaf 6)" -v z="$$(tput sgr0)" '{printf"%s%*s%s ",a,-i,$$1,z;m=split($$2,w," ");l=n-i;for(j=1;j<=m;j++){l-=length(w[j])+1;if(l<= 0){l=n-i-length(w[j])-1;printf"\n%*s ",-i," ";}printf"%s ",w[j];}printf"\n";}'