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.

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