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.

220 lines
5.7 KiB

  1. version: 2
  2. defaults: &defaults
  3. working_directory: /go/src/github.com/tendermint/tendermint
  4. docker:
  5. - image: circleci/golang:1.10.0
  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. - persist_to_workspace:
  34. root: /tmp/workspace
  35. paths:
  36. - bin
  37. - profiles
  38. - save_cache:
  39. key: v2-pkg-cache
  40. paths:
  41. - /go/pkg
  42. - save_cache:
  43. key: v2-tree-{{ .Environment.CIRCLE_SHA1 }}
  44. paths:
  45. - /go/src/github.com/tendermint/tendermint
  46. setup_abci:
  47. <<: *defaults
  48. steps:
  49. - attach_workspace:
  50. at: /tmp/workspace
  51. - restore_cache:
  52. key: v2-pkg-cache
  53. - restore_cache:
  54. key: v2-tree-{{ .Environment.CIRCLE_SHA1 }}
  55. - run:
  56. name: Checkout abci
  57. command: |
  58. commit=$(bash scripts/dep_utils/parse.sh abci)
  59. go get -v -u -d github.com/tendermint/abci/...
  60. cd /go/src/github.com/tendermint/abci
  61. git checkout "$commit"
  62. - run:
  63. working_directory: /go/src/github.com/tendermint/abci
  64. name: Install abci
  65. command: |
  66. set -ex
  67. export PATH="$GOBIN:$PATH"
  68. make get_tools
  69. make get_vendor_deps
  70. make install
  71. - run: ls -lah /tmp/workspace/bin
  72. - persist_to_workspace:
  73. root: /tmp/workspace
  74. paths:
  75. - "bin/abci*"
  76. build_slate:
  77. <<: *defaults
  78. steps:
  79. - attach_workspace:
  80. at: /tmp/workspace
  81. - restore_cache:
  82. key: v2-pkg-cache
  83. - restore_cache:
  84. key: v2-tree-{{ .Environment.CIRCLE_SHA1 }}
  85. - run:
  86. name: slate docs
  87. command: |
  88. set -ex
  89. export PATH="$GOBIN:$PATH"
  90. make build-slate
  91. lint:
  92. <<: *defaults
  93. steps:
  94. - attach_workspace:
  95. at: /tmp/workspace
  96. - restore_cache:
  97. key: v2-pkg-cache
  98. - restore_cache:
  99. key: v2-tree-{{ .Environment.CIRCLE_SHA1 }}
  100. - run:
  101. name: metalinter
  102. command: |
  103. set -ex
  104. export PATH="$GOBIN:$PATH"
  105. make metalinter
  106. test_apps:
  107. <<: *defaults
  108. steps:
  109. - attach_workspace:
  110. at: /tmp/workspace
  111. - restore_cache:
  112. key: v2-pkg-cache
  113. - restore_cache:
  114. key: v2-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: v2-pkg-cache
  127. - restore_cache:
  128. key: v2-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/... | grep -v /vendor/ | 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: v2-pkg-cache
  150. - restore_cache:
  151. key: v2-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: v2-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. - setup_abci:
  190. requires:
  191. - setup_dependencies
  192. - lint:
  193. requires:
  194. - setup_dependencies
  195. - test_apps:
  196. requires:
  197. - setup_abci
  198. - test_cover:
  199. requires:
  200. - setup_dependencies
  201. - test_persistence:
  202. requires:
  203. - setup_abci
  204. - test_p2p
  205. - upload_coverage:
  206. requires:
  207. - test_cover