-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
154 lines (127 loc) · 5.78 KB
/
Makefile
File metadata and controls
154 lines (127 loc) · 5.78 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
###################################################
### Lumera Makefile
###################################################
# tools/paths
GO ?= go
IGNITE ?= ignite
BUF ?= buf
GOLANGCI_LINT ?= golangci-lint
BUILD_DIR ?= build
RELEASE_DIR ?= release
GOPROXY ?= https://proxy.golang.org,direct
module_version = $(strip $(shell EMSDK_QUIET=1 ${GO} list -m -f '{{.Version}}' $1 | tail -n 1))
IGNITE_INSTALL_SCRIPT ?= https://get.ignite.com/cli!
GOFLAGS = "-trimpath"
WASMVM_VERSION := v3@v3.0.2
RELEASE_CGO_LDFLAGS ?= -Wl,-rpath,/usr/lib -Wl,--disable-new-dtags
COSMOS_PROTO_VERSION := $(call module_version,github.com/cosmos/cosmos-proto)
GOGOPROTO_VERSION := $(call module_version,github.com/cosmos/gogoproto)
GOLANGCI_LINT_VERSION := $(call module_version,github.com/golangci/golangci-lint)
BUF_VERSION := $(call module_version,github.com/bufbuild/buf)
GRPC_GATEWAY_VERSION := $(call module_version,github.com/grpc-ecosystem/grpc-gateway)
GRPC_GATEWAY_V2_VERSION := $(call module_version,github.com/grpc-ecosystem/grpc-gateway/v2)
GO_TOOLS_VERSION := $(call module_version,golang.org/x/tools)
GRPC_VERSION := $(call module_version,google.golang.org/grpc)
PROTOBUF_VERSION := $(call module_version,google.golang.org/protobuf)
GOCACHE := $(shell ${GO} env GOCACHE)
GOMODCACHE := $(shell ${GO} env GOMODCACHE)
TOOLS := \
github.com/bufbuild/buf/cmd/buf@$(BUF_VERSION) \
github.com/cosmos/gogoproto/protoc-gen-gocosmos@$(GOGOPROTO_VERSION) \
github.com/cosmos/gogoproto/protoc-gen-gogo@$(GOGOPROTO_VERSION) \
github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) \
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@$(GRPC_GATEWAY_VERSION) \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@$(GRPC_GATEWAY_V2_VERSION) \
golang.org/x/tools/cmd/goimports@$(GO_TOOLS_VERSION) \
google.golang.org/grpc/cmd/protoc-gen-go-grpc@$(GRPC_VERSION) \
google.golang.org/protobuf/cmd/protoc-gen-go@$(PROTOBUF_VERSION)
-include Makefile.devnet
###################################################
### Build ###
###################################################
.PHONY: build build-debug release build-proto clean-proto clean-cache install-tools
install-tools:
@echo "Installing Go tooling..."
@for tool in $(TOOLS); do \
echo " $$tool"; \
EMSDK_QUIET=1 ${GO} install $$tool; \
done
@echo "Installing Ignite CLI (latest)..."
@curl -sSfL ${IGNITE_INSTALL_SCRIPT} | bash
clean-proto:
@echo "Cleaning up protobuf generated files..."
find x/ -type f \( -name "*.pb.go" -o -name "*.pb.gw.go" -o -name "*.pulsar.go" -o -name "swagger.yaml" -o -name "swagger.swagger.yaml" \) -print -exec rm -f {} +
find proto/ -type f \( -name "swagger.yaml" -o -name "swagger.swagger.yaml" -o -name "*.swagger.json" \) -print -exec rm -f {} +
rm -f docs/static/openapi.yml
clean-cache:
@echo "Cleaning Ignite cache..."
rm -rf ~/.ignite/cache
@echo "Cleaning Buf cache..."
${BUF} clean || true
rm -rf ~/.cache/buf || true
@echo "Cleaning Go build cache..."
${GO} clean -cache -modcache -i -r || true
rm -rf ${GOCACHE} ${GOMODCACHE} || true
PROTO_SRC := $(shell find proto -name "*.proto")
GO_SRC := $(shell find app -name "*.go") \
$(shell find ante -name "*.go") \
$(shell find cmd -name "*.go") \
$(shell find config -name "*.go") \
$(shell find x -name "*.go")
build-proto: clean-proto $(PROTO_SRC)
@echo "Processing proto files..."
${BUF} generate --template proto/buf.gen.gogo.yaml --verbose
${BUF} generate --template proto/buf.gen.swagger.yaml --verbose
${IGNITE} generate openapi --yes --enable-proto-vendor --clear-cache
build: build/lumerad
go.sum: go.mod
@echo "Verifying and tidying go modules..."
GOPROXY=${GOPROXY} ${GO} mod verify
GOPROXY=${GOPROXY} ${GO} mod tidy
build/lumerad: $(GO_SRC) go.sum Makefile
@echo "Building lumerad binary..."
@mkdir -p ${BUILD_DIR}
${BUF} generate --template proto/buf.gen.gogo.yaml --verbose
GOFLAGS=${GOFLAGS} ${IGNITE} chain build -t linux:amd64 --skip-proto --output ${BUILD_DIR}/
chmod +x $(BUILD_DIR)/lumerad
build-debug: build-debug/lumerad
build-debug/lumerad: $(GO_SRC) go.sum Makefile
@echo "Building lumerad debug binary..."
@mkdir -p ${BUILD_DIR}
${IGNITE} chain build -t linux:amd64 --skip-proto --debug -v --output ${BUILD_DIR}/
chmod +x $(BUILD_DIR)/lumerad
release:
@echo "Creating release with ignite..."
@mkdir -p ${RELEASE_DIR}
${BUF} generate --template proto/buf.gen.gogo.yaml --verbose
${BUF} generate --template proto/buf.gen.swagger.yaml --verbose
${IGNITE} generate openapi --yes --enable-proto-vendor --clear-cache
CGO_LDFLAGS="${RELEASE_CGO_LDFLAGS}" ${IGNITE} chain build -t linux:amd64 --skip-proto --release -v --output ${RELEASE_DIR}/
@echo "Release created in [${RELEASE_DIR}/] directory."
###################################################
### Tests and Simulation ###
###################################################
.PHONY: unit-tests integration-tests system-tests simulation-tests all-tests lint system-metrics-test
all-tests: unit-tests integration-tests system-tests simulation-tests
lint:
@echo "Running linters..."
@${GOLANGCI_LINT} run ./... --timeout=5m
unit-tests:
@echo "Running unit tests in x/..."
${GO} test ./x/... -v -coverprofile=coverage.out
integration-tests:
@echo "Running integration tests..."
${GO} test ./tests/integration/... -v
system-tests:
@echo "Running system tests..."
${GO} test -tags=system ./tests/system/... -v
simulation-tests:
@echo "Running simulation tests..."
${IGNITE} version
${IGNITE} chain simulate
systemex-tests:
@echo "Running system tests..."
cd ./tests/systemtests/ && go test -tags=system_test -v .
system-metrics-test:
@echo "Running supernode metrics system tests (E2E + staleness)..."
cd ./tests/systemtests/ && go test -tags=system_test -timeout 20m -v . -run 'TestSupernodeMetrics(E2E|StalenessAndRecovery)'