-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
137 lines (104 loc) · 2.98 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
135
136
137
.PHONY: help clean clean-pyc clean-build list test test-dbg test-cov test-all coverage docs release sdist install install-dev install-ci lint mypy isort isort-check
project-name = hello_python
version-var := "__version__ = "
version-string := $(shell grep $(version-var) $(project-name)/version.py)
version := $(subst __version__ = ,,$(version-string))
help:
@echo "install - install"
@echo "install-dev - install also development dependencies"
@echo "clean - clean all below"
@echo "clean-build - remove build artifacts"
@echo "clean-pyc - remove Python file artifacts"
@echo "clean-tox - clean tox cache"
@echo "lint - check style with flake8"
@echo "test - run tests quickly with the default Python"
@echo "test-cov - run tests with the default Python and report coverage"
@echo "test-dbg - run tests and debug with pdb"
@echo "develop - run tests in loop mode"
@echo "deploy - deploy"
@echo "mypy - check type hinting with mypy"
@echo "isort - sort imports"
@echo "isort-check - check if your imports are correctly sorted"
@echo "build - create the distribution package"
@echo "release - package a release in wheel and tarball, requires twine"
install:
python -m pip install pipenv
pipenv install
python -m pip install .
install-ci:
python -m pip install pipenv
pipenv install --dev
python -m pip install -e .
install-dev: install-ci
pre-commit install
clean: clean-build clean-pyc clean-caches
clean-build:
rm -fr build/
rm -fr dist/
rm -fr .eggs/
rm -fr *.egg-info
rm -fr *.spec
clean-pyc:
pyclean $(project-name)
find . -name '*~' -exec rm -f {} +
find . -name __pycache__ -exec rm -rf {} +
find . -name '*.log*' -delete
find . -name '*_cache' -exec rm -rf {} +
find . -name '*.egg-info' -exec rm -rf {} +
clean-caches:
rm -rf .tox
rm -rf .pytest_cache
lint:
tox -e lint
test:
tox -e tests
mypy:
tox -e mypy
isort-check:
tox -e isort
isort:
isort -rc hello_python/
test-cov:
py.test --cov-report term-missing --cov=$(project-name)
test-dbg:
py.test --pdb
develop:
py.test --color=yes -f
coverage:
pytest --cov=hansel
coverage report -m
build:
python -m pip install pep517
python -m pep517.build -s -b .
pypi:
twine upload dist/*
release: clean build pypi
tag:
$(eval GIT_VERSION=`git rev-parse --short HEAD`)
@echo "Creating git tag v$(version)"
@echo "Creating git tag $(GIT_VERSION)"
git tag v$(version)
git tag $(GIT_VERSION)
git push --tags
patch:
pipenv run bumpversion patch
minor:
pipenv run bumpversion minor
major:
pipenv run bumpversion major
prodtag: clean
@echo "Creating git tag prod_`date "+%Y_%m_%d_%H_%M"`"
git tag prod_`date "+%Y_%m_%d_%H_%M"`
git push --tags
qatag: clean
@echo "Creating git tag qa_`date "+%Y_%m_%d_%H_%M"`"
git tag qa_`date "+%Y_%m_%d_%H_%M"`
git push --tags
devtag: clean
@echo "Creating git tag dev_`date "+%Y_%m_%d_%H_%M"`"
git tag dev_`date "+%Y_%m_%d_%H_%M"`
git push --tags
inttag: clean
@echo "Creating git tag int_`date "+%Y_%m_%d_%H_%M"`"
git tag int_`date "+%Y_%m_%d_%H_%M"`
git push --tags