forked from vmware/vmware-go-kcl-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
63 lines (50 loc) · 1.98 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
.PHONY: help
help: ## - Show this help message
@printf "\033[32m\xE2\x9c\x93 usage: make [target]\n\n\033[0m"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: up
up: ## - start docker compose
@ cd _support/docker && docker-compose -f docker-compose.yml up
.PHONY: build-common
build-common: ## - execute build common tasks clean and mod tidy
@ go version
@ go clean
@ go mod download && go mod tidy
@ go mod verify
.PHONY: build
build: build-common ## - build a debug binary to the current platform (windows, linux or darwin(mac))
@ echo building
@ go build -v ./...
@ echo "done"
.PHONY: format-check
format-check: ## - check files format using gofmt
@ ./_support/scripts/ci.sh fmtCheck
.PHONY: format-check
format: ## - apply golang file format using gofmt
@ ./_support/scripts/ci.sh format
.PHONY: test
test: build-common ## - execute go test command for unit and mocked tests
@ ./_support/scripts/ci.sh unitTest
.PHONY: integration-test
integration-test: ## - execute go test command for integration tests (aws credentials needed)
@ go test -v -cover -race ./test
.PHONY: scan
scan: ## - execute static code analysis
@ ./_support/scripts/ci.sh scan
.PHONY: local-scan
local-scan: ## - execute static code analysis locally
@ ./_support/scripts/ci.sh localScan
.PHONY: lint
lint: ## - runs golangci-lint
@ ./_support/scripts/ci.sh lint
.PHONY: lint-docker
lint-docker: ## - runs golangci-lint with docker container
@ ./_support/scripts/ci.sh lintDocker
.PHONY: sonar-scan
sonar-scan: ## - start sonar qube locally with docker (you will need docker installed in your machine)
@ # after start, setup a new project with the name sms-local and a new token sms-token, fill the token against the -Dsonar.login= parameter.
@ # login with user: admin pwd: vmware
@ $(SHELL) _support/scripts/sonar-scan.sh
.PHONY: sonar-stop
sonar-stop: ## - stop sonar qube docker container
@ docker stop sonarqube