feat: switch from third-party coverage tool to GitHub API #186
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: coverage | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| permissions: {} | |
| jobs: | |
| coverage: | |
| permissions: | |
| contents: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | |
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version: stable | |
| - name: Calculate coverage | |
| run: | | |
| go test -count=1 -v -covermode=atomic -coverprofile=cover.out -coverpkg=./... ./... | |
| - name: Convert Go coverage profile to cobertuba format | |
| run: | | |
| go get github.com/boumenot/gocover-cobertura@v1.5.0 | |
| gocover-cobertura < cover.out > cover.xml | |
| - name: Upload coverage to GitHub API | |
| uses: actions/upload-code-coverage@abb5995db9e0199b0e2bb9dbd136fce4cb1ec4d3 # v1.3.0 | |
| with: | |
| file: cover.xml | |
| language: Go | |
| label: code-coverage/${{ github.repository }} |