Test Coverage #19
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: Test Coverage | |
run-name: Test Coverage | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Go 1.21 | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.21 | |
- name: Generate Test Coverage | |
run: go test ./... -coverprofile=./cover.out | |
- name: Check Test Coverage | |
id: coverage | |
uses: vladopajic/go-test-coverage@v2 | |
with: | |
config: ./.testcoverage.yml | |
- name: Make Coverage Badge | |
uses: action-badges/[email protected] | |
if: contains(github.ref, 'master') | |
with: | |
label: coverage | |
message: ${{ steps.coverage.outputs.badge-text }} | |
message-color: ${{ steps.coverage.outputs.badge-color }} | |
file-name: coverage.svg | |
badge-branch: badges ## orphan branch where badge will be committed | |
github-token: "${{ secrets.GH_PAT }}" |