-
Notifications
You must be signed in to change notification settings - Fork 37
/
Makefile
42 lines (32 loc) · 985 Bytes
/
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
.PHONY: help clean test
.DEFAULT_GOAL := help
DOCKER_REPO="ovalmoney/celery-exporter"
DOCKER_VERSION="latest"
define PRINT_HELP_PYSCRIPT
import re, sys
for line in sys.stdin:
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
print("%-20s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT
all: clean test docker_build ## Clean and Build
clean: ## Clean folders
rm -rf dist/ *.egg-info
test: ## Run tests and coverage
coverage run -m pytest test/ \
&& coverage report
docker_build: ## Build Docker file
export DOCKER_REPO
export DOCKER_VERSION
docker build \
--build-arg DOCKER_REPO=${DOCKER_REPO} \
--build-arg VERSION=${DOCKER_VERSION} \
--build-arg VCS_REF=`git rev-parse --short HEAD` \
--build-arg BUILD_DATE=`date -u +”%Y-%m-%dT%H:%M:%SZ”` \
-f ./Dockerfile \
-t ${DOCKER_REPO}:${DOCKER_VERSION} \
.
help: ## Print this help
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)