forked from liftedinit/ghostcloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
97 lines (70 loc) · 2.64 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
87
88
89
90
91
92
93
94
95
96
97
#### HELP ####
help: ## Display this help screen
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: help
#### LINT ####
golangci_version=v1.55.1
lint-install:
@echo "--> Installing golangci-lint $(golangci_version)"
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
@echo "--> Installing golangci-lint $(golangci_version) complete"
lint: ## Run linter (golangci-lint)
@echo "--> Running linter"
$(MAKE) lint-install
@golangci-lint run ./x/...
lint-fix:
@echo "--> Running linter"
$(MAKE) lint-install
@golangci-lint run ./x/... --fix
.PHONY: lint lint-fix
#### FORMAT ####
goimports_version=latest
format-install:
@echo "--> Installing goimports $(goimports_version)"
@go install golang.org/x/tools/cmd/goimports@$(goimports_version)
@echo "--> Installing goimports $(goimports_version) complete"
format: ## Run formatter (goimports)
@echo "--> Running goimports"
$(MAKE) format-install
@find . -name '*.go' -exec goimports -w -local github.com/cosmos/cosmos-sdk,cosmossdk.io,github.com/cometbft,github.com/cosmos.ibc-go,ghostcloud {} \;
#### COVERAGE ####
coverage: ## Run coverage report
@echo "--> Running coverage"
@go test -race -cpu=$$(nproc) -covermode=atomic -coverprofile=coverage.out $$(go list ./x/...) > /dev/null 2>&1
@echo "--> Running coverage filter"
@./scripts/filter-coverage.sh
@echo "--> Running coverage report"
@go tool cover -func=coverage-filtered.out
@echo "--> Running coverage html"
@go tool cover -html=coverage-filtered.out -o coverage.html
@echo "--> Coverage report available at coverage.html"
@echo "--> Cleaning up coverage files"
@rm coverage.out
@echo "--> Running coverage complete"
.PHONY: coverage
#### TEST ####
test: ## Run tests
@echo "--> Running tests"
@go test -race -cpu=$$(nproc) $$(go list ./x/...)
.PHONY: test
#### VET ####
vet: ## Run go vet
@echo "--> Running go vet"
@go vet ./...
.PHONY: vet
#### NANCY ###
nancy: ## Run nancy
@echo "--> Running nancy (requires docker)"
@command -v docker >/dev/null 2>&1 || { echo >&2 "nancy requires docker but it's not installed. Aborting."; exit 1; }
go list -json -deps ./... | docker run --rm -i sonatypecommunity/nancy:latest sleuth
.PHONY: nancy
#### GOVULNCHECK ####
govulncheck_version=latest
govulncheck-install:
@echo "--> Installing govulncheck $(govulncheck_version)"
@go install golang.org/x/vuln/cmd/govulncheck@$(govulncheck_version)
@echo "--> Installing govulncheck $(govulncheck_version) complete"
govulncheck: ## Run govulncheck
@echo "--> Running govulncheck"
$(MAKE) govulncheck-install
@govulncheck ./...