ci: add coverage report #4
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: Go | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go: [ | |
'1.22', | |
] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go ${{ matrix.go }} | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Display Go version | |
run: go version | |
# install and tests | |
- name: Install dependencies | |
run: go mod download | |
- name: Build | |
run: go build -v ./... | |
- name: Install staticcheck | |
run: go install honnef.co/go/tools/cmd/staticcheck@latest | |
- name: Test | |
run: make test | |
# coverage | |
- name: Go Coverage Badge | |
uses: tj-actions/coverage-badge-go@v1 | |
with: | |
green: 80 | |
filename: coverage.out | |
- uses: stefanzweifel/git-auto-commit-action@v4 | |
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 }} |