This repository was archived by the owner on Dec 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
53 lines (40 loc) · 1.86 KB
/
Makefile
File metadata and controls
53 lines (40 loc) · 1.86 KB
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
OK_COLOR=\033[32;01m
NO_COLOR=\033[0m
MAKE_COLOR=\033[33;01m%-20s\033[0m
all: tools lint test ## install tools, lint and test
deps: ## install dependencies
@echo "$(OK_COLOR)--> Download go.mod dependencies$(NO_COLOR)"
go mod download
go mod vendor
tools: ## install dev tools, linters, code generators, etc..
@echo "$(OK_COLOR)--> Installing tools from tools/tools.go$(NO_COLOR)"
@export GOBIN=$$PWD/tools/bin; export PATH=$$GOBIN:$$PATH; cat tools/tools.go | grep _ | awk -F'"' '{print $$2}' | xargs -tI % go install %
lint: ## run linters
@echo "$(OK_COLOR)--> Running linters$(NO_COLOR)"
tools/bin/golangci-lint run
test: test-unit test-e2e ## run all tests
test-unit: ## run unit tests
@echo "$(OK_COLOR)--> Running unit tests$(NO_COLOR)"
go test --race --count=1 ./...
test-e2e: ## run e2e tests
@echo "$(OK_COLOR)--> Running E2E tests$(NO_COLOR)"
go test --tags "e2e" --race --count=1 ./tests/e2e/...
test-coverage: ## run all tests with coverage
@echo "$(OK_COLOR)--> Generating code coverage$(NO_COLOR)"
tools/coverage.sh
test-docker: ## run tests in docker
@echo "$(OK_COLOR)--> Running tests in Docker$(NO_COLOR)"
docker-compose up --build --abort-on-container-exit
fmt: ## format go files
@echo "$(OK_COLOR)--> Formatting go files$(NO_COLOR)"
go fmt ./...
clean: ## remove tools
@echo "$(OK_COLOR)--> Clean up$(NO_COLOR)"
rm -rf $(PWD)/tools/bin
rm coverage.txt c.out
help: ## show this help screen
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " $(MAKE_COLOR) %s\n", $$1, $$2 } /^##@/ { printf "\n$(MAKE_COLOR)\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
# To avoid unintended conflicts with file names, always add to .PHONY
# unless there is a reason not to.
# https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html
.PHONY: all deps tools lint test test-unit test-e2e test-ci fmt clean help