-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
86 lines (68 loc) · 2.76 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
.DEFAULT_GOAL:=help
.EXPORT_ALL_VARIABLES:
ifndef VERBOSE
.SILENT:
endif
# set default shell
SHELL=/usr/bin/env bash -o pipefail -o errexit
TAG ?= $(shell cat TAG)
POETRY_HOME ?= ${HOME}/.local/share/pypoetry
POETRY_BINARY ?= ${POETRY_HOME}/venv/bin/poetry
POETRY_VERSION ?= 1.3.2
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
.PHONY: show-version
show-version: ## Display version
echo -n "${TAG}"
.PHONY: build
build: ## Build example package
echo "[build] Build example package."
${POETRY_BINARY} build
.PHONY: install
install: ## Install example with poetry
@build/install.sh
.PHONY: image
image: ## Build example image
@build/image.sh
.PHONY: metrics
metrics: install ## Run example metrics checks
echo "[metrics] Run example PEP 8 checks."
${POETRY_BINARY} run flake8 --select=E,W,I --max-line-length 88 --import-order-style pep8 --statistics --count example
echo "[metrics] Run example PEP 257 checks."
${POETRY_BINARY} run flake8 --select=D --ignore D301 --statistics --count example
echo "[metrics] Run example pyflakes checks."
${POETRY_BINARY} run flake8 --select=F --statistics --count example
echo "[metrics] Run example code complexity checks."
${POETRY_BINARY} run flake8 --select=C901 --statistics --count example
echo "[metrics] Run example open TODO checks."
${POETRY_BINARY} run flake8 --select=T --statistics --count example tests
echo "[metrics] Run example black checks."
${POETRY_BINARY} run black --check example
.PHONY: unit-test
unit-test: install ## Run example unit tests
echo "[unit-test] Run example unit tests."
${POETRY_BINARY} run pytest tests/unit
.PHONY: integration-test
integration-test: install ## Run example integration tests
echo "[unit-test] Run example integration tests."
${POETRY_BINARY} run pytest tests/integration
.PHONY: coverage
coverage: install ## Run example tests coverage
echo "[coverage] Run example tests coverage."
${POETRY_BINARY} run pytest --cov=example --cov-fail-under=90 --cov-report=xml --cov-report=term-missing tests
.PHONY: test
test: unit-test integration-test ## Run example tests
.PHONY: docs
docs: install ## Build example documentation
echo "[docs] Build example documentation."
${POETRY_BINARY} run sphinx-build docs site
.PHONY: mypy
mypy: install ## Run example mypy checks
echo "[mypy] Run example mypy checks."
${POETRY_BINARY} run mypy example
.PHONY: dev-env
dev-env: image ## Start a local Kubernetes cluster using minikube and deploy application
@build/dev-env.sh
.PHONY: clean
clean: ## Remove .cache directory and cached minikube
minikube delete && rm -rf ~/.cache ~/.minikube