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.

201 lines
5.2 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_persistence:
  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/persist/test_failure_indices.sh
  137. test_p2p:
  138. environment:
  139. GOBIN: /home/circleci/.go_workspace/bin
  140. GOPATH: /home/circleci/.go_workspace
  141. machine:
  142. image: circleci/classic:latest
  143. steps:
  144. - checkout
  145. - run: mkdir -p $GOPATH/src/github.com/tendermint
  146. - run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
  147. - run: bash test/circleci/p2p.sh
  148. upload_coverage:
  149. <<: *defaults
  150. steps:
  151. - attach_workspace:
  152. at: /tmp/workspace
  153. - restore_cache:
  154. key: v1-tree-{{ .Environment.CIRCLE_SHA1 }}
  155. - run:
  156. name: gather
  157. command: |
  158. set -ex
  159. echo "mode: atomic" > coverage.txt
  160. for prof in $(ls /tmp/workspace/profiles/); do
  161. tail -n +2 /tmp/workspace/profiles/"$prof" >> coverage.txt
  162. done
  163. - run:
  164. name: upload
  165. command: bash <(curl -s https://codecov.io/bash) -f coverage.txt
  166. workflows:
  167. version: 2
  168. test-suite:
  169. jobs:
  170. - setup_dependencies
  171. - setup_abci:
  172. requires:
  173. - setup_dependencies
  174. - lint:
  175. requires:
  176. - setup_dependencies
  177. - test_apps:
  178. requires:
  179. - setup_abci
  180. - test_cover:
  181. requires:
  182. - setup_dependencies
  183. - test_persistence:
  184. requires:
  185. - setup_abci
  186. - test_p2p
  187. - upload_coverage:
  188. requires:
  189. - test_cover