-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
82 lines (71 loc) · 2.48 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
VIRTUAL_ENV_PATH=venv
SKIP_VENV="${NO_VENV}"
PYPI_API_KEY :=
PYPI_REPOSITORY_URL :=
ALPHA_VERSION :=
.DEFAULT_GOAL := pre_commit
pre_commit: copyright format lint
copyright:
@( \
if [ -z $(SKIP_VENV) ]; then source $(VIRTUAL_ENV_PATH)/bin/activate; fi; \
echo "Applying copyright..."; \
./development/copyright-update; \
echo "DONE: copyright"; \
)
flake8:
@( \
set -e; \
if [ -z $(SKIP_VENV) ]; then source $(VIRTUAL_ENV_PATH)/bin/activate; fi; \
echo "Runing Flake8 checks..."; \
flake8 ./src/healthcheckbot --count --statistics; \
echo "DONE: Flake8"; \
)
mypy:
@( \
set -e; \
if [ -z $(SKIP_VENV) ]; then source $(VIRTUAL_ENV_PATH)/bin/activate; fi; \
echo "Runing MyPy checks..."; \
#mypy --show-error-codes ./src/healthcheckbot; \
echo "DONE: MyPy"; \
)
lint: flake8 mypy
build: copyright format lint clean
@( \
set -e; \
if [ -z $(SKIP_VENV) ]; then source $(VIRTUAL_ENV_PATH)/bin/activate; fi; \
echo "Building wheel package..."; \
bash -c "cd src && VERSION_OVERRIDE="$(ALPHA_VERSION)" python ./setup.py bdist_wheel --dist-dir=../dist --bdist-dir=../../build"; \
echo "DONE: wheel package"; \
)
@( \
set -e; \
if [ -z $(SKIP_VENV) ]; then source $(VIRTUAL_ENV_PATH)/bin/activate; fi; \
echo "Building source distribution..."; \
bash -c "cd src && VERSION_OVERRIDE="$(ALPHA_VERSION)" python ./setup.py sdist --dist-dir=../dist"; \
echo "DONE: source distribution"; \
)
clean:
@(rm -rf src/build dist/* *.egg-info src/*.egg-info .pytest_cache)
format:
@( \
if [ -z $(SKIP_VENV) ]; then source $(VIRTUAL_ENV_PATH)/bin/activate; fi; \
echo "Runing Black code formater..."; \
black ./src/healthcheckbot; \
echo "DONE: Black"; \
)
publish:
@( \
set -e; \
if [ -z $(SKIP_VENV) ]; then source $(VIRTUAL_ENV_PATH)/bin/activate; fi; \
if [ ! -z $(PYPI_API_KEY) ]; then export TWINE_USERNAME="__token__"; export TWINE_PASSWORD="$(PYPI_API_KEY)"; fi; \
if [ ! -z $(PYPI_REPOSITORY_URL) ]; then export TWINE_REPOSITORY_URL="$(PYPI_REPOSITORY_URL)"; fi; \
echo "Uploading to PyPi"; \
twine upload -r pypi dist/*; \
echo "DONE: Publish"; \
)
set-version:
@( \
if [ -z $(VERSION) ]; then echo "Missing VERSION argument"; exit 1; fi; \
echo '__version__ = "$(VERSION)"' > ./src/healthcheckbot/__version__.py; \
echo "Version updated: $(VERSION)"; \
)