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.

230 lines
5.9 KiB

7 years ago
6 years ago
  1. version: 2
  2. defaults: &defaults
  3. working_directory: /go/src/github.com/tendermint/tendermint
  4. docker:
  5. - image: circleci/golang:1.10.3
  6. environment:
  7. GOBIN: /tmp/workspace/bin
  8. jobs:
  9. setup_dependencies:
  10. <<: *defaults
  11. steps:
  12. - run: mkdir -p /tmp/workspace/bin
  13. - run: mkdir -p /tmp/workspace/profiles
  14. - checkout
  15. - restore_cache:
  16. keys:
  17. - v3-pkg-cache
  18. - run:
  19. name: tools
  20. command: |
  21. export PATH="$GOBIN:$PATH"
  22. make get_tools
  23. - run:
  24. name: dependencies
  25. command: |
  26. export PATH="$GOBIN:$PATH"
  27. make get_vendor_deps
  28. - run:
  29. name: binaries
  30. command: |
  31. export PATH="$GOBIN:$PATH"
  32. make install install_abci
  33. - persist_to_workspace:
  34. root: /tmp/workspace
  35. paths:
  36. - bin
  37. - profiles
  38. - save_cache:
  39. key: v3-pkg-cache
  40. paths:
  41. - /go/pkg
  42. - save_cache:
  43. key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  44. paths:
  45. - /go/src/github.com/tendermint/tendermint
  46. build_slate:
  47. <<: *defaults
  48. steps:
  49. - attach_workspace:
  50. at: /tmp/workspace
  51. - restore_cache:
  52. key: v3-pkg-cache
  53. - restore_cache:
  54. key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  55. - run:
  56. name: slate docs
  57. command: |
  58. set -ex
  59. export PATH="$GOBIN:$PATH"
  60. make build-slate
  61. lint:
  62. <<: *defaults
  63. steps:
  64. - attach_workspace:
  65. at: /tmp/workspace
  66. - restore_cache:
  67. key: v3-pkg-cache
  68. - restore_cache:
  69. key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  70. - run:
  71. name: metalinter
  72. command: |
  73. set -ex
  74. export PATH="$GOBIN:$PATH"
  75. make metalinter
  76. - run:
  77. name: check_dep
  78. command: |
  79. set -ex
  80. export PATH="$GOBIN:$PATH"
  81. make check_dep
  82. test_abci_apps:
  83. <<: *defaults
  84. steps:
  85. - attach_workspace:
  86. at: /tmp/workspace
  87. - restore_cache:
  88. key: v3-pkg-cache
  89. - restore_cache:
  90. key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  91. - run:
  92. name: Run abci apps tests
  93. command: |
  94. export PATH="$GOBIN:$PATH"
  95. bash abci/tests/test_app/test.sh
  96. # if this test fails, fix it and update the docs at:
  97. # https://github.com/tendermint/tendermint/blob/develop/docs/abci-cli.md
  98. test_abci_cli:
  99. <<: *defaults
  100. steps:
  101. - attach_workspace:
  102. at: /tmp/workspace
  103. - restore_cache:
  104. key: v3-pkg-cache
  105. - restore_cache:
  106. key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  107. - run:
  108. name: Run abci-cli tests
  109. command: |
  110. export PATH="$GOBIN:$PATH"
  111. bash abci/tests/test_cli/test.sh
  112. test_apps:
  113. <<: *defaults
  114. steps:
  115. - attach_workspace:
  116. at: /tmp/workspace
  117. - restore_cache:
  118. key: v3-pkg-cache
  119. - restore_cache:
  120. key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  121. - run: sudo apt-get update && sudo apt-get install -y --no-install-recommends bsdmainutils
  122. - run:
  123. name: Run tests
  124. command: bash test/app/test.sh
  125. test_cover:
  126. <<: *defaults
  127. parallelism: 4
  128. steps:
  129. - attach_workspace:
  130. at: /tmp/workspace
  131. - restore_cache:
  132. key: v3-pkg-cache
  133. - restore_cache:
  134. key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  135. - run: mkdir -p /tmp/logs
  136. - run:
  137. name: Run tests
  138. command: |
  139. for pkg in $(go list github.com/tendermint/tendermint/... | circleci tests split --split-by=timings); do
  140. id=$(basename "$pkg")
  141. GOCACHE=off go test -timeout 5m -race -coverprofile=/tmp/workspace/profiles/$id.out -covermode=atomic "$pkg" | tee "/tmp/logs/$id-$RANDOM.log"
  142. done
  143. - persist_to_workspace:
  144. root: /tmp/workspace
  145. paths:
  146. - "profiles/*"
  147. - store_artifacts:
  148. path: /tmp/logs
  149. test_persistence:
  150. <<: *defaults
  151. steps:
  152. - attach_workspace:
  153. at: /tmp/workspace
  154. - restore_cache:
  155. key: v3-pkg-cache
  156. - restore_cache:
  157. key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  158. - run:
  159. name: Run tests
  160. command: bash test/persist/test_failure_indices.sh
  161. test_p2p:
  162. environment:
  163. GOBIN: /home/circleci/.go_workspace/bin
  164. GOPATH: /home/circleci/.go_workspace
  165. machine:
  166. image: circleci/classic:latest
  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
  172. upload_coverage:
  173. <<: *defaults
  174. steps:
  175. - attach_workspace:
  176. at: /tmp/workspace
  177. - restore_cache:
  178. key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  179. - run:
  180. name: gather
  181. command: |
  182. set -ex
  183. echo "mode: atomic" > coverage.txt
  184. for prof in $(ls /tmp/workspace/profiles/); do
  185. tail -n +2 /tmp/workspace/profiles/"$prof" >> coverage.txt
  186. done
  187. - run:
  188. name: upload
  189. command: bash <(curl -s https://codecov.io/bash) -f coverage.txt
  190. workflows:
  191. version: 2
  192. test-suite:
  193. jobs:
  194. - setup_dependencies
  195. - lint:
  196. requires:
  197. - setup_dependencies
  198. - test_abci_apps:
  199. requires:
  200. - setup_dependencies
  201. - test_abci_cli:
  202. requires:
  203. - setup_dependencies
  204. - test_apps:
  205. requires:
  206. - setup_dependencies
  207. - test_cover:
  208. requires:
  209. - setup_dependencies
  210. - test_persistence:
  211. requires:
  212. - setup_dependencies
  213. - test_p2p
  214. - upload_coverage:
  215. requires:
  216. - test_cover