forked from OneIdentity/bldr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
92 lines (74 loc) · 2.44 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
VIRTUALENV ?= .venv
RELEASE_TEST_VENV ?= .release-test-venv
PYCODESTYLE ?= $(VIRTUALENV)/bin/python3 -m pycodestyle
AUTOPEP8 ?= $(VIRTUALENV)/bin/python3 -m autopep8
FLAKE8 ?= $(VIRTUALENV)/bin/python3 -m flake8
MYPY ?= $(VIRTUALENV)/bin/python3 -m mypy
PIP_COMPILE ?= $(VIRTUALENV)/bin/pip-compile --no-emit-trusted-host --no-emit-index-url --upgrade --resolver=backtracking
# Auto format by coding style check
.PHONY: autocs
autocs: dev
$(AUTOPEP8) --in-place --recursive .
# Auto format diff by coding style check
.PHONY: autocs-diff
autocs-diff: dev
$(AUTOPEP8) --diff --recursive .
# Coding style check
.PHONY: cs
cs: dev
$(PYCODESTYLE)
.PHONY: lint
lint: dev
$(FLAKE8)
$(MYPY)
# Run tests
.PHONY: check
check: dev
. $(VIRTUALENV)/bin/activate && pytest
# Run tests with specific docker-image
.PHONY: check-docker-image
check-docker-image: dev
. $(VIRTUALENV)/bin/activate && pytest --docker-image=$(DOCKER_IMAGE)
# Run tests on one selected docker image
.PHONY: quick-check
quick-check:
. $(VIRTUALENV)/bin/activate && pytest --docker-image=ubuntu:focal
# Update requirements files for setup.py
.PHONY: update-requirements
update-requirements: $(VIRTUALENV)/bin/python3
$(VIRTUALENV)/bin/pip3 install --upgrade pip-tools
$(PIP_COMPILE) --output-file requirements.txt requirements.in
$(PIP_COMPILE) --output-file requirements-dev.txt requirements-dev.in
# Create a virtualenv in .venv or the directory given in the following form: 'make VIRTUALENV=.venv2 install'
$(VIRTUALENV)/bin/python3:
python3 -m venv $(VIRTUALENV)
$(VIRTUALENV)/bin/pip install --upgrade pip
.PHONY: venv
venv: $(VIRTUALENV)/bin/python3
.PHONY: release
release:
make venv VIRTUALENV=$(RELEASE_TEST_VENV)
$(RELEASE_TEST_VENV)/bin/pip3 install wheel
$(RELEASE_TEST_VENV)/bin/python3 setup.py sdist bdist_wheel
$(RELEASE_TEST_VENV)/bin/pip install dist/*.whl
$(RELEASE_TEST_VENV)/bin/pip3 install -r requirements-dev.txt
.PHONY: release-test
release-test: release
. $(RELEASE_TEST_VENV)/bin/activate && pytest --docker-image=ubuntu:focal
# Install development dependencies (for testing) in virtualenv
.PHONY: dev
dev: venv
$(VIRTUALENV)/bin/pip3 install -e '.[dev]'
# Clean directory and delete virtualenv
.PHONY: clean
clean:
-$(VIRTUALENV)/bin/python3 setup.py clean --all
-$(RELEASE_TEST_VENV)/bin/python3 setup.py clean --all
rm -rf $(VIRTUALENV)
rm -rf $(RELEASE_TEST_VENV)
.PHONY: get-version
get-version:
cat bldr/VERSION
.PHONY: bump-version
bump-version:
@./bump_version.py