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.

368 lines
10 KiB

7 years ago
7 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. localnet:
  254. working_directory: /home/circleci/.go_workspace/src/github.com/tendermint/tendermint
  255. machine:
  256. image: circleci/classic:latest
  257. environment:
  258. GOBIN: /home/circleci/.go_workspace/bin
  259. GOPATH: /home/circleci/.go_workspace/
  260. GOOS: linux
  261. GOARCH: amd64
  262. parallelism: 1
  263. steps:
  264. - checkout
  265. - run:
  266. name: run localnet and exit on failure
  267. command: |
  268. set -x
  269. make get_tools
  270. make get_vendor_deps
  271. make build-linux
  272. make localnet-start &
  273. ./scripts/localnet-blocks-test.sh 40 5 10 localhost
  274. test_p2p:
  275. environment:
  276. GOBIN: /home/circleci/.go_workspace/bin
  277. GOPATH: /home/circleci/.go_workspace
  278. machine:
  279. image: circleci/classic:latest
  280. steps:
  281. - checkout
  282. - run: mkdir -p $GOPATH/src/github.com/tendermint
  283. - run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
  284. - run: bash test/p2p/circleci.sh
  285. upload_coverage:
  286. <<: *defaults
  287. steps:
  288. - attach_workspace:
  289. at: /tmp/workspace
  290. # - restore_cache:
  291. # key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  292. - checkout
  293. - run:
  294. name: tools
  295. command: |
  296. export PATH="$GOBIN:$PATH"
  297. make get_tools
  298. - run:
  299. name: dependencies
  300. command: |
  301. export PATH="$GOBIN:$PATH"
  302. make get_vendor_deps
  303. - run: mkdir -p $GOPATH/src/github.com/tendermint
  304. - run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
  305. - run:
  306. name: gather
  307. command: |
  308. set -ex
  309. echo "mode: atomic" > coverage.txt
  310. for prof in $(ls /tmp/workspace/profiles/); do
  311. tail -n +2 /tmp/workspace/profiles/"$prof" >> coverage.txt
  312. done
  313. - run:
  314. name: upload
  315. command: bash .circleci/codecov.sh -f coverage.txt
  316. workflows:
  317. version: 2
  318. test-suite:
  319. jobs:
  320. - setup_dependencies
  321. - lint:
  322. requires:
  323. - setup_dependencies
  324. - test_abci_apps:
  325. requires:
  326. - setup_dependencies
  327. - test_abci_cli:
  328. requires:
  329. - setup_dependencies
  330. - test_apps:
  331. requires:
  332. - setup_dependencies
  333. - test_cover:
  334. requires:
  335. - setup_dependencies
  336. - test_persistence:
  337. requires:
  338. - setup_dependencies
  339. - localnet:
  340. requires:
  341. - setup_dependencies
  342. - test_p2p
  343. - upload_coverage:
  344. requires:
  345. - test_cover