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.

139 lines
3.6 KiB

  1. version: 2
  2. defaults: &defaults
  3. working_directory: /go/src/github.com/tendermint/abci
  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/abci
  46. test_apps:
  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: Run apps tests
  57. command: |
  58. export PATH="$GOBIN:$PATH"
  59. bash tests/test_app/test.sh
  60. # XXX: if this test fails, fix it and update the docs at:
  61. # https://github.com/tendermint/tendermint/blob/develop/docs/abci-cli.rst
  62. test_cli:
  63. <<: *defaults
  64. steps:
  65. - attach_workspace:
  66. at: /tmp/workspace
  67. - restore_cache:
  68. key: v1-pkg-cache
  69. - restore_cache:
  70. key: v1-tree-{{ .Environment.CIRCLE_SHA1 }}
  71. - run:
  72. name: Run cli tests
  73. command: |
  74. export PATH="$GOBIN:$PATH"
  75. bash tests/test_cli/test.sh
  76. test_cover:
  77. <<: *defaults
  78. parallelism: 4
  79. steps:
  80. - attach_workspace:
  81. at: /tmp/workspace
  82. - restore_cache:
  83. key: v1-pkg-cache
  84. - restore_cache:
  85. key: v1-tree-{{ .Environment.CIRCLE_SHA1 }}
  86. - run:
  87. name: Run test cover
  88. command: |
  89. for pkg in $(go list github.com/tendermint/abci/... | grep -v /vendor/ | circleci tests split --split-by=timings); do
  90. id=$(basename "$pkg")
  91. go test -timeout 5m -race -coverprofile=/tmp/workspace/profiles/$id.out -covermode=atomic "$pkg"
  92. done
  93. - persist_to_workspace:
  94. root: /tmp/workspace
  95. paths:
  96. - "profiles/*"
  97. upload_coverage:
  98. <<: *defaults
  99. steps:
  100. - attach_workspace:
  101. at: /tmp/workspace
  102. - restore_cache:
  103. key: v1-tree-{{ .Environment.CIRCLE_SHA1 }}
  104. - run:
  105. name: gather
  106. command: |
  107. set -ex
  108. echo "mode: atomic" > coverage.txt
  109. for prof in $(ls /tmp/workspace/profiles/); do
  110. tail -n +2 /tmp/workspace/profiles/"$prof" >> coverage.txt
  111. done
  112. - run:
  113. name: upload
  114. command: bash <(curl -s https://codecov.io/bash) -f coverage.txt
  115. workflows:
  116. version: 2
  117. test-suite:
  118. jobs:
  119. - setup_dependencies
  120. - test_cover:
  121. requires:
  122. - setup_dependencies
  123. - test_apps:
  124. requires:
  125. - setup_dependencies
  126. - test_cli:
  127. requires:
  128. - setup_dependencies
  129. - upload_coverage:
  130. requires:
  131. - test_cover