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.

454 lines
15 KiB

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