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.

371 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. make get_dev_tools
  91. - run:
  92. name: dependencies
  93. command: |
  94. export PATH="$GOBIN:$PATH"
  95. make get_vendor_deps
  96. - run: mkdir -p $GOPATH/src/github.com/tendermint
  97. - run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
  98. - run:
  99. name: metalinter
  100. command: |
  101. set -ex
  102. export PATH="$GOBIN:$PATH"
  103. make metalinter
  104. - run:
  105. name: check_dep
  106. command: |
  107. set -ex
  108. export PATH="$GOBIN:$PATH"
  109. make check_dep
  110. test_abci_apps:
  111. <<: *defaults
  112. steps:
  113. - attach_workspace:
  114. at: /tmp/workspace
  115. - restore_cache:
  116. key: v3-pkg-cache
  117. # - restore_cache:
  118. # key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  119. - checkout
  120. - run:
  121. name: tools
  122. command: |
  123. export PATH="$GOBIN:$PATH"
  124. make get_tools
  125. - run:
  126. name: dependencies
  127. command: |
  128. export PATH="$GOBIN:$PATH"
  129. make get_vendor_deps
  130. - run: mkdir -p $GOPATH/src/github.com/tendermint
  131. - run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
  132. - run:
  133. name: Run abci apps tests
  134. command: |
  135. export PATH="$GOBIN:$PATH"
  136. bash abci/tests/test_app/test.sh
  137. # if this test fails, fix it and update the docs at:
  138. # https://github.com/tendermint/tendermint/blob/develop/docs/abci-cli.md
  139. test_abci_cli:
  140. <<: *defaults
  141. steps:
  142. - attach_workspace:
  143. at: /tmp/workspace
  144. - restore_cache:
  145. key: v3-pkg-cache
  146. # - restore_cache:
  147. # key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  148. - checkout
  149. - run:
  150. name: tools
  151. command: |
  152. export PATH="$GOBIN:$PATH"
  153. make get_tools
  154. - run:
  155. name: dependencies
  156. command: |
  157. export PATH="$GOBIN:$PATH"
  158. make get_vendor_deps
  159. - run: mkdir -p $GOPATH/src/github.com/tendermint
  160. - run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
  161. - run:
  162. name: Run abci-cli tests
  163. command: |
  164. export PATH="$GOBIN:$PATH"
  165. bash abci/tests/test_cli/test.sh
  166. test_apps:
  167. <<: *defaults
  168. steps:
  169. - attach_workspace:
  170. at: /tmp/workspace
  171. - restore_cache:
  172. key: v3-pkg-cache
  173. # - restore_cache:
  174. # key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  175. - checkout
  176. - run:
  177. name: tools
  178. command: |
  179. export PATH="$GOBIN:$PATH"
  180. make get_tools
  181. - run:
  182. name: dependencies
  183. command: |
  184. export PATH="$GOBIN:$PATH"
  185. make get_vendor_deps
  186. - run: mkdir -p $GOPATH/src/github.com/tendermint
  187. - run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
  188. - run: sudo apt-get update && sudo apt-get install -y --no-install-recommends bsdmainutils
  189. - run:
  190. name: Run tests
  191. command: bash test/app/test.sh
  192. test_cover:
  193. <<: *defaults
  194. parallelism: 4
  195. steps:
  196. - attach_workspace:
  197. at: /tmp/workspace
  198. - restore_cache:
  199. key: v3-pkg-cache
  200. # - restore_cache:
  201. # key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  202. - checkout
  203. - run:
  204. name: tools
  205. command: |
  206. export PATH="$GOBIN:$PATH"
  207. make get_tools
  208. - run:
  209. name: dependencies
  210. command: |
  211. export PATH="$GOBIN:$PATH"
  212. make get_vendor_deps
  213. - run: mkdir -p $GOPATH/src/github.com/tendermint
  214. - run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
  215. - run: mkdir -p /tmp/logs
  216. - run:
  217. name: Run tests
  218. command: |
  219. for pkg in $(go list github.com/tendermint/tendermint/... | circleci tests split --split-by=timings); do
  220. id=$(basename "$pkg")
  221. GOCACHE=off go test -timeout 5m -race -coverprofile=/tmp/workspace/profiles/$id.out -covermode=atomic "$pkg" | tee "/tmp/logs/$id-$RANDOM.log"
  222. done
  223. - persist_to_workspace:
  224. root: /tmp/workspace
  225. paths:
  226. - "profiles/*"
  227. - store_artifacts:
  228. path: /tmp/logs
  229. test_persistence:
  230. <<: *defaults
  231. steps:
  232. - attach_workspace:
  233. at: /tmp/workspace
  234. - restore_cache:
  235. key: v3-pkg-cache
  236. # - restore_cache:
  237. # key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  238. - checkout
  239. - run:
  240. name: tools
  241. command: |
  242. export PATH="$GOBIN:$PATH"
  243. make get_tools
  244. - run:
  245. name: dependencies
  246. command: |
  247. export PATH="$GOBIN:$PATH"
  248. make get_vendor_deps
  249. - run: mkdir -p $GOPATH/src/github.com/tendermint
  250. - run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
  251. - run:
  252. name: Run tests
  253. command: bash test/persist/test_failure_indices.sh
  254. localnet:
  255. working_directory: /home/circleci/.go_workspace/src/github.com/tendermint/tendermint
  256. machine:
  257. image: circleci/classic:latest
  258. environment:
  259. GOBIN: /home/circleci/.go_workspace/bin
  260. GOPATH: /home/circleci/.go_workspace/
  261. GOOS: linux
  262. GOARCH: amd64
  263. parallelism: 1
  264. steps:
  265. - checkout
  266. - run:
  267. name: run localnet and exit on failure
  268. command: |
  269. set -x
  270. make get_tools
  271. make get_vendor_deps
  272. make build-linux
  273. make localnet-start &
  274. ./scripts/localnet-blocks-test.sh 40 5 10 localhost
  275. test_p2p:
  276. environment:
  277. GOBIN: /home/circleci/.go_workspace/bin
  278. GOPATH: /home/circleci/.go_workspace
  279. machine:
  280. image: circleci/classic:latest
  281. steps:
  282. - checkout
  283. - run: mkdir -p $GOPATH/src/github.com/tendermint
  284. - run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
  285. - run: bash test/p2p/circleci.sh
  286. - store_artifacts:
  287. path: /home/circleci/project/test/p2p/logs
  288. upload_coverage:
  289. <<: *defaults
  290. steps:
  291. - attach_workspace:
  292. at: /tmp/workspace
  293. # - restore_cache:
  294. # key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
  295. - checkout
  296. - run:
  297. name: tools
  298. command: |
  299. export PATH="$GOBIN:$PATH"
  300. make get_tools
  301. - run:
  302. name: dependencies
  303. command: |
  304. export PATH="$GOBIN:$PATH"
  305. make get_vendor_deps
  306. - run: mkdir -p $GOPATH/src/github.com/tendermint
  307. - run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
  308. - run:
  309. name: gather
  310. command: |
  311. set -ex
  312. echo "mode: atomic" > coverage.txt
  313. for prof in $(ls /tmp/workspace/profiles/); do
  314. tail -n +2 /tmp/workspace/profiles/"$prof" >> coverage.txt
  315. done
  316. - run:
  317. name: upload
  318. command: bash .circleci/codecov.sh -f coverage.txt
  319. workflows:
  320. version: 2
  321. test-suite:
  322. jobs:
  323. - setup_dependencies
  324. - lint:
  325. requires:
  326. - setup_dependencies
  327. - test_abci_apps:
  328. requires:
  329. - setup_dependencies
  330. - test_abci_cli:
  331. requires:
  332. - setup_dependencies
  333. - test_apps:
  334. requires:
  335. - setup_dependencies
  336. - test_cover:
  337. requires:
  338. - setup_dependencies
  339. - test_persistence:
  340. requires:
  341. - setup_dependencies
  342. - localnet:
  343. requires:
  344. - setup_dependencies
  345. - test_p2p
  346. - upload_coverage:
  347. requires:
  348. - test_cover