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.

225 lines
5.8 KiB

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