You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

338 lines
12 KiB

[RPC] Static swagger (#3880) * manually swagging Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * three definitions with polymorphism Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * added blockchain and block Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * low quality generation, commit, block_response and validators Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * genesis and consensus states endpoints Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * fix indentation Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * consensus parameters Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * fix indentation Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * add height to consensus parameters endpoint Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * unconfirmed_txs and num_unconfirmed_txs Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * add missing query parameter Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * add ABCI queries Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * added index document for swagger documentation Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * add missing routes Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * contract tests added on CCI Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * contract tests job should be in the test suite Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * simplify requirements to test Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * typo Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * build is a prerequisite to start localnet Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * reduce nodejs size, move goodman to get_tools, add docs, fix comments Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * Update scripts/get_tools.sh That's cleaner, thanks! Co-Authored-By: Anton Kaliaev <anton.kalyaev@gmail.com> * xz not supported by cci image, let's keep it simple Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * REMOVE-indirect debug of CCI paths Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * dirty experiment, volume is empty but binary has been produced Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * dirty experiment, volume is empty but binary has been produced Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * dirty experiment going on Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * locally works, CCI have difficulties with second layaer containers volumes Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * restore experiment, use machine instead of docker for contract tests Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * simplify a bit Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * rollback on machine golang Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * Document the changes Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * Changelog Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * comments Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
5 years ago
[RPC] Static swagger (#3880) * manually swagging Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * three definitions with polymorphism Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * added blockchain and block Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * low quality generation, commit, block_response and validators Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * genesis and consensus states endpoints Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * fix indentation Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * consensus parameters Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * fix indentation Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * add height to consensus parameters endpoint Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * unconfirmed_txs and num_unconfirmed_txs Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * add missing query parameter Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * add ABCI queries Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * added index document for swagger documentation Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * add missing routes Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * contract tests added on CCI Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * contract tests job should be in the test suite Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * simplify requirements to test Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * typo Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * build is a prerequisite to start localnet Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * reduce nodejs size, move goodman to get_tools, add docs, fix comments Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * Update scripts/get_tools.sh That's cleaner, thanks! Co-Authored-By: Anton Kaliaev <anton.kalyaev@gmail.com> * xz not supported by cci image, let's keep it simple Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * REMOVE-indirect debug of CCI paths Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * dirty experiment, volume is empty but binary has been produced Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * dirty experiment, volume is empty but binary has been produced Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * dirty experiment going on Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * locally works, CCI have difficulties with second layaer containers volumes Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * restore experiment, use machine instead of docker for contract tests Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * simplify a bit Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * rollback on machine golang Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * Document the changes Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * Changelog Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com> * comments Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
5 years ago
build: Make sure to test packages with external tests (#7608) The test filter was looking for "TestGoFiles", which does not include tests in a separate package (e.g., "package foo_test" for "package foo"). This caused several packages not to be tested in CI, including: github.com/tendermint/tendermint/abci/client github.com/tendermint/tendermint/crypto github.com/tendermint/tendermint/crypto/tmhash github.com/tendermint/tendermint/internal/eventbus github.com/tendermint/tendermint/internal/evidence github.com/tendermint/tendermint/internal/inspect github.com/tendermint/tendermint/internal/jsontypes github.com/tendermint/tendermint/internal/libs/protoio github.com/tendermint/tendermint/internal/libs/sync github.com/tendermint/tendermint/internal/p2p/pex github.com/tendermint/tendermint/internal/pubsub github.com/tendermint/tendermint/internal/pubsub/query github.com/tendermint/tendermint/internal/pubsub/query/syntax github.com/tendermint/tendermint/internal/state/indexer github.com/tendermint/tendermint/internal/state/indexer/block/kv github.com/tendermint/tendermint/libs/json github.com/tendermint/tendermint/libs/log github.com/tendermint/tendermint/libs/os github.com/tendermint/tendermint/light github.com/tendermint/tendermint/light/provider/http github.com/tendermint/tendermint/privval/grpc github.com/tendermint/tendermint/proto/tendermint/blocksync github.com/tendermint/tendermint/proto/tendermint/consensus github.com/tendermint/tendermint/proto/tendermint/statesync github.com/tendermint/tendermint/rpc/client github.com/tendermint/tendermint/rpc/client/mock github.com/tendermint/tendermint/test/e2e/tests github.com/tendermint/tendermint/test/fuzz/mempool github.com/tendermint/tendermint/test/fuzz/p2p/secretconnection github.com/tendermint/tendermint/test/fuzz/rpc/jsonrpc/server Updates #7626 and #7634.
3 years ago
build: Make sure to test packages with external tests (#7608) The test filter was looking for "TestGoFiles", which does not include tests in a separate package (e.g., "package foo_test" for "package foo"). This caused several packages not to be tested in CI, including: github.com/tendermint/tendermint/abci/client github.com/tendermint/tendermint/crypto github.com/tendermint/tendermint/crypto/tmhash github.com/tendermint/tendermint/internal/eventbus github.com/tendermint/tendermint/internal/evidence github.com/tendermint/tendermint/internal/inspect github.com/tendermint/tendermint/internal/jsontypes github.com/tendermint/tendermint/internal/libs/protoio github.com/tendermint/tendermint/internal/libs/sync github.com/tendermint/tendermint/internal/p2p/pex github.com/tendermint/tendermint/internal/pubsub github.com/tendermint/tendermint/internal/pubsub/query github.com/tendermint/tendermint/internal/pubsub/query/syntax github.com/tendermint/tendermint/internal/state/indexer github.com/tendermint/tendermint/internal/state/indexer/block/kv github.com/tendermint/tendermint/libs/json github.com/tendermint/tendermint/libs/log github.com/tendermint/tendermint/libs/os github.com/tendermint/tendermint/light github.com/tendermint/tendermint/light/provider/http github.com/tendermint/tendermint/privval/grpc github.com/tendermint/tendermint/proto/tendermint/blocksync github.com/tendermint/tendermint/proto/tendermint/consensus github.com/tendermint/tendermint/proto/tendermint/statesync github.com/tendermint/tendermint/rpc/client github.com/tendermint/tendermint/rpc/client/mock github.com/tendermint/tendermint/test/e2e/tests github.com/tendermint/tendermint/test/fuzz/mempool github.com/tendermint/tendermint/test/fuzz/p2p/secretconnection github.com/tendermint/tendermint/test/fuzz/rpc/jsonrpc/server Updates #7626 and #7634.
3 years ago
  1. #!/usr/bin/make -f
  2. BUILDDIR ?= $(CURDIR)/build
  3. BUILD_TAGS?=tendermint
  4. # If building a release, please checkout the version tag to get the correct version setting
  5. ifneq ($(shell git symbolic-ref -q --short HEAD),)
  6. VERSION := unreleased-$(shell git symbolic-ref -q --short HEAD)-$(shell git rev-parse HEAD)
  7. else
  8. VERSION := $(shell git describe)
  9. endif
  10. LD_FLAGS = -X github.com/tendermint/tendermint/version.TMVersion=$(VERSION)
  11. BUILD_FLAGS = -mod=readonly -ldflags "$(LD_FLAGS)"
  12. BUILD_IMAGE := ghcr.io/tendermint/docker-build-proto
  13. DOCKER_PROTO_BUILDER := docker run -v $(shell pwd):/workspace --workdir /workspace $(BUILD_IMAGE)
  14. CGO_ENABLED ?= 0
  15. # handle nostrip
  16. ifeq (,$(findstring nostrip,$(TENDERMINT_BUILD_OPTIONS)))
  17. BUILD_FLAGS += -trimpath
  18. LD_FLAGS += -s -w
  19. endif
  20. # handle race
  21. ifeq (race,$(findstring race,$(TENDERMINT_BUILD_OPTIONS)))
  22. CGO_ENABLED=1
  23. BUILD_FLAGS += -race
  24. endif
  25. # handle cleveldb
  26. ifeq (cleveldb,$(findstring cleveldb,$(TENDERMINT_BUILD_OPTIONS)))
  27. CGO_ENABLED=1
  28. BUILD_TAGS += cleveldb
  29. endif
  30. # handle badgerdb
  31. ifeq (badgerdb,$(findstring badgerdb,$(TENDERMINT_BUILD_OPTIONS)))
  32. BUILD_TAGS += badgerdb
  33. endif
  34. # handle rocksdb
  35. ifeq (rocksdb,$(findstring rocksdb,$(TENDERMINT_BUILD_OPTIONS)))
  36. CGO_ENABLED=1
  37. BUILD_TAGS += rocksdb
  38. endif
  39. # handle boltdb
  40. ifeq (boltdb,$(findstring boltdb,$(TENDERMINT_BUILD_OPTIONS)))
  41. BUILD_TAGS += boltdb
  42. endif
  43. # allow users to pass additional flags via the conventional LDFLAGS variable
  44. LD_FLAGS += $(LDFLAGS)
  45. all: check build test install
  46. .PHONY: all
  47. include test/Makefile
  48. ###############################################################################
  49. ### Build Tendermint ###
  50. ###############################################################################
  51. build: $(BUILDDIR)/
  52. CGO_ENABLED=$(CGO_ENABLED) go build $(BUILD_FLAGS) -tags '$(BUILD_TAGS)' -o $(BUILDDIR)/ ./cmd/tendermint/
  53. .PHONY: build
  54. install:
  55. CGO_ENABLED=$(CGO_ENABLED) go install $(BUILD_FLAGS) -tags $(BUILD_TAGS) ./cmd/tendermint
  56. .PHONY: install
  57. $(BUILDDIR)/:
  58. mkdir -p $@
  59. # The Docker image containing the generator, formatter, and linter.
  60. # This is generated by proto/Dockerfile. To update tools, make changes
  61. # there and run the Build & Push Proto Builder Image workflow.
  62. IMAGE := ghcr.io/tendermint/docker-build-proto:latest
  63. DOCKER_PROTO_BUILDER := docker run -v $(shell pwd):/workspace --workdir /workspace $(IMAGE)
  64. HTTPS_GIT := https://github.com/tendermint/tendermint.git
  65. ###############################################################################
  66. ### Protobuf ###
  67. ###############################################################################
  68. proto-all: proto-lint proto-check-breaking
  69. .PHONY: proto-all
  70. proto-gen:
  71. @echo "Generating Protobuf files"
  72. @$(DOCKER_PROTO_BUILDER) buf generate --template=./buf.gen.yaml --config ./buf.yaml
  73. .PHONY: proto-gen
  74. # TODO: Should be removed when work on ABCI++ is complete.
  75. # For more information, see https://github.com/tendermint/tendermint/issues/8066
  76. abci-proto-gen:
  77. ./scripts/abci-gen.sh
  78. .PHONY: abci-proto-gen
  79. proto-lint:
  80. @$(DOCKER_PROTO_BUILDER) buf lint --error-format=json --config ./buf.yaml
  81. .PHONY: proto-lint
  82. proto-format:
  83. @echo "Formatting Protobuf files"
  84. @$(DOCKER_PROTO_BUILDER) find . -name '*.proto' -path "./proto/*" -exec clang-format -i {} \;
  85. .PHONY: proto-format
  86. proto-check-breaking:
  87. @$(DOCKER_PROTO_BUILDER) buf breaking --against .git --config ./buf.yaml
  88. .PHONY: proto-check-breaking
  89. proto-check-breaking-ci:
  90. @$(DOCKER_PROTO_BUILDER) buf breaking --against $(HTTPS_GIT) --config ./buf.yaml
  91. .PHONY: proto-check-breaking-ci
  92. ###############################################################################
  93. ### Build ABCI ###
  94. ###############################################################################
  95. build_abci:
  96. @go build -mod=readonly -i ./abci/cmd/...
  97. .PHONY: build_abci
  98. install_abci:
  99. @go install -mod=readonly ./abci/cmd/...
  100. .PHONY: install_abci
  101. ###############################################################################
  102. ### Privval Server ###
  103. ###############################################################################
  104. build_privval_server:
  105. @go build -mod=readonly -o $(BUILDDIR)/ -i ./cmd/priv_val_server/...
  106. .PHONY: build_privval_server
  107. generate_test_cert:
  108. # generate self signing ceritificate authority
  109. @certstrap init --common-name "root CA" --expires "20 years"
  110. # generate server cerificate
  111. @certstrap request-cert -cn server -ip 127.0.0.1
  112. # self-sign server cerificate with rootCA
  113. @certstrap sign server --CA "root CA"
  114. # generate client cerificate
  115. @certstrap request-cert -cn client -ip 127.0.0.1
  116. # self-sign client cerificate with rootCA
  117. @certstrap sign client --CA "root CA"
  118. .PHONY: generate_test_cert
  119. ###############################################################################
  120. ### Distribution ###
  121. ###############################################################################
  122. # dist builds binaries for all platforms and packages them for distribution
  123. # TODO add abci to these scripts
  124. dist:
  125. @BUILD_TAGS=$(BUILD_TAGS) sh -c "'$(CURDIR)/scripts/dist.sh'"
  126. .PHONY: dist
  127. go-mod-cache: go.sum
  128. @echo "--> Download go modules to local cache"
  129. @go mod download
  130. .PHONY: go-mod-cache
  131. go.sum: go.mod
  132. @echo "--> Ensure dependencies have not been modified"
  133. @go mod verify
  134. @go mod tidy
  135. draw_deps:
  136. @# requires brew install graphviz or apt-get install graphviz
  137. go get github.com/RobotsAndPencils/goviz
  138. @goviz -i github.com/tendermint/tendermint/cmd/tendermint -d 3 | dot -Tpng -o dependency-graph.png
  139. .PHONY: draw_deps
  140. get_deps_bin_size:
  141. @# Copy of build recipe with additional flags to perform binary size analysis
  142. $(eval $(shell go build -work -a $(BUILD_FLAGS) -tags $(BUILD_TAGS) -o $(BUILDDIR)/ ./cmd/tendermint/ 2>&1))
  143. @find $(WORK) -type f -name "*.a" | xargs -I{} du -hxs "{}" | sort -rh | sed -e s:${WORK}/::g > deps_bin_size.log
  144. @echo "Results can be found here: $(CURDIR)/deps_bin_size.log"
  145. .PHONY: get_deps_bin_size
  146. ###############################################################################
  147. ### Libs ###
  148. ###############################################################################
  149. # generates certificates for TLS testing in remotedb and RPC server
  150. gen_certs: clean_certs
  151. certstrap init --common-name "tendermint.com" --passphrase ""
  152. certstrap request-cert --common-name "server" -ip "127.0.0.1" --passphrase ""
  153. certstrap sign "server" --CA "tendermint.com" --passphrase ""
  154. mv out/server.crt rpc/jsonrpc/server/test.crt
  155. mv out/server.key rpc/jsonrpc/server/test.key
  156. rm -rf out
  157. .PHONY: gen_certs
  158. # deletes generated certificates
  159. clean_certs:
  160. rm -f rpc/jsonrpc/server/test.crt
  161. rm -f rpc/jsonrpc/server/test.key
  162. .PHONY: clean_certs
  163. ###############################################################################
  164. ### Formatting, linting, and vetting ###
  165. ###############################################################################
  166. format:
  167. find . -name '*.go' -type f -not -path "*.git*" -not -name '*.pb.go' -not -name '*pb_test.go' | xargs gofmt -w -s
  168. find . -name '*.go' -type f -not -path "*.git*" -not -name '*.pb.go' -not -name '*pb_test.go' | xargs goimports -w -local github.com/tendermint/tendermint
  169. .PHONY: format
  170. lint:
  171. @echo "--> Running linter"
  172. go run github.com/golangci/golangci-lint/cmd/golangci-lint run
  173. .PHONY: lint
  174. DESTINATION = ./index.html.md
  175. ###############################################################################
  176. ### Documentation ###
  177. ###############################################################################
  178. # todo remove once tendermint.com DNS is solved
  179. build-docs:
  180. @cd docs && \
  181. while read -r branch path_prefix; do \
  182. (git checkout $${branch} && npm ci && VUEPRESS_BASE="/$${path_prefix}/" npm run build) ; \
  183. mkdir -p ~/output/$${path_prefix} ; \
  184. cp -r .vuepress/dist/* ~/output/$${path_prefix}/ ; \
  185. cp ~/output/$${path_prefix}/index.html ~/output ; \
  186. done < versions ;
  187. .PHONY: build-docs
  188. ###############################################################################
  189. ### Docker image ###
  190. ###############################################################################
  191. build-docker: build-linux
  192. cp $(BUILDDIR)/tendermint DOCKER/tendermint
  193. docker build --label=tendermint --tag="tendermint/tendermint" -f DOCKER/Dockerfile .
  194. rm -rf DOCKER/tendermint
  195. .PHONY: build-docker
  196. ###############################################################################
  197. ### Mocks ###
  198. ###############################################################################
  199. mockery:
  200. go generate -run="./scripts/mockery_generate.sh" ./...
  201. .PHONY: mockery
  202. ###############################################################################
  203. ### Local testnet using docker ###
  204. ###############################################################################
  205. # Build linux binary on other platforms
  206. build-linux:
  207. GOOS=linux GOARCH=amd64 $(MAKE) build
  208. .PHONY: build-linux
  209. build-docker-localnode:
  210. @cd networks/local && make
  211. .PHONY: build-docker-localnode
  212. # Runs `make build TENDERMINT_BUILD_OPTIONS=cleveldb` from within an Amazon
  213. # Linux (v2)-based Docker build container in order to build an Amazon
  214. # Linux-compatible binary. Produces a compatible binary at ./build/tendermint
  215. build_c-amazonlinux:
  216. $(MAKE) -C ./DOCKER build_amazonlinux_buildimage
  217. docker run --rm -it -v `pwd`:/tendermint tendermint/tendermint:build_c-amazonlinux
  218. .PHONY: build_c-amazonlinux
  219. # Run a 4-node testnet locally
  220. localnet-start: localnet-stop build-docker-localnode
  221. @if ! [ -f build/node0/config/genesis.json ]; then docker run --rm -v $(CURDIR)/build:/tendermint:Z tendermint/localnode testnet --config /etc/tendermint/config-template.toml --o . --starting-ip-address 192.167.10.2; fi
  222. docker-compose up
  223. .PHONY: localnet-start
  224. # Stop testnet
  225. localnet-stop:
  226. docker-compose down
  227. .PHONY: localnet-stop
  228. # Build hooks for dredd, to skip or add information on some steps
  229. build-contract-tests-hooks:
  230. ifeq ($(OS),Windows_NT)
  231. go build -mod=readonly $(BUILD_FLAGS) -o build/contract_tests.exe ./cmd/contract_tests
  232. else
  233. go build -mod=readonly $(BUILD_FLAGS) -o build/contract_tests ./cmd/contract_tests
  234. endif
  235. .PHONY: build-contract-tests-hooks
  236. # Run a nodejs tool to test endpoints against a localnet
  237. # The command takes care of starting and stopping the network
  238. # prerequisits: build-contract-tests-hooks build-linux
  239. # the two build commands were not added to let this command run from generic containers or machines.
  240. # The binaries should be built beforehand
  241. contract-tests:
  242. dredd
  243. .PHONY: contract-tests
  244. clean:
  245. rm -rf $(CURDIR)/artifacts/ $(BUILDDIR)/
  246. build-reproducible:
  247. docker rm latest-build || true
  248. docker run --volume=$(CURDIR):/sources:ro \
  249. --env TARGET_PLATFORMS='linux/amd64 linux/arm64 darwin/amd64 windows/amd64' \
  250. --env APP=tendermint \
  251. --env COMMIT=$(shell git rev-parse --short=8 HEAD) \
  252. --env VERSION=$(shell git describe --tags) \
  253. --name latest-build cosmossdk/rbuilder:latest
  254. docker cp -a latest-build:/home/builder/artifacts/ $(CURDIR)/
  255. .PHONY: build-reproducible
  256. # Implements test splitting and running. This is pulled directly from
  257. # the github action workflows for better local reproducibility.
  258. GO_TEST_FILES != find $(CURDIR) -name "*_test.go"
  259. # default to four splits by default
  260. NUM_SPLIT ?= 4
  261. $(BUILDDIR):
  262. mkdir -p $@
  263. # The format statement filters out all packages that don't have tests.
  264. # Note we need to check for both in-package tests (.TestGoFiles) and
  265. # out-of-package tests (.XTestGoFiles).
  266. $(BUILDDIR)/packages.txt:$(GO_TEST_FILES) $(BUILDDIR)
  267. go list -f "{{ if (or .TestGoFiles .XTestGoFiles) }}{{ .ImportPath }}{{ end }}" ./... | sort > $@
  268. split-test-packages:$(BUILDDIR)/packages.txt
  269. split -d -n l/$(NUM_SPLIT) $< $<.
  270. test-group-%:split-test-packages
  271. cat $(BUILDDIR)/packages.txt.$* | xargs go test -mod=readonly -timeout=5m -race -coverprofile=$(BUILDDIR)/$*.profile.out