-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
33 lines (28 loc) · 1.2 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
I = "⚪"
E = "🔴"
D = "🔵"
default:
@echo "$(D) supported commands: [init, update, test]"
init:
@echo "$(I) initialiazing..."
@rm -rf go.mod go.sum ./vendor ./mocks
@go mod init $$(pwd | awk -F'/' '{print $$NF}') || (echo "$(E) initialization error"; exit 1)
update:
@echo "$(I) installing dependencies..."
@go get ./... || (echo "$(E) 'go get' error"; exit 1)
@go get -u github.com/stretchr/objx || (echo "$(E) 'go get' error"; exit 1)
@echo "$(I) updating imports..."
@go mod tidy || (echo "$(E) 'go mod tidy' error"; exit 1)
@echo "$(I) vendoring..."
@go mod vendor || (echo "$(E) 'go mod vendor' error"; exit 1)
@echo "$(I) regenerating mocks package..."
@mockery --name=Client --dir=repository/api/
# @mockery --name=<interface-name> --dir=vendor/github.com/<org>/<proj>/
test:
@echo "$(I) linting..."
@golangci-lint run --skip-dirs=mocks --skip-dirs=vendor || (echo "$(E) linter error"; exit 1)
@echo "$(I) unit testing (approximately 1 minute)..."
@go test -v $$(go list ./... | grep -v vendor | grep -v mocks) -race -coverprofile=coverage.txt -covermode=atomic
codecov: test
@echo "$(I) analyzing coverage..."
@go tool cover -html=coverage.txt || (echo "$(E) 'go tool cover' error"; exit 1)