-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Makefile
59 lines (48 loc) · 1.69 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
KUBECONFIG_PATH?=./integration.yaml
CLUSTER_NAME=bonny-ex
.PHONY: help
help: ## Show this help
help:
@grep -E '^[\/a-zA-Z0-9._%-]+:.*?## .*$$' Makefile | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
all: test lint docs analyze
integration.yaml: ## Create a kind cluster
$(MAKE) cluster.delete cluster.create
kind export kubeconfig --kubeconfig ${KUBECONFIG_PATH} --name "${CLUSTER_NAME}"
.PHONY: test.integration
test.integration: integration.yaml
test.integration: ## Run integration tests using kind `make cluster`
kubectl config use-context kind-${CLUSTER_NAME}
MIX_ENV=test mix compile
MIX_ENV=test mix bonny.gen.manifest -o - | kubectl apply -f -
TEST_KUBECONFIG=${KUBECONFIG_PATH} mix test --only integration
.PHONY: cluster.delete
cluster.delete: ## Delete kind cluster
- kind delete cluster --kubeconfig ${KUBECONFIG_PATH} --name "${CLUSTER_NAME}"
rm -f ${KUBECONFIG_PATH}
.PHONY: cluster.create
cluster.create: ## Created kind cluster
kind create cluster --wait 600s --name "${CLUSTER_NAME}"
.PHONY: lint
lint:
mix format
mix credo
.PHONY: test
test: integration.yaml
test:
kubectl config use-context kind-${CLUSTER_NAME}
MIX_ENV=test mix compile
MIX_ENV=test mix bonny.gen.manifest -o - | kubectl apply -f -
TEST_KUBECONFIG=${KUBECONFIG_PATH} mix test --include integration --cover
.PHONY: test.watch
test.watch: integration.yaml
test.watch: ## Run all tests with mix.watch
kubectl config use-context kind-${CLUSTER_NAME}
MIX_ENV=test mix compile
MIX_ENV=test mix bonny.gen.manifest -o - | kubectl apply -f -
TEST_KUBECONFIG=${KUBECONFIG_PATH} mix test.watch --include integration
.PHONY: analyze
analyze:
mix dialyzer
.PHONY: docs
docs:
mix docs