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.

101 lines
2.9 KiB

  1. name: Test Coverage
  2. on:
  3. pull_request:
  4. push:
  5. branches:
  6. - master
  7. - release/**
  8. jobs:
  9. split-test-files:
  10. runs-on: ubuntu-latest
  11. steps:
  12. - uses: actions/checkout@v2
  13. - name: Create a file with all the pkgs
  14. run: go list ./... > pkgs.txt
  15. - name: Split pkgs into 4 files
  16. run: split -n l/4 --additional-suffix=.txt ./pkgs.txt
  17. # cache multiple
  18. - uses: actions/upload-artifact@v2
  19. with:
  20. name: '${{ github.sha }}-aa'
  21. path: ./xaa.txt
  22. - uses: actions/upload-artifact@v2
  23. with:
  24. name: '${{ github.sha }}-ab'
  25. path: ./xab.txt
  26. - uses: actions/upload-artifact@v2
  27. with:
  28. name: '${{ github.sha }}-ac'
  29. path: ./xac.txt
  30. - uses: actions/upload-artifact@v2
  31. with:
  32. name: '${{ github.sha }}-ad'
  33. path: ./xad.txt
  34. test-coverage-part-1:
  35. runs-on: ubuntu-latest
  36. needs: split-test-files
  37. steps:
  38. - uses: actions/checkout@v2
  39. - uses: actions/download-artifact@v2
  40. with:
  41. name: '${{ github.sha }}-aa'
  42. - name: test & coverage report creation
  43. run: |
  44. cat xaa.txt | xargs go test -mod=readonly -timeout 8m -race -coverprofile=coverage.txt -covermode=atomic
  45. - uses: codecov/codecov-action@v1
  46. with:
  47. file: ./coverage.txt
  48. fail_ci_if_error: true
  49. test-coverage-part-2:
  50. runs-on: ubuntu-latest
  51. needs: split-test-files
  52. steps:
  53. - uses: actions/checkout@v2
  54. - uses: actions/download-artifact@v2
  55. with:
  56. name: '${{ github.sha }}-ab'
  57. - name: test & coverage report creation
  58. run: |
  59. cat xab.txt | xargs go test -mod=readonly -timeout 5m -race -coverprofile=coverage.txt -covermode=atomic
  60. - uses: codecov/codecov-action@v1
  61. with:
  62. file: ./coverage.txt
  63. fail_ci_if_error: true
  64. test-coverage-part-3:
  65. runs-on: ubuntu-latest
  66. needs: split-test-files
  67. steps:
  68. - uses: actions/checkout@v2
  69. - uses: actions/download-artifact@v2
  70. with:
  71. name: '${{ github.sha }}-ac'
  72. - name: test & coverage report creation
  73. run: |
  74. cat xac.txt | xargs go test -mod=readonly -timeout 5m -race -coverprofile=coverage.txt -covermode=atomic
  75. - uses: codecov/codecov-action@v1
  76. with:
  77. file: ./coverage.txt
  78. fail_ci_if_error: true
  79. test-coverage-part-4:
  80. runs-on: ubuntu-latest
  81. needs: split-test-files
  82. steps:
  83. - uses: actions/checkout@v2
  84. - uses: actions/download-artifact@v2
  85. with:
  86. name: '${{ github.sha }}-ad'
  87. - name: test & coverage report creation
  88. run: |
  89. cat xad.txt | xargs go test -mod=readonly -timeout 5m -race -coverprofile=coverage.txt -covermode=atomic
  90. - uses: codecov/codecov-action@v1
  91. with:
  92. file: ./coverage.txt
  93. fail_ci_if_error: true