-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
87 lines (75 loc) · 2.4 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
ORG=seequent
APP=lfview-api-client
MODULE=lfview
.PHONY: build build27 run notebooks-docker notebooks tests tests27 \
docs lint-yapf lint-pylint publish
build:
docker build -t $(ORG)/$(APP):latest -f Dockerfile .
build27:
docker build -t $(ORG)/$(APP):latest27 -f Dockerfile.27 .
run: build
docker run --rm \
--name=$(APP) \
-v $(shell pwd)/$(MODULE):/usr/src/app/$(MODULE) \
$(ORG)/$(APP):latest \
ipython
notebooks-docker: build
docker run --rm \
--name=$(APP)-notebooks \
-p 127.0.0.1:8899:8899 \
-v $(shell pwd)/$(MODULE):/usr/src/app/$(MODULE) \
-v $(shell pwd)/notebooks:/usr/src/app/notebooks \
$(ORG)/$(APP):latest \
python -m notebook /usr/src/app/notebooks --ip 0.0.0.0 --port 8899 --allow-root
notebooks-local:
python -m notebook $(shell pwd)/notebooks --ip 0.0.0.0 --port 8899 --allow-root
tests: build
mkdir -p cover
docker run --rm \
--name=$(APP)-tests \
-v $(shell pwd)/$(MODULE):/usr/src/app/$(MODULE) \
-v $(shell pwd)/tests:/usr/src/app/tests \
-v $(shell pwd)/cover:/usr/src/app/cover \
$(ORG)/$(APP):latest \
bash -c "pytest --cov=$(MODULE) --cov-report term --cov-report html:cover tests/ && mv .coverage cover/.coverage"
mv -f cover/.coverage ./
tests27: build27
docker run --rm \
--name=$(APP)-tests \
-v $(shell pwd)/$(MODULE):/usr/src/app/$(MODULE) \
-v $(shell pwd)/tests:/usr/src/app/tests \
$(ORG)/$(APP):latest27 \
bash -c "pytest tests/"
docs: build
docker run --rm \
--name=$(APP)-docs \
-v $(shell pwd)/$(MODULE):/usr/src/app/$(MODULE) \
-v $(shell pwd)/docs:/usr/src/app/docs \
$(ORG)/$(APP):latest \
bash -c "cd docs && make html"
lint-yapf: build
docker run --rm \
--name=$(APP)-tests \
-v $(shell pwd)/.style.yapf:/usr/src/app/.style.yapf \
-v $(shell pwd)/$(MODULE):/usr/src/app/$(MODULE) \
-v $(shell pwd)/tests:/usr/src/app/tests \
$(ORG)/$(APP):latest \
yapf -rd $(MODULE) tests
lint-pylint: build
docker run --rm \
--name=$(APP)-tests \
-v $(shell pwd)/.pylintrc:/usr/src/app/.pylintrc \
-v $(shell pwd)/$(MODULE):/usr/src/app/$(MODULE) \
-v $(shell pwd)/tests:/usr/src/app/tests \
$(ORG)/$(APP):latest \
pylint --rcfile=.pylintrc $(MODULE) tests
publish: build
mkdir -p dist
docker run --rm \
--name=$(APP)-publish \
-v $(shell pwd)/$(MODULE):/usr/src/app/$(MODULE) \
-v $(shell pwd)/dist:/usr/src/app/dist \
$(ORG)/$(APP) \
python setup.py sdist bdist_wheel
pip install twine
twine upload dist/*