Install gocover-cobertura. #2
Workflow file for this run
This file contains 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: Create Coverage | |
on: push | |
permissions: write-all | |
jobs: | |
coverage: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: '1.21.0' | |
- name: Setup | |
run: | | |
go get github.com/boumenot/gocover-cobertura | |
go install github.com/boumenot/gocover-cobertura | |
- name: Test | |
run: go test ./... -coverprofile=coverage.out | |
- name: Convert | |
run: gocover-cobertura -by-files < coverage.out > coverage.xml | |
- name: Code Coverage Report | |
uses: irongut/CodeCoverageSummary@v1.3.0 | |
with: | |
filename: coverage.xml | |
badge: true | |
fail_below_min: true | |
format: markdown | |
hide_branch_rate: false | |
hide_complexity: false | |
indicators: true | |
output: both | |
thresholds: '60 80' | |
- name: Checkout wiki code | |
uses: actions/checkout@v2 | |
with: | |
repository: ${{github.repository}}.wiki | |
path: markdown | |
- name: Push to wiki | |
run: | | |
cp code-coverage-results.md markdown/ | |
cd markdown | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add . | |
git diff-index --quiet HEAD || git commit -m "Add changes" && git push |