-
-
Notifications
You must be signed in to change notification settings - Fork 58
/
Makefile
76 lines (62 loc) · 1.92 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
.PHONY: all install nopyc clean test docs check local validate-release test-downstream upload
SHELL := /usr/bin/env bash
PYTHON_BIN ?= python
PROJECT_VENV ?= venv
all: local check test
venv:
$(PYTHON_BIN) -m pip install virtualenv --user
$(PYTHON_BIN) -m virtualenv $(PROJECT_VENV)
install: venv
@( \
source $(PROJECT_VENV)/bin/activate; \
python -m pip install .; \
)
nopyc:
find . -name '*.pyc' | xargs rm -f || true
find . -name __pycache__ | xargs rm -rf || true
clean: nopyc
rm -rf build dist *.egg-info $(PROJECT_VENV) pyngrok-example-flask
test: install
@( \
source $(PROJECT_VENV)/bin/activate; \
python -m pip install ".[dev]"; \
coverage run -m unittest discover -v -b && coverage report && coverage xml && coverage html; \
)
docs: install
@( \
source $(PROJECT_VENV)/bin/activate; \
python -m pip install ".[docs]"; \
sphinx-build -M html docs build/docs -n; \
)
check: install
@( \
source $(PROJECT_VENV)/bin/activate; \
python -m pip install ".[dev,docs]"; \
mypy --strict pyngrok; \
flake8; \
)
local:
@rm -rf *.egg-info dist
@( \
$(PYTHON_BIN) -m pip install --upgrade pip; \
$(PYTHON_BIN) -m pip install --upgrade build; \
$(PYTHON_BIN) -m build; \
$(PYTHON_BIN) -m pip install dist/*.tar.gz; \
)
validate-release:
@if [[ "${VERSION}" == "" ]]; then echo "VERSION is not set" & exit 1 ; fi
@if [[ $$(grep "__version__ = \"${VERSION}\"" pyngrok/__init__.py) == "" ]] ; then echo "Version not bumped in pyngrok/__init__.py" & exit 1 ; fi
test-downstream:
@( \
git clone https://github.com/alexdlaird/pyngrok-example-flask.git; \
( make -C pyngrok-example-flask install ) || exit $$?; \
source pyngrok-example-flask/venv/bin/activate; \
( make local ) || exit $$?; \
cd pyngrok-example-flask && pytest -v && cd ..; \
)
upload: local
@( \
$(PYTHON_BIN) -m pip install --upgrade twine; \
$(PYTHON_BIN) -m build; \
$(PYTHON_BIN) -m twine upload dist/*; \
)