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.

370 lines
10 KiB

6 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. 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. - store_artifacts:
  286. path: /home/circleci/project/test/p2p/logs
  287. upload_coverage:
  288. <<: *defaults
  289. steps:
  290. - attach_workspace:
  291. at: /tmp/workspace
  292. # - restore_cache:
  293. # key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  294. - checkout
  295. - run:
  296. name: tools
  297. command: |
  298. export PATH="$GOBIN:$PATH"
  299. make get_tools
  300. - run:
  301. name: dependencies
  302. command: |
  303. export PATH="$GOBIN:$PATH"
  304. make get_vendor_deps
  305. - run: mkdir -p $GOPATH/src/github.com/tendermint
  306. - run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
  307. - run:
  308. name: gather
  309. command: |
  310. set -ex
  311. echo "mode: atomic" > coverage.txt
  312. for prof in $(ls /tmp/workspace/profiles/); do
  313. tail -n +2 /tmp/workspace/profiles/"$prof" >> coverage.txt
  314. done
  315. - run:
  316. name: upload
  317. command: bash .circleci/codecov.sh -f coverage.txt
  318. workflows:
  319. version: 2
  320. test-suite:
  321. jobs:
  322. - setup_dependencies
  323. - lint:
  324. requires:
  325. - setup_dependencies
  326. - test_abci_apps:
  327. requires:
  328. - setup_dependencies
  329. - test_abci_cli:
  330. requires:
  331. - setup_dependencies
  332. - test_apps:
  333. requires:
  334. - setup_dependencies
  335. - test_cover:
  336. requires:
  337. - setup_dependencies
  338. - test_persistence:
  339. requires:
  340. - setup_dependencies
  341. - localnet:
  342. requires:
  343. - setup_dependencies
  344. - test_p2p
  345. - upload_coverage:
  346. requires:
  347. - test_cover