-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
93 lines (73 loc) · 1.87 KB
/
Makefile
File metadata and controls
93 lines (73 loc) · 1.87 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
.PHONY: default
default:
.PHONY: install-deps
install-deps:
pipenv install --dev
.PHONY: update-deps
update-deps:
pipenv update --dev
.PHONY: check
check: lint test
.PHONY: lint
lint: lint-black lint-isort lint-pyflakes lint-mypy
.PHONY: lint-black
lint-black:
pipenv run black --check --diff .
.PHONY: lint-isort
lint-isort:
pipenv run isort --check .
.PHONY: lint-pyflakes
lint-pyflakes:
pipenv run pyflakes .
.PHONY: lint-mypy
lint-mypy:
pipenv run mypy setup.py
pipenv run mypy tests
pipenv run mypy src/enapter
.PHONY: test
test: test-unit test-integration
.PHONY: test-unit
test-unit:
pipenv run pytest -vv --cov --cov-report term-missing tests/unit
.PHONY: test-integration
test-integration:
# TODO: Figure out why integration tests time out in CI environment.
ifdef CI
$(warning skipping integration tests in CI environment)
else
pipenv run pytest -vv --capture=no tests/integration
endif
.PHONY: get-pipenv
get-pipenv:
curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python
.PHONY: upload-to-pypi
upload-to-pypi: dist
ifndef PYPI_API_TOKEN
$(error PYPI_API_TOKEN is not defined)
endif
@pipenv run twine upload \
--username __token__ \
--password $(PYPI_API_TOKEN) \
$</*
dist.tar: dist
rm --force $@
tar --create --file $@ $<
.PHONY: dist
dist:
pipenv run python setup.py bdist_wheel
RE_SEMVER = [0-9]+.[0-9]+.[0-9]+(-[a-z0-9]+)?
.PHONY: bump-version
bump-version:
ifndef V
$(error V is not defined)
endif
sed -E -i 's/__version__ = "$(RE_SEMVER)"/__version__ = "$(V)"/g' src/enapter/__init__.py
grep -E --files-with-matches --recursive "enapter==$(RE_SEMVER)" README.md examples \
| xargs -n 1 sed -E -i "s/enapter==$(RE_SEMVER)/enapter==$(V)/g"
git add .
git commit -m "bump version to $(V)"
git tag "v$(V)"
DOCKER_IMAGE_TAG ?= enapter/python-sdk:dev
.PHONY: docker-image
docker-image:
docker build -t $(DOCKER_IMAGE_TAG) .