forked from zeta-chain/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
180 lines (135 loc) · 5.5 KB
/
Makefile
File metadata and controls
180 lines (135 loc) · 5.5 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
.PHONY: build
PACKAGES=$(shell go list ./... | grep -v '/simulation')
VERSION := $(shell git describe --tags)
COMMIT := $(shell [ -z "${COMMIT_ID}" ] && git log -1 --format='%H' || echo ${COMMIT_ID} )
BUILDTIME := $(shell date -u +"%Y%m%d.%H%M%S" )
DOCKER ?= docker
DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf
GOFLAGS:=""
ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=zetacore \
-X github.com/cosmos/cosmos-sdk/version.ServerName=zetacored \
-X github.com/cosmos/cosmos-sdk/version.ClientName=zetaclientd \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
-X github.com/zeta-chain/zetacore/common.Version=$(VERSION) \
-X github.com/zeta-chain/zetacore/common.CommitHash=$(COMMIT) \
-X github.com/zeta-chain/zetacore/common.BuildTime=$(BUILDTIME) \
-X github.com/cosmos/cosmos-sdk/types.DBBackend=pebbledb
BUILD_FLAGS := -ldflags '$(ldflags)' -tags PRIVNET,pebbledb,ledger
TESTNET_BUILD_FLAGS := -ldflags '$(ldflags)' -tags TESTNET,pebbledb,ledger
TEST_DIR?="./..."
TEST_BUILD_FLAGS := -tags TESTNET,pebbledb,ledger
PRIV_BUILD_FLAGS := -tags PRIVNET,pebbledb,ledger
clean: clean-binaries clean-dir
clean-binaries:
@rm -rf ${GOBIN}/zetacored
@rm -rf ${GOBIN}/zetaclientd
clean-dir:
@rm -rf ~/.zetacored
@rm -rf ~/.zetacore
all: install
test-coverage-exclude-core:
@go test {TEST_BUILD_FLAGS} -v -coverprofile coverage.out $(go list ./... | grep -v /x/zetacore/)
test-coverage:
@go test ${TEST_BUILD_FLAGS} -v -coverprofile coverage.out ${TEST_DIR}
coverage-report: test-coverage
@go tool cover -html=cover.txt
clean-test-dir:
@rm -rf x/crosschain/client/integrationtests/.zetacored
@rm -rf x/crosschain/client/querytests/.zetacored
run-test:
@go test ${TEST_BUILD_FLAGS} ${TEST_DIR}
test :clean-test-dir run-test
test-priv:
@go test ${PRIV_BUILD_FLAGS} ${TEST_DIR}
gosec:
gosec -exclude-dir=localnet ./...
install-testnet: go.sum
@echo "--> Installing zetacored & zetaclientd"
@go install -mod=readonly $(TESTNET_BUILD_FLAGS) ./cmd/zetacored
@go install -mod=readonly $(TESTNET_BUILD_FLAGS) ./cmd/zetaclientd
build-testnet-ubuntu: go.sum
docker build -t zetacore-ubuntu --platform linux/amd64 -f ./Dockerfile-athens3-ubuntu .
docker create --name temp-container zetacore-ubuntu
docker cp temp-container:/go/bin/zetaclientd .
docker cp temp-container:/go/bin/zetacored .
docker rm temp-container
install: go.sum
@echo "--> Installing zetacored & zetaclientd"
@go install -mod=readonly $(BUILD_FLAGS) ./cmd/zetacored
@go install -mod=readonly $(BUILD_FLAGS) ./cmd/zetaclientd
install-zetaclient: go.sum
@echo "--> Installing zetaclientd"
@go install -mod=readonly $(BUILD_FLAGS) ./cmd/zetaclientd
# running with race detector on will be slow
install-zetaclient-race-test-only-build: go.sum
@echo "--> Installing zetaclientd"
@go install -race -mod=readonly $(BUILD_FLAGS) ./cmd/zetaclientd
install-zetacore: go.sum
@echo "--> Installing zetacored"
@go install -mod=readonly $(BUILD_FLAGS) ./cmd/zetacored
install-zetacore-testnet: go.sum
@echo "--> Installing zetacored"
@go install -mod=readonly $(TESTNET_BUILD_FLAGS) ./cmd/zetacored
install-smoketest: go.sum
@echo "--> Installing orchestrator"
@go install -mod=readonly $(BUILD_FLAGS) ./contrib/localnet/orchestrator/smoketest
go.sum: go.mod
@echo "--> Ensure dependencies have not been modified"
GO111MODULE=on go mod verify
test-cctx:
./standalone-network/cctx-creator.sh
init:
./standalone-network/init.sh
run:
./standalone-network/run.sh
chain-init: clean install-zetacore init
chain-run: clean install-zetacore init run
chain-stop:
@killall zetacored
@killall tail
chain-init-testnet: clean install-zetacore-testnet init
chain-run-testnet: clean install-zetacore-testnet init run
lint-pre:
@test -z $(gofmt -l .)
@GOFLAGS=$(GOFLAGS) go mod verify
lint: lint-pre
@golangci-lint run
proto:
@echo "--> Generating Go from protocol buffer files"
@bash ./scripts/protoc-gen-go.sh
@echo "--> Generating OpenAPI specs"
@bash ./scripts/protoc-gen-openapi.sh
.PHONY: proto
specs:
@go run ./scripts/gen-spec.go
.PHONY: specs
###############################################################################
### Docker Images ###
###############################################################################
zetanode:
@echo "Building zetanode"
$(DOCKER) build -t zetanode -f ./Dockerfile .
$(DOCKER) build -t orchestrator -f contrib/localnet/orchestrator/Dockerfile.fastbuild .
.PHONY: zetanode
smoketest:
@echo "DEPRECATED: NO-OP: Building smoketest"
start-smoketest:
@echo "--> Starting smoketest"
cd contrib/localnet/ && $(DOCKER) compose up -d
start-smoketest-upgrade:
@echo "--> Starting smoketest with upgrade proposal"
cd contrib/localnet/ && $(DOCKER) compose -f docker-compose-upgrade.yml up -d
start-smoketest-p2p-diag:
@echo "--> Starting smoketest in p2p diagnostic mode"
cd contrib/localnet/ && $(DOCKER) compose -f docker-compose-p2p-diag.yml up -d
stop-smoketest:
@echo "--> Stopping smoketest"
cd contrib/localnet/ && $(DOCKER) compose down --remove-orphans
stop-smoketest-p2p-diag:
@echo "--> Stopping smoketest in p2p diagnostic mode"
cd contrib/localnet/ && $(DOCKER) compose -f docker-compose-p2p-diag.yml down --remove-orphans
stress-test: zetanode
cd contrib/localnet/ && $(DOCKER) compose -f docker-compose-stresstest.yml up -d
stop-stress-test:
cd contrib/localnet/ && $(DOCKER) compose -f docker-compose-stresstest.yml down --remove-orphans