Skip to content

Commit

Permalink
Add code coverage CI job
Browse files Browse the repository at this point in the history
  • Loading branch information
rockdaboot committed Jan 4, 2024
1 parent 0a09ea3 commit 9a7f246
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/unit-test-on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,55 @@ jobs:
- name: Run Benchmarks
run: |
GOMAXPROCS=100 make bench
coverage:
name: Coverage
runs-on: ubuntu-latest
strategy:
fail-fast: true
max-parallel: 2
matrix:
go: ["stable"]
permissions:
contents: write
steps:
- name: Set up Go ${{matrix.go}}
uses: actions/setup-go@v4
with:
go-version: ${{matrix.go}}
check-latest: true
id: go
- name: Check out
uses: actions/checkout@v4
- name: Build
run: |
go install
- name: Run Coverage
run: |
go test -v -cover ./... -coverprofile coverage.out -coverpkg ./...
go tool cover -func coverage.out -o coverage.out # Replaces coverage.out with the analysis of coverage.out
- name: Go Coverage Badge
uses: tj-actions/coverage-badge-go@v1
# if: ${{ runner.os == 'Linux' && matrix.go == '1.17' }} # Runs this on only one of the ci builds.
with:
green: 80
filename: coverage.out

# - name: Pull in remote changes
# run: git pull --rebase

- uses: stefanzweifel/git-auto-commit-action@v5
id: auto-commit-action
with:
commit_message: Apply Code Coverage Badge
skip_fetch: true
skip_checkout: true
file_pattern: ./README.md

# - name: Push Changes
# if: steps.auto-commit-action.outputs.changes_detected == 'true'
# uses: ad-m/github-push-action@master
# with:
# github_token: ${{ github.token }}
# branch: ${{ github.ref }}

0 comments on commit 9a7f246

Please sign in to comment.