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.

121 lines
3.1 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_integration:
  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 integration tests
  57. command: |
  58. find . -path ./vendor -prune -o -name "*.sock" -exec rm {} \;
  59. bash tests/test.sh
  60. test_cover:
  61. <<: *defaults
  62. parallelism: 4
  63. steps:
  64. - attach_workspace:
  65. at: /tmp/workspace
  66. - restore_cache:
  67. key: v1-pkg-cache
  68. - restore_cache:
  69. key: v1-tree-{{ .Environment.CIRCLE_SHA1 }}
  70. - run:
  71. name: Run test cover
  72. command: |
  73. for pkg in $(go list github.com/tendermint/abci/... | grep -v /vendor/ | circleci tests split --split-by=timings); do
  74. id=$(basename "$pkg")
  75. go test -timeout 5m -race -coverprofile=/tmp/workspace/profiles/$id.out -covermode=atomic "$pkg"
  76. done
  77. - persist_to_workspace:
  78. root: /tmp/workspace
  79. paths:
  80. - "profiles/*"
  81. upload_coverage:
  82. <<: *defaults
  83. steps:
  84. - attach_workspace:
  85. at: /tmp/workspace
  86. - restore_cache:
  87. key: v1-tree-{{ .Environment.CIRCLE_SHA1 }}
  88. - run:
  89. name: gather
  90. command: |
  91. set -ex
  92. echo "mode: atomic" > coverage.txt
  93. for prof in $(ls /tmp/workspace/profiles/); do
  94. tail -n +2 /tmp/workspace/profiles/"$prof" >> coverage.txt
  95. done
  96. - run:
  97. name: upload
  98. command: bash <(curl -s https://codecov.io/bash) -f coverage.txt
  99. workflows:
  100. version: 2
  101. test-suite:
  102. jobs:
  103. - setup_dependencies
  104. - test_cover:
  105. requires:
  106. - setup_dependencies
  107. - test_integration:
  108. requires:
  109. - setup_dependencies
  110. - upload_coverage:
  111. requires:
  112. - test_integrations