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.6 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. - v1-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: v1-pkg-cache
  40. paths:
  41. - /go/pkg
  42. - save_cache:
  43. key: v1-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: v1-pkg-cache
  53. - restore_cache:
  54. key: v1-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: v1-pkg-cache
  83. - restore_cache:
  84. key: v1-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: v1-pkg-cache
  98. - restore_cache:
  99. key: v1-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: v1-pkg-cache
  113. - restore_cache:
  114. key: v1-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: v1-pkg-cache
  127. - restore_cache:
  128. key: v1-tree-{{ .Environment.CIRCLE_SHA1 }}
  129. - run:
  130. name: Run tests
  131. command: |
  132. for pkg in $(go list github.com/tendermint/tendermint/... | grep -v /vendor/ | circleci tests split --split-by=timings); do
  133. id=$(basename "$pkg")
  134. go test -timeout 5m -race -coverprofile=/tmp/workspace/profiles/$id.out -covermode=atomic "$pkg"
  135. done
  136. - persist_to_workspace:
  137. root: /tmp/workspace
  138. paths:
  139. - "profiles/*"
  140. test_persistence:
  141. <<: *defaults
  142. steps:
  143. - attach_workspace:
  144. at: /tmp/workspace
  145. - restore_cache:
  146. key: v1-pkg-cache
  147. - restore_cache:
  148. key: v1-tree-{{ .Environment.CIRCLE_SHA1 }}
  149. - run:
  150. name: Run tests
  151. command: bash test/persist/test_failure_indices.sh
  152. test_p2p:
  153. environment:
  154. GOBIN: /home/circleci/.go_workspace/bin
  155. GOPATH: /home/circleci/.go_workspace
  156. machine:
  157. image: circleci/classic:latest
  158. steps:
  159. - checkout
  160. - run: mkdir -p $GOPATH/src/github.com/tendermint
  161. - run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
  162. - run: bash test/p2p/circleci.sh
  163. upload_coverage:
  164. <<: *defaults
  165. steps:
  166. - attach_workspace:
  167. at: /tmp/workspace
  168. - restore_cache:
  169. key: v1-tree-{{ .Environment.CIRCLE_SHA1 }}
  170. - run:
  171. name: gather
  172. command: |
  173. set -ex
  174. echo "mode: atomic" > coverage.txt
  175. for prof in $(ls /tmp/workspace/profiles/); do
  176. tail -n +2 /tmp/workspace/profiles/"$prof" >> coverage.txt
  177. done
  178. - run:
  179. name: upload
  180. command: bash <(curl -s https://codecov.io/bash) -f coverage.txt
  181. workflows:
  182. version: 2
  183. test-suite:
  184. jobs:
  185. - setup_dependencies
  186. - build_slate:
  187. requires:
  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