-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
50 lines (48 loc) · 1.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
SHELL=/bin/bash
usr := $(shell id -u):$(shell id -g)
img := richardbann/coltab
################################################################################
# self documenting makefile
################################################################################
.DEFAULT_GOAL := help
.PHONY: help
help: bold = $(shell tput bold; tput setaf 3)
help: reset = $(shell tput sgr0)
help:
@echo
@sed -nr \
-e '/^## /{s/^## / /;h;:a;n;/^## /{s/^## / /;H;ba};' \
-e '/^[[:alnum:]_\-]+:/ {s/(.+):.*$$/$(bold)\1$(reset):/;G;p};' \
-e 's/^[[:alnum:]_\-]+://;x}' ${MAKEFILE_LIST}
@echo
################################################################################
.PHONY: build
## Build the docker container
build:
docker build -t $(img) .
################################################################################
.PHONY: test
## Run tests
test:
docker run --rm -i -u $(usr) \
-v "$(CURDIR):/project" \
-e "PYTHONPATH=/project" \
-w "/project" \
$(img) coverage run -m unittest discover
docker run --rm -u $(usr) \
-v "$(CURDIR):/project" \
-w "/project" \
$(img) coverage html
################################################################################
.PHONY: deploy
## deploy to pypi
deploy:
-rm -rf dist
docker run --rm -i -u $(usr) \
-v "$(CURDIR):/project" \
-w "/project" \
$(img) python3 setup.py sdist
docker run --rm -i -t -u $(usr) \
-v "$(CURDIR):/project" \
-w "/project" \
$(img) twine upload dist/*