-
Notifications
You must be signed in to change notification settings - Fork 41
/
Makefile
80 lines (62 loc) · 2.49 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
SHELL := /bin/bash
.PHONY: all build clean format install-tools generate lint mock-gen test tidy vet buf-gen proto-clean
.PHONY: install-go-test-coverage check-coverage
help:
@echo "Please use \`make <target>\` where <target> is one of"
@echo " build to create build directory and compile sp"
@echo " clean to remove build directory"
@echo " format to format sp code"
@echo " generate to generate mock code"
@echo " install-tools to install mockgen, buf and protoc-gen-gocosmos tools"
@echo " lint to run golangci lint"
@echo " mock-gen to generate mock files"
@echo " test to run all sp unit tests"
@echo " tidy to run go mod tidy and verify"
@echo " vet to do static check"
@echo " buf-gen to use buf to generate pb.go files"
@echo " proto-clean to remove generated pb.go files"
@echo " proto-format to format proto files"
@echo " proto-format-check to check proto files"
build:
bash +x ./build.sh
check-coverage:
@go-test-coverage --config=./.testcoverage.yml || true
clean:
rm -rf ./build
format:
bash script/format.sh
gofmt -w -l .
generate:
go generate ./...
install-go-test-coverage:
go install github.com/vladopajic/go-test-coverage/v2@latest
install-tools:
go install go.uber.org/mock/mockgen@latest
go install github.com/bufbuild/buf/cmd/buf@v1.28.0
go install github.com/cosmos/gogoproto/protoc-gen-gocosmos@latest
lint:
golangci-lint run --fix
mock-gen:
mockgen -source=core/spdb/spdb.go -destination=core/spdb/spdb_mock.go -package=spdb
mockgen -source=store/bsdb/database.go -destination=store/bsdb/database_mock.go -package=bsdb
mockgen -source=core/task/task.go -destination=core/task/task_mock.go -package=task
# only run unit tests, exclude e2e tests
test:
go test -failfast $$(go list ./... | grep -v e2e |grep -v modular/blocksyncer) -covermode=atomic -coverprofile=./coverage.out -timeout 99999s
# go test -cover ./...
# go test -coverprofile=coverage.out ./...
# go tool cover -html=coverage.out
tidy:
go mod tidy
go mod verify
vet:
go vet ./...
buf-gen:
rm -rf ./base/types/*/*.pb.go && rm -rf ./modular/metadata/types/*.pb.go && rm -rf ./store/types/*.pb.go
buf generate
proto-clean:
rm -rf ./base/types/*/*.pb.go && rm -rf ./modular/metadata/types/*.pb.go && rm -rf ./store/types/*.pb.go
proto-format:
buf format -w
proto-format-check:
buf format --diff --exit-code