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.

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