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.

398 lines
13 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 7m -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. test_p2p:
  107. environment:
  108. GOBIN: /home/circleci/.go_workspace/bin
  109. GOPATH: /home/circleci/.go_workspace
  110. machine:
  111. image: circleci/classic:latest
  112. parameters:
  113. ipv:
  114. type: integer
  115. default: 4
  116. steps:
  117. - checkout
  118. - run: mkdir -p $GOPATH/src/github.com/tendermint
  119. - run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
  120. - run: bash test/p2p/circleci.sh << parameters.ipv >>
  121. - store_artifacts:
  122. path: /home/circleci/project/test/p2p/logs
  123. upload_coverage:
  124. executor: golang
  125. steps:
  126. - attach_workspace:
  127. at: /tmp/workspace
  128. - restore_cache:
  129. name: "Restore source code cache"
  130. keys:
  131. - go-src-v1-{{ .Revision }}
  132. - checkout
  133. - restore_cache:
  134. name: "Restore go module cache"
  135. keys:
  136. - go-mod-v2-{{ checksum "go.sum" }}
  137. - run:
  138. name: gather
  139. command: |
  140. echo "mode: atomic" > coverage.txt
  141. for prof in $(ls /tmp/workspace/profiles/); do
  142. tail -n +2 /tmp/workspace/profiles/"$prof" >> coverage.txt
  143. done
  144. - run:
  145. name: upload
  146. command: bash .circleci/codecov.sh -f coverage.txt
  147. deploy_docs:
  148. executor: docs
  149. steps:
  150. - checkout
  151. - run:
  152. name: "Build docs"
  153. command: make build-docs
  154. - run:
  155. name: "Sync to S3"
  156. command: make sync-docs
  157. prepare_build:
  158. executor: golang
  159. steps:
  160. - restore_cache:
  161. name: "Restore source code cache"
  162. keys:
  163. - go-src-v1-{{ .Revision }}
  164. - checkout
  165. - run:
  166. name: Get next release number
  167. command: |
  168. export LAST_TAG="`git describe --tags --abbrev=0 --match "${CIRCLE_BRANCH}.*"`"
  169. echo "Last tag: ${LAST_TAG}"
  170. if [ -z "${LAST_TAG}" ]; then
  171. export LAST_TAG="${CIRCLE_BRANCH}"
  172. echo "Last tag not found. Possibly fresh branch or feature branch. Setting ${LAST_TAG} as tag."
  173. fi
  174. export NEXT_TAG="`python -u scripts/release_management/bump-semver.py --version "${LAST_TAG}"`"
  175. echo "Next tag: ${NEXT_TAG}"
  176. echo "export CIRCLE_TAG=\"${NEXT_TAG}\"" > release-version.source
  177. - run:
  178. name: Build dependencies
  179. command: make tools
  180. - persist_to_workspace:
  181. root: .
  182. paths:
  183. - "release-version.source"
  184. - save_cache:
  185. key: v2-release-deps-{{ checksum "go.sum" }}
  186. paths:
  187. - "/go/pkg/mod"
  188. build_artifacts:
  189. executor: golang
  190. parallelism: 4
  191. steps:
  192. - restore_cache:
  193. name: "Restore source code cache"
  194. keys:
  195. - go-src-v1-{{ .Revision }}
  196. - checkout
  197. - restore_cache:
  198. name: "Restore release dependencies cache"
  199. keys:
  200. - v2-release-deps-{{ checksum "go.sum" }}
  201. - attach_workspace:
  202. at: /tmp/workspace
  203. - run:
  204. name: Build artifact
  205. command: |
  206. # Setting CIRCLE_TAG because we do not tag the release ourselves.
  207. source /tmp/workspace/release-version.source
  208. 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
  209. 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
  210. 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
  211. 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
  212. - persist_to_workspace:
  213. root: build
  214. paths:
  215. - "*.zip"
  216. - "tendermint_linux_amd64"
  217. release_artifacts:
  218. executor: golang
  219. steps:
  220. - restore_cache:
  221. name: "Restore source code cache"
  222. keys:
  223. - go-src-v1-{{ .Revision }}
  224. - checkout
  225. - attach_workspace:
  226. at: /tmp/workspace
  227. - run:
  228. name: "Deploy to GitHub"
  229. command: |
  230. # Setting CIRCLE_TAG because we do not tag the release ourselves.
  231. source /tmp/workspace/release-version.source
  232. echo "---"
  233. ls -la /tmp/workspace/*.zip
  234. echo "---"
  235. python -u scripts/release_management/sha-files.py
  236. echo "---"
  237. cat /tmp/workspace/SHA256SUMS
  238. echo "---"
  239. export RELEASE_ID="`python -u scripts/release_management/github-draft.py`"
  240. echo "Release ID: ${RELEASE_ID}"
  241. #Todo: Parallelize uploads
  242. export GOOS=linux GOARCH=amd64 && python -u scripts/release_management/github-upload.py --id "${RELEASE_ID}"
  243. export GOOS=darwin GOARCH=amd64 && python -u scripts/release_management/github-upload.py --id "${RELEASE_ID}"
  244. export GOOS=windows GOARCH=amd64 && python -u scripts/release_management/github-upload.py --id "${RELEASE_ID}"
  245. export GOOS=linux GOARCH=arm && python -u scripts/release_management/github-upload.py --id "${RELEASE_ID}"
  246. python -u scripts/release_management/github-upload.py --file "/tmp/workspace/SHA256SUMS" --id "${RELEASE_ID}"
  247. python -u scripts/release_management/github-publish.py --id "${RELEASE_ID}"
  248. release_docker:
  249. machine:
  250. image: ubuntu-1604:201903-01
  251. steps:
  252. - checkout
  253. - attach_workspace:
  254. at: /tmp/workspace
  255. - run:
  256. name: "Deploy to Docker Hub"
  257. command: |
  258. # Setting CIRCLE_TAG because we do not tag the release ourselves.
  259. source /tmp/workspace/release-version.source
  260. cp /tmp/workspace/tendermint_linux_amd64 DOCKER/tendermint
  261. docker build --label="tendermint" --tag="tendermint/tendermint:${CIRCLE_TAG}" --tag="tendermint/tendermint:latest" "DOCKER"
  262. docker login -u "${DOCKERHUB_USER}" --password-stdin \<<< "${DOCKERHUB_PASS}"
  263. docker push "tendermint/tendermint"
  264. docker logout
  265. reproducible_builds:
  266. executor: golang
  267. steps:
  268. - attach_workspace:
  269. at: /tmp/workspace
  270. - checkout
  271. - setup_remote_docker:
  272. docker_layer_caching: true
  273. - run:
  274. name: Build tendermint
  275. no_output_timeout: 20m
  276. command: |
  277. sudo apt-get update
  278. sudo apt-get install -y ruby
  279. bash -x ./scripts/gitian-build.sh all
  280. for os in darwin linux windows; do
  281. cp gitian-build-${os}/result/tendermint-${os}-res.yml .
  282. cp gitian-build-${os}/build/out/tendermint-*.tar.gz .
  283. rm -rf gitian-build-${os}/
  284. done
  285. - store_artifacts:
  286. path: /go/src/github.com/tendermint/tendermint/tendermint-darwin-res.yml
  287. - store_artifacts:
  288. path: /go/src/github.com/tendermint/tendermint/tendermint-linux-res.yml
  289. - store_artifacts:
  290. path: /go/src/github.com/tendermint/tendermint/tendermint-windows-res.yml
  291. - store_artifacts:
  292. path: /go/src/github.com/tendermint/tendermint/tendermint-*.tar.gz
  293. # # Test RPC implementation against the swagger documented specs
  294. # contract_tests:
  295. # working_directory: /home/circleci/.go_workspace/src/github.com/tendermint/tendermint
  296. # machine:
  297. # image: circleci/classic:latest
  298. # environment:
  299. # GOBIN: /home/circleci/.go_workspace/bin
  300. # GOPATH: /home/circleci/.go_workspace/
  301. # GOOS: linux
  302. # GOARCH: amd64
  303. # parallelism: 1
  304. # steps:
  305. # - checkout
  306. # - run:
  307. # name: Test RPC endpoints against swagger documentation
  308. # command: |
  309. # set -x
  310. # export PATH=~/.local/bin:$PATH
  311. # # install node and dredd
  312. # ./scripts/get_nodejs.sh
  313. # # build the binaries with a proper version of Go
  314. # 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
  315. # # This docker image works with go 1.7, we can install here the hook handler that contract-tests is going to use
  316. # go get github.com/snikch/goodman/cmd/goodman
  317. # make contract-tests
  318. workflows:
  319. version: 2
  320. test-suite:
  321. jobs:
  322. - deploy_docs:
  323. context: tendermint-docs
  324. filters:
  325. branches:
  326. only:
  327. - master
  328. tags:
  329. only:
  330. - /^v.*/
  331. - deploy_docs:
  332. context: tendermint-docs-staging
  333. filters:
  334. branches:
  335. only:
  336. - docs-staging
  337. - setup_dependencies
  338. - test_cover:
  339. requires:
  340. - setup_dependencies
  341. - test_persistence:
  342. requires:
  343. - setup_dependencies
  344. - test_p2p
  345. - test_p2p:
  346. name: test_p2p_ipv6
  347. ipv: 6
  348. - upload_coverage:
  349. requires:
  350. - test_cover
  351. - reproducible_builds:
  352. filters:
  353. branches:
  354. only:
  355. - master
  356. - /v[0-9]+\.[0-9]+/
  357. # - contract_tests:
  358. # requires:
  359. # - setup_dependencies
  360. release:
  361. jobs:
  362. - prepare_build
  363. - build_artifacts:
  364. requires:
  365. - prepare_build
  366. - release_artifacts:
  367. requires:
  368. - prepare_build
  369. - build_artifacts
  370. filters:
  371. branches:
  372. only:
  373. - /v[0-9]+\.[0-9]+/
  374. - release_docker:
  375. requires:
  376. - prepare_build
  377. - build_artifacts
  378. filters:
  379. branches:
  380. only:
  381. - /v[0-9]+\.[0-9]+/
  382. - master