-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
71 lines (54 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
.PHONY = all testenv install package test test_in_containers test_in_container_37 test_in_container_38 clean container version
HERE := $(shell pwd)
HERE_OWNERSHIP := $(shell stat -c '%u:%g' $(HERE))
FIX_OWNERSHIP := chown -R $(HERE_OWNERSHIP)
SETUP_CONTAINER_FOR_TESTS := cd /src;pip install -r requirements.txt
ifndef CI
CI_ENV=$(HERE)/.ci-env/bin/
endif
all: test package
testenv: version
ifndef CI
echo "Outside CI"
test -d .ci-env || ( mkdir .ci-env && virtualenv -p python3 .ci-env) && .ci-env/bin/python3 -m pip install --upgrade pip
.ci-env/bin/pip install -r requirements.txt -r requirements-dev.txt --upgrade
endif
ifdef CI
echo "Within CI"
pip install -r requirements.txt -r requirements-dev.txt
endif
version:
./scripts/versiongen
install: testenv
$(CI_ENV)python setup.py install
package:
python setup.py sdist
test: testenv install
$(CI_ENV)coverage erase
$(CI_ENV)pycodestyle "avakas"
$(CI_ENV)pylint "avakas"
./scripts/integration
$(CI_ENV)coverage report -m
test -z $(TRAVIS) && $(CI_ENV)coverage erase || true
generate_testing_artifact: testenv
tox --sdistonly
test_in_container_37: generate_testing_artifact
docker run -v "$(HERE):/src" python:3.7 bash -c '$(SETUP_CONTAINER_FOR_TESTS); tox -e py37;$(FIX_OWNERSHIP) /src'
test_in_container_38: generate_testing_artifact
docker run -v "$(HERE):/src" python:3.8 bash -c '$(SETUP_CONTAINER_FOR_TESTS);tox -e py38;$(FIX_OWNERSHIP) /src'
# Long term these versions should not be hardcoded, upon
# viability of the tox-via-docker plugin, that should be used.
test_in_containers: test_in_container_37 test_in_container_38
clean:
# The touch and remove is because the setup.py depends on a file existing
# which isn't actually tracked in git
touch version
rm -rf .bats-git .bats .ci-env avakas.egg-info dist build .coverage .tox
python setup.py clean
rm version
distclean: clean
rm -rf .bats-git .ci-env
container:
docker build \
--tag otakup0pe/avakas:local \
.