coverage.yml 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. name: Coverage
  2. on:
  3. push:
  4. branches:
  5. - master
  6. - v*
  7. paths:
  8. - "**/*.go"
  9. jobs:
  10. coverage:
  11. if: github.repository != 'v2ray/v2ray-core'
  12. runs-on: ubuntu-latest
  13. steps:
  14. - name: Set up Go 1.x
  15. uses: actions/setup-go@v2
  16. with:
  17. go-version: ^1.15
  18. - name: Checkout codebase
  19. uses: actions/checkout@v2
  20. - name: Cache go module
  21. uses: actions/cache@v2
  22. id: cache-gomodules
  23. with:
  24. path: ~/go/pkg/mod
  25. key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
  26. restore-keys: |
  27. ${{ runner.os }}-go-
  28. - name: Get dependencies
  29. if: steps.cache-gomodules.outputs.cache-hit != 'true'
  30. run: go get -v -t -d ./...
  31. - name: Run coverage
  32. run: |
  33. chmod u+x ./testing/coverage/coverall.sh
  34. ./testing/coverage/coverall.sh
  35. - name: Upload coverage to Codecov
  36. uses: codecov/codecov-action@v1
  37. with:
  38. file: ./coverage.txt
  39. fail_ci_if_error: true