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.

206 lines
8.0 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
  1. PACKAGES=$(shell go list ./...)
  2. OUTPUT?=build/tendermint
  3. BUILD_TAGS?='tendermint'
  4. LD_FLAGS = -X github.com/tendermint/tendermint/version.GitCommit=`git rev-parse --short=8 HEAD` -s -w
  5. BUILD_FLAGS = -mod=readonly -ldflags "$(LD_FLAGS)"
  6. all: check build test install
  7. # The below include contains the tools.
  8. include tools.mk
  9. include tests.mk
  10. ###############################################################################
  11. ### Build Tendermint ###
  12. ###############################################################################
  13. build:
  14. CGO_ENABLED=0 go build $(BUILD_FLAGS) -tags $(BUILD_TAGS) -o $(OUTPUT) ./cmd/tendermint/
  15. build_c:
  16. CGO_ENABLED=1 go build $(BUILD_FLAGS) -tags "$(BUILD_TAGS) cleveldb" -o $(OUTPUT) ./cmd/tendermint/
  17. build_race:
  18. CGO_ENABLED=1 go build -race $(BUILD_FLAGS) -tags $(BUILD_TAGS) -o $(OUTPUT) ./cmd/tendermint
  19. install:
  20. CGO_ENABLED=0 go install $(BUILD_FLAGS) -tags $(BUILD_TAGS) ./cmd/tendermint
  21. install_c:
  22. CGO_ENABLED=1 go install $(BUILD_FLAGS) -tags "$(BUILD_TAGS) cleveldb" ./cmd/tendermint
  23. ###############################################################################
  24. ### Protobuf ###
  25. ###############################################################################
  26. proto-all: proto-gen proto-lint proto-check-breaking
  27. proto-gen:
  28. ## If you get the following error,
  29. ## "error while loading shared libraries: libprotobuf.so.14: cannot open shared object file: No such file or directory"
  30. ## See https://stackoverflow.com/a/25518702
  31. ## Note the $< here is substituted for the %.proto
  32. ## Note the $@ here is substituted for the %.pb.go
  33. @sh scripts/protocgen.sh
  34. proto-lint:
  35. @buf check lint --error-format=json
  36. proto-check-breaking:
  37. @buf check breaking --against-input '.git#branch=master'
  38. .PHONY: proto-all proto-gen proto-lint proto-check-breaking
  39. ###############################################################################
  40. ### Build ABCI ###
  41. ###############################################################################
  42. build_abci:
  43. @go build -mod=readonly -i ./abci/cmd/...
  44. install_abci:
  45. @go install -mod=readonly ./abci/cmd/...
  46. ###############################################################################
  47. ### Distribution ###
  48. ###############################################################################
  49. # dist builds binaries for all platforms and packages them for distribution
  50. # TODO add abci to these scripts
  51. dist:
  52. @BUILD_TAGS=$(BUILD_TAGS) sh -c "'$(CURDIR)/scripts/dist.sh'"
  53. go-mod-cache: go.sum
  54. @echo "--> Download go modules to local cache"
  55. @go mod download
  56. .PHONY: go-mod-cache
  57. go.sum: go.mod
  58. @echo "--> Ensure dependencies have not been modified"
  59. @go mod verify
  60. @go mod tidy
  61. draw_deps:
  62. @# requires brew install graphviz or apt-get install graphviz
  63. go get github.com/RobotsAndPencils/goviz
  64. @goviz -i github.com/tendermint/tendermint/cmd/tendermint -d 3 | dot -Tpng -o dependency-graph.png
  65. get_deps_bin_size:
  66. @# Copy of build recipe with additional flags to perform binary size analysis
  67. $(eval $(shell go build -work -a $(BUILD_FLAGS) -tags $(BUILD_TAGS) -o $(OUTPUT) ./cmd/tendermint/ 2>&1))
  68. @find $(WORK) -type f -name "*.a" | xargs -I{} du -hxs "{}" | sort -rh | sed -e s:${WORK}/::g > deps_bin_size.log
  69. @echo "Results can be found here: $(CURDIR)/deps_bin_size.log"
  70. ###############################################################################
  71. ### Libs ###
  72. ###############################################################################
  73. # generates certificates for TLS testing in remotedb and RPC server
  74. gen_certs: clean_certs
  75. certstrap init --common-name "tendermint.com" --passphrase ""
  76. certstrap request-cert --common-name "server" -ip "127.0.0.1" --passphrase ""
  77. certstrap sign "server" --CA "tendermint.com" --passphrase ""
  78. mv out/server.crt rpc/lib/server/test.crt
  79. mv out/server.key rpc/lib/server/test.key
  80. rm -rf out
  81. # deletes generated certificates
  82. clean_certs:
  83. rm -f rpc/lib/server/test.crt
  84. rm -f rpc/lib/server/test.key
  85. ###############################################################################
  86. ### Formatting, linting, and vetting ###
  87. ###############################################################################
  88. fmt:
  89. @go fmt ./...
  90. lint:
  91. @echo "--> Running linter"
  92. @golangci-lint run
  93. DESTINATION = ./index.html.md
  94. ###############################################################################
  95. ### Documentation ###
  96. ###############################################################################
  97. build-docs:
  98. cd docs && \
  99. while read p; do \
  100. (git checkout $${p} && npm install && VUEPRESS_BASE="/$${p}/" npm run build) ; \
  101. mkdir -p ~/output/$${p} ; \
  102. cp -r .vuepress/dist/* ~/output/$${p}/ ; \
  103. cp ~/output/$${p}/index.html ~/output ; \
  104. done < versions ;
  105. sync-docs:
  106. cd ~/output && \
  107. echo "role_arn = ${DEPLOYMENT_ROLE_ARN}" >> /root/.aws/config ; \
  108. echo "CI job = ${CIRCLE_BUILD_URL}" >> version.html ; \
  109. aws s3 sync . s3://${WEBSITE_BUCKET} --profile terraform --delete ; \
  110. aws cloudfront create-invalidation --distribution-id ${CF_DISTRIBUTION_ID} --profile terraform --path "/*" ;
  111. .PHONY: sync-docs
  112. ###############################################################################
  113. ### Docker image ###
  114. ###############################################################################
  115. build-docker:
  116. cp $(OUTPUT) DOCKER/tendermint
  117. docker build --label=tendermint --tag="tendermint/tendermint" DOCKER
  118. rm -rf DOCKER/tendermint
  119. ###############################################################################
  120. ### Local testnet using docker ###
  121. ###############################################################################
  122. # Build linux binary on other platforms
  123. build-linux: tools
  124. GOOS=linux GOARCH=amd64 $(MAKE) build
  125. build-docker-localnode:
  126. @cd networks/local && make
  127. # Runs `make build_c` from within an Amazon Linux (v2)-based Docker build
  128. # container in order to build an Amazon Linux-compatible binary. Produces a
  129. # compatible binary at ./build/tendermint
  130. build_c-amazonlinux:
  131. $(MAKE) -C ./DOCKER build_amazonlinux_buildimage
  132. docker run --rm -it -v `pwd`:/tendermint tendermint/tendermint:build_c-amazonlinux
  133. # Run a 4-node testnet locally
  134. localnet-start: localnet-stop build-docker-localnode
  135. @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 --v 4 --o . --populate-persistent-peers --starting-ip-address 192.167.10.2; fi
  136. docker-compose up
  137. # Stop testnet
  138. localnet-stop:
  139. docker-compose down
  140. # Build hooks for dredd, to skip or add information on some steps
  141. build-contract-tests-hooks:
  142. ifeq ($(OS),Windows_NT)
  143. go build -mod=readonly $(BUILD_FLAGS) -o build/contract_tests.exe ./cmd/contract_tests
  144. else
  145. go build -mod=readonly $(BUILD_FLAGS) -o build/contract_tests ./cmd/contract_tests
  146. endif
  147. # Run a nodejs tool to test endpoints against a localnet
  148. # The command takes care of starting and stopping the network
  149. # prerequisits: build-contract-tests-hooks build-linux
  150. # the two build commands were not added to let this command run from generic containers or machines.
  151. # The binaries should be built beforehand
  152. contract-tests:
  153. dredd
  154. # To avoid unintended conflicts with file names, always add to .PHONY
  155. # unless there is a reason not to.
  156. # https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html
  157. .PHONY: check build build_race build_abci dist install install_abci check_tools tools update_tools draw_deps \
  158. protoc_abci protoc_libs gen_certs clean_certs grpc_dbserver fmt build-linux localnet-start \
  159. localnet-stop build-docker build-docker-localnode protoc_grpc protoc_all \
  160. build_c install_c test_with_deadlock cleanup_after_test_with_deadlock lint build-contract-tests-hooks contract-tests \
  161. build_c-amazonlinux