-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathMakefile
More file actions
98 lines (80 loc) · 2.81 KB
/
Makefile
File metadata and controls
98 lines (80 loc) · 2.81 KB
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
.PHONY: all install nopyc clean test test-integration build-test-resources docs check local validate-release upload install-waf
SHELL := /usr/bin/env bash
PYTHON_BIN ?= python
PROJECT_VENV ?= venv
INTEGRATION_TEST_RERUN ?= 2
INTEGRATION_TEST_RERUN_DELAY ?= 300
WAF_EXTRAS := capsolver,anticaptcha,2captcha
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 .; \
)
install-waf:
@( \
source $(PROJECT_VENV)/bin/activate; \
python -m pip install ".[$(WAF_EXTRAS)]"; \
)
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) tests/.*config
test: install
@( \
source $(PROJECT_VENV)/bin/activate; \
python -m pip install ".[dev]"; \
coverage run -m pytest -v --ignore=tests/integration -o junit_suite_name=unit && coverage report && coverage xml && coverage html; \
)
test-integration: install
@( \
source $(PROJECT_VENV)/bin/activate; \
python -m pip install ".[dev,integration]"; \
pytest -v --ignore=tests/unit -o junit_suite_name=integration --reruns ${INTEGRATION_TEST_RERUN} --reruns-delay ${INTEGRATION_TEST_RERUN_DELAY}; \
)
build-test-resources: install
@( \
source $(PROJECT_VENV)/bin/activate; \
make local; \
python scripts/build-test-resources.py; \
)
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 amazonorders; \
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 "$$(ls dist/*.tar.gz)"; \
)
validate-release:
@if [[ "${VERSION}" == "" ]]; then echo "VERSION is not set" & exit 1 ; fi
@if [[ $$(grep "__version__ = \"${VERSION}\"" amazonorders/__init__.py) == "" ]] ; then echo "Version not bumped in amazonorders/__init__.py" & exit 1 ; fi
@if [[ $$(grep "``==${VERSION}``" docs/index.rst) == "" ]] ; then echo "Version not bumped in docs/index.rst" & exit 1 ; fi
@if [[ $$(grep "``==${VERSION}``" README.md) == "" ]] ; then echo "Version not bumped in README.md" & exit 1 ; fi
@if [ -f SECURITY.md ]; then \
MAJOR_MINOR=$$(echo "${VERSION}" | cut -d. -f1-2); \
if [[ $$(grep "| $${MAJOR_MINOR}\.x" SECURITY.md) == "" ]] ; then echo "SECURITY.md missing supported-versions entry for $${MAJOR_MINOR}.x" & exit 1 ; fi; \
fi
upload: local
@( \
$(PYTHON_BIN) -m pip install --upgrade twine; \
$(PYTHON_BIN) -m build; \
$(PYTHON_BIN) -m twine upload dist/*; \
)