-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
114 lines (82 loc) · 2.81 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#### 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
#### BUILD ####
build: ## Build the project
@echo "--> Building project"
@go build -o mfx-migrator ./
@echo "--> Building project complete"
.PHONY: build
#### CLEAN ####
clean: ## Clean the project
@echo "--> Cleaning project"
@go clean
@echo "--> Cleaning project complete"
.PHONY: clean
#### INSTALL ####
install: ## Install the project
@echo "--> Installing project"
@go install
@echo "--> Installing project complete"
.PHONY: install
#### LINT ####
golangci_version=latest
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 ./...
lint-fix:
@echo "--> Running linter"
$(MAKE) lint-install
@golangci-lint run ./... --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/liftedinit/mfx-migrator {} \;
#### 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 ./...
#### VET ####
vet: ## Run go vet
@echo "--> Running go vet"
@go vet ./...
.PHONY: vet
#### COVERAGE ####
coverage: ## Run coverage report
@echo "--> Running coverage"
@go test -race -cpu=$$(nproc) -covermode=atomic -coverprofile=coverage.out $$(go list ./...) ./interchaintest/... -coverpkg=github.com/liftedinit/mfx-migrator/... > /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 ./...) ./interchaintest/...
.PHONY: test