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.

224 lines
5.8 KiB

6 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. test_abci_apps:
  77. <<: *defaults
  78. steps:
  79. - attach_workspace:
  80. at: /tmp/workspace
  81. - restore_cache:
  82. key: v3-pkg-cache
  83. - restore_cache:
  84. key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  85. - run:
  86. name: Run abci apps tests
  87. command: |
  88. export PATH="$GOBIN:$PATH"
  89. bash abci/tests/test_app/test.sh
  90. # if this test fails, fix it and update the docs at:
  91. # https://github.com/tendermint/tendermint/blob/develop/docs/abci-cli.md
  92. test_abci_cli:
  93. <<: *defaults
  94. steps:
  95. - attach_workspace:
  96. at: /tmp/workspace
  97. - restore_cache:
  98. key: v3-pkg-cache
  99. - restore_cache:
  100. key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  101. - run:
  102. name: Run abci-cli tests
  103. command: |
  104. export PATH="$GOBIN:$PATH"
  105. bash abci/tests/test_cli/test.sh
  106. test_apps:
  107. <<: *defaults
  108. steps:
  109. - attach_workspace:
  110. at: /tmp/workspace
  111. - restore_cache:
  112. key: v3-pkg-cache
  113. - restore_cache:
  114. key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  115. - run: sudo apt-get update && sudo apt-get install -y --no-install-recommends bsdmainutils
  116. - run:
  117. name: Run tests
  118. command: bash test/app/test.sh
  119. test_cover:
  120. <<: *defaults
  121. parallelism: 4
  122. steps:
  123. - attach_workspace:
  124. at: /tmp/workspace
  125. - restore_cache:
  126. key: v3-pkg-cache
  127. - restore_cache:
  128. key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  129. - run: mkdir -p /tmp/logs
  130. - run:
  131. name: Run tests
  132. command: |
  133. for pkg in $(go list github.com/tendermint/tendermint/... | circleci tests split --split-by=timings); do
  134. id=$(basename "$pkg")
  135. GOCACHE=off go test -v -timeout 5m -race -coverprofile=/tmp/workspace/profiles/$id.out -covermode=atomic "$pkg" | tee "/tmp/logs/$id-$RANDOM.log"
  136. done
  137. - persist_to_workspace:
  138. root: /tmp/workspace
  139. paths:
  140. - "profiles/*"
  141. - store_artifacts:
  142. path: /tmp/logs
  143. test_persistence:
  144. <<: *defaults
  145. steps:
  146. - attach_workspace:
  147. at: /tmp/workspace
  148. - restore_cache:
  149. key: v3-pkg-cache
  150. - restore_cache:
  151. key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  152. - run:
  153. name: Run tests
  154. command: bash test/persist/test_failure_indices.sh
  155. test_p2p:
  156. environment:
  157. GOBIN: /home/circleci/.go_workspace/bin
  158. GOPATH: /home/circleci/.go_workspace
  159. machine:
  160. image: circleci/classic:latest
  161. steps:
  162. - checkout
  163. - run: mkdir -p $GOPATH/src/github.com/tendermint
  164. - run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
  165. - run: bash test/p2p/circleci.sh
  166. upload_coverage:
  167. <<: *defaults
  168. steps:
  169. - attach_workspace:
  170. at: /tmp/workspace
  171. - restore_cache:
  172. key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  173. - run:
  174. name: gather
  175. command: |
  176. set -ex
  177. echo "mode: atomic" > coverage.txt
  178. for prof in $(ls /tmp/workspace/profiles/); do
  179. tail -n +2 /tmp/workspace/profiles/"$prof" >> coverage.txt
  180. done
  181. - run:
  182. name: upload
  183. command: bash <(curl -s https://codecov.io/bash) -f coverage.txt
  184. workflows:
  185. version: 2
  186. test-suite:
  187. jobs:
  188. - setup_dependencies
  189. - lint:
  190. requires:
  191. - setup_dependencies
  192. - test_abci_apps:
  193. requires:
  194. - setup_dependencies
  195. - test_abci_cli:
  196. requires:
  197. - setup_dependencies
  198. - test_apps:
  199. requires:
  200. - setup_dependencies
  201. - test_cover:
  202. requires:
  203. - setup_dependencies
  204. - test_persistence:
  205. requires:
  206. - setup_dependencies
  207. - test_p2p
  208. - upload_coverage:
  209. requires:
  210. - test_cover