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.

421 lines
14 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
  1. version: 2.1
  2. executors:
  3. golang:
  4. docker:
  5. - image: tendermintdev/docker-tendermint-build
  6. working_directory: /go/src/github.com/tendermint/tendermint
  7. environment:
  8. GOBIN: /tmp/bin
  9. release:
  10. machine: true
  11. docs:
  12. docker:
  13. - image: tendermintdev/docker-website-deployment
  14. environment:
  15. AWS_REGION: us-east-1
  16. commands:
  17. run_test:
  18. parameters:
  19. script_path:
  20. type: string
  21. steps:
  22. - attach_workspace:
  23. at: /tmp/bin
  24. - restore_cache:
  25. name: "Restore source code cache"
  26. keys:
  27. - go-src-v1-{{ .Revision }}
  28. - checkout
  29. - restore_cache:
  30. name: "Restore go modules cache"
  31. keys:
  32. - go-mod-v1-{{ checksum "go.sum" }}
  33. - run:
  34. name: "Running test"
  35. command: |
  36. bash << parameters.script_path >>
  37. jobs:
  38. setup_dependencies:
  39. executor: golang
  40. steps:
  41. - checkout
  42. - restore_cache:
  43. name: "Restore go modules cache"
  44. keys:
  45. - go-mod-v1-{{ checksum "go.sum" }}
  46. - run:
  47. command: |
  48. mkdir -p /tmp/bin
  49. - run:
  50. name: Cache go modules
  51. command: make go-mod-cache
  52. - run:
  53. name: tools
  54. command: make tools
  55. - run:
  56. name: "Build binaries"
  57. command: make install install_abci
  58. - save_cache:
  59. name: "Save go modules cache"
  60. key: go-mod-v1-{{ checksum "go.sum" }}
  61. paths:
  62. - "/go/pkg/mod"
  63. - save_cache:
  64. name: "Save source code cache"
  65. key: go-src-v1-{{ .Revision }}
  66. paths:
  67. - ".git"
  68. - persist_to_workspace:
  69. root: "/tmp/bin"
  70. paths:
  71. - "."
  72. test_persistence:
  73. executor: golang
  74. steps:
  75. - run_test:
  76. script_path: test/persist/test_failure_indices.sh
  77. test_cover:
  78. executor: golang
  79. parallelism: 4
  80. steps:
  81. - restore_cache:
  82. name: "Restore source code cache"
  83. keys:
  84. - go-src-v1-{{ .Revision }}
  85. - checkout
  86. - restore_cache:
  87. name: "Restore go module cache"
  88. keys:
  89. - go-mod-v2-{{ checksum "go.sum" }}
  90. - run:
  91. name: "Run tests"
  92. command: |
  93. export VERSION="$(git describe --tags --long | sed 's/v\(.*\)/\1/')"
  94. export GO111MODULE=on
  95. mkdir -p /tmp/logs /tmp/workspace/profiles
  96. for pkg in $(go list github.com/tendermint/tendermint/... | circleci tests split --split-by=timings); do
  97. id=$(basename "$pkg")
  98. go test -timeout 5m -mod=readonly -race -coverprofile=/tmp/workspace/profiles/$id.out -covermode=atomic "$pkg" | tee "/tmp/logs/$id-$RANDOM.log"
  99. done
  100. - persist_to_workspace:
  101. root: /tmp/workspace
  102. paths:
  103. - "profiles/*"
  104. - store_artifacts:
  105. path: /tmp/logs
  106. localnet:
  107. working_directory: /home/circleci/.go_workspace/src/github.com/tendermint/tendermint
  108. machine:
  109. image: circleci/classic:latest
  110. environment:
  111. GOBIN: /home/circleci/.go_workspace/bin
  112. GOPATH: /home/circleci/.go_workspace/
  113. GOOS: linux
  114. GOARCH: amd64
  115. parallelism: 1
  116. steps:
  117. - checkout
  118. - run:
  119. name: run localnet and exit on failure
  120. command: |
  121. set -x
  122. docker run --rm -v "$PWD":/go/src/github.com/tendermint/tendermint -w /go/src/github.com/tendermint/tendermint golang make build-linux
  123. make localnet-start &
  124. ./scripts/localnet-blocks-test.sh 40 5 10 localhost
  125. test_p2p:
  126. environment:
  127. GOBIN: /home/circleci/.go_workspace/bin
  128. GOPATH: /home/circleci/.go_workspace
  129. machine:
  130. image: circleci/classic:latest
  131. parameters:
  132. ipv:
  133. type: integer
  134. default: 4
  135. steps:
  136. - checkout
  137. - run: mkdir -p $GOPATH/src/github.com/tendermint
  138. - run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
  139. - run: bash test/p2p/circleci.sh << parameters.ipv >>
  140. - store_artifacts:
  141. path: /home/circleci/project/test/p2p/logs
  142. upload_coverage:
  143. executor: golang
  144. steps:
  145. - attach_workspace:
  146. at: /tmp/workspace
  147. - restore_cache:
  148. name: "Restore source code cache"
  149. keys:
  150. - go-src-v1-{{ .Revision }}
  151. - checkout
  152. - restore_cache:
  153. name: "Restore go module cache"
  154. keys:
  155. - go-mod-v2-{{ checksum "go.sum" }}
  156. - run:
  157. name: gather
  158. command: |
  159. echo "mode: atomic" > coverage.txt
  160. for prof in $(ls /tmp/workspace/profiles/); do
  161. tail -n +2 /tmp/workspace/profiles/"$prof" >> coverage.txt
  162. done
  163. - run:
  164. name: upload
  165. command: bash .circleci/codecov.sh -f coverage.txt
  166. deploy_docs:
  167. executor: docs
  168. steps:
  169. - checkout
  170. - run:
  171. name: "Build docs"
  172. command: make build-docs
  173. - run:
  174. name: "Sync to S3"
  175. command: make sync-docs
  176. prepare_build:
  177. executor: golang
  178. steps:
  179. - restore_cache:
  180. name: "Restore source code cache"
  181. keys:
  182. - go-src-v1-{{ .Revision }}
  183. - checkout
  184. - run:
  185. name: Get next release number
  186. command: |
  187. export LAST_TAG="`git describe --tags --abbrev=0 --match "${CIRCLE_BRANCH}.*"`"
  188. echo "Last tag: ${LAST_TAG}"
  189. if [ -z "${LAST_TAG}" ]; then
  190. export LAST_TAG="${CIRCLE_BRANCH}"
  191. echo "Last tag not found. Possibly fresh branch or feature branch. Setting ${LAST_TAG} as tag."
  192. fi
  193. export NEXT_TAG="`python -u scripts/release_management/bump-semver.py --version "${LAST_TAG}"`"
  194. echo "Next tag: ${NEXT_TAG}"
  195. echo "export CIRCLE_TAG=\"${NEXT_TAG}\"" > release-version.source
  196. - run:
  197. name: Build dependencies
  198. command: make tools
  199. - persist_to_workspace:
  200. root: .
  201. paths:
  202. - "release-version.source"
  203. - save_cache:
  204. key: v2-release-deps-{{ checksum "go.sum" }}
  205. paths:
  206. - "/go/pkg/mod"
  207. build_artifacts:
  208. executor: golang
  209. parallelism: 4
  210. steps:
  211. - restore_cache:
  212. name: "Restore source code cache"
  213. keys:
  214. - go-src-v1-{{ .Revision }}
  215. - checkout
  216. - restore_cache:
  217. name: "Restore release dependencies cache"
  218. keys:
  219. - v2-release-deps-{{ checksum "go.sum" }}
  220. - attach_workspace:
  221. at: /tmp/workspace
  222. - run:
  223. name: Build artifact
  224. command: |
  225. # Setting CIRCLE_TAG because we do not tag the release ourselves.
  226. source /tmp/workspace/release-version.source
  227. if test ${CIRCLE_NODE_INDEX:-0} == 0 ;then export GOOS=linux GOARCH=amd64 && export OUTPUT=build/tendermint_${GOOS}_${GOARCH} && make build && python -u scripts/release_management/zip-file.py ;fi
  228. if test ${CIRCLE_NODE_INDEX:-0} == 1 ;then export GOOS=darwin GOARCH=amd64 && export OUTPUT=build/tendermint_${GOOS}_${GOARCH} && make build && python -u scripts/release_management/zip-file.py ;fi
  229. if test ${CIRCLE_NODE_INDEX:-0} == 2 ;then export GOOS=windows GOARCH=amd64 && export OUTPUT=build/tendermint_${GOOS}_${GOARCH} && make build && python -u scripts/release_management/zip-file.py ;fi
  230. if test ${CIRCLE_NODE_INDEX:-0} == 3 ;then export GOOS=linux GOARCH=arm && export OUTPUT=build/tendermint_${GOOS}_${GOARCH} && make build && python -u scripts/release_management/zip-file.py ;fi
  231. - persist_to_workspace:
  232. root: build
  233. paths:
  234. - "*.zip"
  235. - "tendermint_linux_amd64"
  236. release_artifacts:
  237. executor: golang
  238. steps:
  239. - restore_cache:
  240. name: "Restore source code cache"
  241. keys:
  242. - go-src-v1-{{ .Revision }}
  243. - checkout
  244. - attach_workspace:
  245. at: /tmp/workspace
  246. - run:
  247. name: "Deploy to GitHub"
  248. command: |
  249. # Setting CIRCLE_TAG because we do not tag the release ourselves.
  250. source /tmp/workspace/release-version.source
  251. echo "---"
  252. ls -la /tmp/workspace/*.zip
  253. echo "---"
  254. python -u scripts/release_management/sha-files.py
  255. echo "---"
  256. cat /tmp/workspace/SHA256SUMS
  257. echo "---"
  258. export RELEASE_ID="`python -u scripts/release_management/github-draft.py`"
  259. echo "Release ID: ${RELEASE_ID}"
  260. #Todo: Parallelize uploads
  261. export GOOS=linux GOARCH=amd64 && python -u scripts/release_management/github-upload.py --id "${RELEASE_ID}"
  262. export GOOS=darwin GOARCH=amd64 && python -u scripts/release_management/github-upload.py --id "${RELEASE_ID}"
  263. export GOOS=windows GOARCH=amd64 && python -u scripts/release_management/github-upload.py --id "${RELEASE_ID}"
  264. export GOOS=linux GOARCH=arm && python -u scripts/release_management/github-upload.py --id "${RELEASE_ID}"
  265. python -u scripts/release_management/github-upload.py --file "/tmp/workspace/SHA256SUMS" --id "${RELEASE_ID}"
  266. python -u scripts/release_management/github-publish.py --id "${RELEASE_ID}"
  267. release_docker:
  268. machine:
  269. image: ubuntu-1604:201903-01
  270. steps:
  271. - checkout
  272. - attach_workspace:
  273. at: /tmp/workspace
  274. - run:
  275. name: "Deploy to Docker Hub"
  276. command: |
  277. # Setting CIRCLE_TAG because we do not tag the release ourselves.
  278. source /tmp/workspace/release-version.source
  279. cp /tmp/workspace/tendermint_linux_amd64 DOCKER/tendermint
  280. docker build --label="tendermint" --tag="tendermint/tendermint:${CIRCLE_TAG}" --tag="tendermint/tendermint:latest" "DOCKER"
  281. docker login -u "${DOCKERHUB_USER}" --password-stdin \<<< "${DOCKERHUB_PASS}"
  282. docker push "tendermint/tendermint"
  283. docker logout
  284. reproducible_builds:
  285. executor: golang
  286. steps:
  287. - attach_workspace:
  288. at: /tmp/workspace
  289. - checkout
  290. - setup_remote_docker:
  291. docker_layer_caching: true
  292. - run:
  293. name: Build tendermint
  294. no_output_timeout: 20m
  295. command: |
  296. sudo apt-get update
  297. sudo apt-get install -y ruby
  298. bash -x ./scripts/gitian-build.sh all
  299. for os in darwin linux windows; do
  300. cp gitian-build-${os}/result/tendermint-${os}-res.yml .
  301. cp gitian-build-${os}/build/out/tendermint-*.tar.gz .
  302. rm -rf gitian-build-${os}/
  303. done
  304. - store_artifacts:
  305. path: /go/src/github.com/tendermint/tendermint/tendermint-darwin-res.yml
  306. - store_artifacts:
  307. path: /go/src/github.com/tendermint/tendermint/tendermint-linux-res.yml
  308. - store_artifacts:
  309. path: /go/src/github.com/tendermint/tendermint/tendermint-windows-res.yml
  310. - store_artifacts:
  311. path: /go/src/github.com/tendermint/tendermint/tendermint-*.tar.gz
  312. # # Test RPC implementation against the swagger documented specs
  313. # contract_tests:
  314. # working_directory: /home/circleci/.go_workspace/src/github.com/tendermint/tendermint
  315. # machine:
  316. # image: circleci/classic:latest
  317. # environment:
  318. # GOBIN: /home/circleci/.go_workspace/bin
  319. # GOPATH: /home/circleci/.go_workspace/
  320. # GOOS: linux
  321. # GOARCH: amd64
  322. # parallelism: 1
  323. # steps:
  324. # - checkout
  325. # - run:
  326. # name: Test RPC endpoints against swagger documentation
  327. # command: |
  328. # set -x
  329. # export PATH=~/.local/bin:$PATH
  330. # # install node and dredd
  331. # ./scripts/get_nodejs.sh
  332. # # build the binaries with a proper version of Go
  333. # docker run --rm -v "$PWD":/go/src/github.com/tendermint/tendermint -w /go/src/github.com/tendermint/tendermint golang make build-linux build-contract-tests-hooks
  334. # # This docker image works with go 1.7, we can install here the hook handler that contract-tests is going to use
  335. # go get github.com/snikch/goodman/cmd/goodman
  336. # make contract-tests
  337. workflows:
  338. version: 2
  339. test-suite:
  340. jobs:
  341. - deploy_docs:
  342. context: tendermint-docs
  343. filters:
  344. branches:
  345. only:
  346. - master
  347. tags:
  348. only:
  349. - /^v.*/
  350. - deploy_docs:
  351. context: tendermint-docs-staging
  352. filters:
  353. branches:
  354. only:
  355. - docs-staging
  356. - setup_dependencies
  357. - test_cover:
  358. requires:
  359. - setup_dependencies
  360. - test_persistence:
  361. requires:
  362. - setup_dependencies
  363. - localnet:
  364. requires:
  365. - setup_dependencies
  366. - test_p2p
  367. - test_p2p:
  368. name: test_p2p_ipv6
  369. ipv: 6
  370. - upload_coverage:
  371. requires:
  372. - test_cover
  373. - reproducible_builds:
  374. filters:
  375. branches:
  376. only:
  377. - master
  378. - /v[0-9]+\.[0-9]+/
  379. # - contract_tests:
  380. # requires:
  381. # - setup_dependencies
  382. release:
  383. jobs:
  384. - prepare_build
  385. - build_artifacts:
  386. requires:
  387. - prepare_build
  388. - release_artifacts:
  389. requires:
  390. - prepare_build
  391. - build_artifacts
  392. filters:
  393. branches:
  394. only:
  395. - /v[0-9]+\.[0-9]+/
  396. - release_docker:
  397. requires:
  398. - prepare_build
  399. - build_artifacts
  400. filters:
  401. branches:
  402. only:
  403. - /v[0-9]+\.[0-9]+/
  404. - master