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.

343 lines
9.4 KiB

7 years ago
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. - v3-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 install_abci
  33. - persist_to_workspace:
  34. root: /tmp/workspace
  35. paths:
  36. - bin
  37. - profiles
  38. - save_cache:
  39. key: v3-pkg-cache
  40. paths:
  41. - /go/pkg
  42. # - save_cache:
  43. # key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  44. # paths:
  45. # - /go/src/github.com/tendermint/tendermint
  46. build_slate:
  47. <<: *defaults
  48. steps:
  49. - attach_workspace:
  50. at: /tmp/workspace
  51. - restore_cache:
  52. key: v3-pkg-cache
  53. # https://discuss.circleci.com/t/saving-cache-stopped-working-warning-skipping-this-step-disabled-in-configuration/24423/2
  54. # - restore_cache:
  55. # key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  56. - checkout
  57. - run:
  58. name: tools
  59. command: |
  60. export PATH="$GOBIN:$PATH"
  61. make get_tools
  62. - run:
  63. name: dependencies
  64. command: |
  65. export PATH="$GOBIN:$PATH"
  66. make get_vendor_deps
  67. - run: mkdir -p $GOPATH/src/github.com/tendermint
  68. - run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
  69. - run:
  70. name: slate docs
  71. command: |
  72. set -ex
  73. export PATH="$GOBIN:$PATH"
  74. make build-slate
  75. lint:
  76. <<: *defaults
  77. steps:
  78. - attach_workspace:
  79. at: /tmp/workspace
  80. - restore_cache:
  81. key: v3-pkg-cache
  82. # - restore_cache:
  83. # key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  84. - checkout
  85. - run:
  86. name: tools
  87. command: |
  88. export PATH="$GOBIN:$PATH"
  89. make get_tools
  90. - run:
  91. name: dependencies
  92. command: |
  93. export PATH="$GOBIN:$PATH"
  94. make get_vendor_deps
  95. - run: mkdir -p $GOPATH/src/github.com/tendermint
  96. - run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
  97. - run:
  98. name: metalinter
  99. command: |
  100. set -ex
  101. export PATH="$GOBIN:$PATH"
  102. make metalinter
  103. - run:
  104. name: check_dep
  105. command: |
  106. set -ex
  107. export PATH="$GOBIN:$PATH"
  108. make check_dep
  109. test_abci_apps:
  110. <<: *defaults
  111. steps:
  112. - attach_workspace:
  113. at: /tmp/workspace
  114. - restore_cache:
  115. key: v3-pkg-cache
  116. # - restore_cache:
  117. # key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  118. - checkout
  119. - run:
  120. name: tools
  121. command: |
  122. export PATH="$GOBIN:$PATH"
  123. make get_tools
  124. - run:
  125. name: dependencies
  126. command: |
  127. export PATH="$GOBIN:$PATH"
  128. make get_vendor_deps
  129. - run: mkdir -p $GOPATH/src/github.com/tendermint
  130. - run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
  131. - run:
  132. name: Run abci apps tests
  133. command: |
  134. export PATH="$GOBIN:$PATH"
  135. bash abci/tests/test_app/test.sh
  136. # if this test fails, fix it and update the docs at:
  137. # https://github.com/tendermint/tendermint/blob/develop/docs/abci-cli.md
  138. test_abci_cli:
  139. <<: *defaults
  140. steps:
  141. - attach_workspace:
  142. at: /tmp/workspace
  143. - restore_cache:
  144. key: v3-pkg-cache
  145. # - restore_cache:
  146. # key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  147. - checkout
  148. - run:
  149. name: tools
  150. command: |
  151. export PATH="$GOBIN:$PATH"
  152. make get_tools
  153. - run:
  154. name: dependencies
  155. command: |
  156. export PATH="$GOBIN:$PATH"
  157. make get_vendor_deps
  158. - run: mkdir -p $GOPATH/src/github.com/tendermint
  159. - run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
  160. - run:
  161. name: Run abci-cli tests
  162. command: |
  163. export PATH="$GOBIN:$PATH"
  164. bash abci/tests/test_cli/test.sh
  165. test_apps:
  166. <<: *defaults
  167. steps:
  168. - attach_workspace:
  169. at: /tmp/workspace
  170. - restore_cache:
  171. key: v3-pkg-cache
  172. # - restore_cache:
  173. # key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  174. - checkout
  175. - run:
  176. name: tools
  177. command: |
  178. export PATH="$GOBIN:$PATH"
  179. make get_tools
  180. - run:
  181. name: dependencies
  182. command: |
  183. export PATH="$GOBIN:$PATH"
  184. make get_vendor_deps
  185. - run: mkdir -p $GOPATH/src/github.com/tendermint
  186. - run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
  187. - run: sudo apt-get update && sudo apt-get install -y --no-install-recommends bsdmainutils
  188. - run:
  189. name: Run tests
  190. command: bash test/app/test.sh
  191. test_cover:
  192. <<: *defaults
  193. parallelism: 4
  194. steps:
  195. - attach_workspace:
  196. at: /tmp/workspace
  197. - restore_cache:
  198. key: v3-pkg-cache
  199. # - restore_cache:
  200. # key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  201. - checkout
  202. - run:
  203. name: tools
  204. command: |
  205. export PATH="$GOBIN:$PATH"
  206. make get_tools
  207. - run:
  208. name: dependencies
  209. command: |
  210. export PATH="$GOBIN:$PATH"
  211. make get_vendor_deps
  212. - run: mkdir -p $GOPATH/src/github.com/tendermint
  213. - run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
  214. - run: mkdir -p /tmp/logs
  215. - run:
  216. name: Run tests
  217. command: |
  218. for pkg in $(go list github.com/tendermint/tendermint/... | circleci tests split --split-by=timings); do
  219. id=$(basename "$pkg")
  220. GOCACHE=off go test -timeout 5m -race -coverprofile=/tmp/workspace/profiles/$id.out -covermode=atomic "$pkg" | tee "/tmp/logs/$id-$RANDOM.log"
  221. done
  222. - persist_to_workspace:
  223. root: /tmp/workspace
  224. paths:
  225. - "profiles/*"
  226. - store_artifacts:
  227. path: /tmp/logs
  228. test_persistence:
  229. <<: *defaults
  230. steps:
  231. - attach_workspace:
  232. at: /tmp/workspace
  233. - restore_cache:
  234. key: v3-pkg-cache
  235. # - restore_cache:
  236. # key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  237. - checkout
  238. - run:
  239. name: tools
  240. command: |
  241. export PATH="$GOBIN:$PATH"
  242. make get_tools
  243. - run:
  244. name: dependencies
  245. command: |
  246. export PATH="$GOBIN:$PATH"
  247. make get_vendor_deps
  248. - run: mkdir -p $GOPATH/src/github.com/tendermint
  249. - run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
  250. - run:
  251. name: Run tests
  252. command: bash test/persist/test_failure_indices.sh
  253. test_p2p:
  254. environment:
  255. GOBIN: /home/circleci/.go_workspace/bin
  256. GOPATH: /home/circleci/.go_workspace
  257. machine:
  258. image: circleci/classic:latest
  259. steps:
  260. - checkout
  261. - run: mkdir -p $GOPATH/src/github.com/tendermint
  262. - run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
  263. - run: bash test/p2p/circleci.sh
  264. upload_coverage:
  265. <<: *defaults
  266. steps:
  267. - attach_workspace:
  268. at: /tmp/workspace
  269. # - restore_cache:
  270. # key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  271. - checkout
  272. - run:
  273. name: tools
  274. command: |
  275. export PATH="$GOBIN:$PATH"
  276. make get_tools
  277. - run:
  278. name: dependencies
  279. command: |
  280. export PATH="$GOBIN:$PATH"
  281. make get_vendor_deps
  282. - run: mkdir -p $GOPATH/src/github.com/tendermint
  283. - run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
  284. - run:
  285. name: gather
  286. command: |
  287. set -ex
  288. echo "mode: atomic" > coverage.txt
  289. for prof in $(ls /tmp/workspace/profiles/); do
  290. tail -n +2 /tmp/workspace/profiles/"$prof" >> coverage.txt
  291. done
  292. - run:
  293. name: upload
  294. command: bash <(curl -s https://codecov.io/bash) -f coverage.txt
  295. workflows:
  296. version: 2
  297. test-suite:
  298. jobs:
  299. - setup_dependencies
  300. - lint:
  301. requires:
  302. - setup_dependencies
  303. - test_abci_apps:
  304. requires:
  305. - setup_dependencies
  306. - test_abci_cli:
  307. requires:
  308. - setup_dependencies
  309. - test_apps:
  310. requires:
  311. - setup_dependencies
  312. - test_cover:
  313. requires:
  314. - setup_dependencies
  315. - test_persistence:
  316. requires:
  317. - setup_dependencies
  318. - test_p2p
  319. - upload_coverage:
  320. requires:
  321. - test_cover