-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
116 lines (81 loc) · 4.15 KB
/
Makefile
File metadata and controls
116 lines (81 loc) · 4.15 KB
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
115
116
#!/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 babylonlabs-io/bcd -f contrib/images/local-bcd/Dockerfile .
########################################
### Testing
test-all: test
test:
$(MAKE) -C demo test
$(MAKE) -C x test
test-e2e: build-docker-e2e test-e2e-cache
test-e2e-cache:
$(MAKE) test-e2e-bcd-consumer-integration
clean-e2e:
docker container rm -f $(shell docker container ls -a -q) || true
docker network prune -f || true
###############################################################################
### Mocking ###
###############################################################################
mockgen_cmd=go run github.com/golang/mock/mockgen@v1.6.0
mocks: ## Generate mock objects for testing
$(mockgen_cmd) -source=x/babylon/types/expected_keepers.go -package types -destination x/babylon/types/mocked_keepers.go
.PHONY: mocks
###############################################################################
### 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 mocks
###############################################################################
### Integration e2e ###
###############################################################################
build-docker-e2e: build-ibcsim-bcd build-babylond
build-ibcsim-bcd:
$(MAKE) -C contrib/images ibcsim-bcd
build-babylond:
$(MAKE) -C contrib/images babylond
start-bcd-consumer-integration:
$(MAKE) -C contrib/images start-bcd-consumer-integration
test-e2e-bcd-consumer-integration: start-bcd-consumer-integration
# GOWORK=off is required because tests/e2e is excluded from the workspace
# due to dependency version conflicts (tests/e2e uses higher versions than demo/ and x/)
@cd tests/e2e && GOWORK=off go test -count 1 -run TestBCDConsumerIntegrationTestSuite -timeout=30m -v . --tags=e2e