-
Notifications
You must be signed in to change notification settings - Fork 50
/
Makefile
60 lines (46 loc) · 1.7 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
SERVICE_NAME := kooper
SHELL := $(shell which bash)
DOCKER := $(shell command -v docker)
OSTYPE := $(shell uname)
GID := $(shell id -g)
UID := $(shell id -u)
# cmds
UNIT_TEST_CMD := ./hack/scripts/unit-test.sh
INTEGRATION_TEST_CMD := ./hack/scripts/integration-test.sh
CI_INTEGRATION_TEST_CMD := ./hack/scripts/integration-test-kind.sh
GEN_CMD := ./hack/scripts/gen.sh
DOCKER_RUN_CMD := docker run --env ostype=$(OSTYPE) -v ${PWD}:/src --rm -it ${SERVICE_NAME}
DEPS_CMD := go mod tidy
CHECK_CMD := ./hack/scripts/check.sh
help: ## Show this help
@echo "Help"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[93m %s\n", $$1, $$2}'
.PHONY: default
default: help
.PHONY: build
build: ## Build the development docker image.
docker build -t $(SERVICE_NAME) --build-arg uid=$(UID) --build-arg gid=$(GID) -f ./docker/dev/Dockerfile .
.PHONY: deps
deps: ## Updates the required dependencies.
$(DEPS_CMD)
.PHONY: integration-test
integration-test: build ## Runs integration tests out of CI.
echo "[WARNING] Requires a kubernetes cluster configured (and running) on your kubeconfig!!"
$(INTEGRATION_TEST_CMD)
.PHONY: test
test: build ## Runs unit tests out of CI.
$(DOCKER_RUN_CMD) /bin/sh -c '$(UNIT_TEST_CMD)'
.PHONY: check
check: build ## Runs checks.
@$(DOCKER_RUN_CMD) /bin/sh -c '$(CHECK_CMD)'
.PHONY: ci-unit-test
ci-unit-test: ## Runs unit tests in CI.
$(UNIT_TEST_CMD)
.PHONY: ci-integration-test
ci-integration-test: ## Runs integration tests in CI.
$(CI_INTEGRATION_TEST_CMD)
.PHONY: ci ## Runs all tests in CI.
ci: ci-unit-test ci-integration-test
.PHONY: gen
gen: build ## Generates go code.
$(DOCKER_RUN_CMD) /bin/sh -c '$(GEN_CMD)'