forked from babylonlabs-io/babylon-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
81 lines (58 loc) · 2.72 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
#!/usr/bin/make -f
# for dockerized protobuf tools
DOCKER := $(shell which docker)
export GO111MODULE = on
all: test
install:
$(MAKE) -C demo install
build:
$(MAKE) -C demo build
build-linux-static:
$(MAKE) -C demo build-linux-static
build-docker:
$(DOCKER) build --tag babylonchain/bcd -f Dockerfile \
$(shell git rev-parse --show-toplevel)
########################################
### Testing
test-all: test
test:
$(MAKE) -C demo test
$(MAKE) -C x test
$(MAKE) -C tests/e2e/ test
test-e2e:
$(MAKE) -C tests/e2e/ test
###############################################################################
### Linting ###
###############################################################################
format-tools:
go install mvdan.cc/gofumpt@v0.4.0
go install github.com/client9/misspell/cmd/misspell@v0.3.4
go install github.com/daixiang0/gci@v0.11.2
lint: format-tools
$(MAKE) -C demo lint
$(MAKE) -C tests/e2e lint
find . -name '*.go' -type f -not -path "./vendor*" -not -path "./x/vendor*" -not -path "*.git*" -not -path "*_test.go" | xargs gofumpt -d -s
format: format-tools
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./x/vendor*" -not -path "./contracts*" -not -path "./packages*" -not -path "./docs*"| xargs misspell -w
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./x/vendor*" -not -path "./contracts*" -not -path "./packages*" -not -path "./docs*"| xargs gofumpt -w -s
find . -name '*.go' -type f -not -path "./vendor*" -not -path "./tests/system/vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs gci write --skip-generated -s standard -s default -s "prefix(cosmossdk.io)" -s "prefix(github.com/cosmos/cosmos-sdk)" -s "prefix(github.com/babylonlabs-io/babylon-sdk)" --custom-order
###############################################################################
### Protobuf ###
###############################################################################
protoVer=0.14.0
protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer)
protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName)
proto-all: proto-format proto-lint proto-gen
proto-gen:
@echo "Generating Protobuf files"
@$(protoImage) sh ./scripts/protocgen.sh
proto-format:
@echo "Formatting Protobuf files"
@$(protoImage) find ./ -name "*.proto" -exec clang-format -i {} \;
proto-swagger-gen:
@./scripts/protoc-swagger-gen.sh
proto-lint:
@$(protoImage) buf lint --error-format=json
.PHONY: all install \
build build-linux-static test test-all test-e2e \
proto-all proto-format proto-swagger-gen proto-lint