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.

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