Initial version of bice #4
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: Go Test Coverage | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
coverage: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.23.4" | |
- name: Run Tests and Generate Coverage Report | |
run: go test -race -timeout 60s -coverpkg=./... -coverprofile=coverage.raw.txt -covermode atomic ./... && cat coverage.raw.txt | grep -Ev "internal/" > coverage.txt | |
- name: Generate Coverage Badge | |
uses: vladopajic/go-test-coverage@v2 | |
with: | |
profile: coverage.txt | |
local-prefix: github.com/leonhwangprojects/bice | |
threshold-total: 90 | |
badge-file-name: coverage.svg | |
## in this case token should be from other repository that will host badges. | |
## this token is provided via secret `BADGES_GITHUB_TOKEN`. | |
git-token: ${{ github.ref_name == 'main' && secrets.BADGES_GITHUB_TOKEN || '' }} | |
git-branch: badges | |
## repository should match other repository where badges are hosted. | |
## format should be `{owner}/{repository}` | |
git-repository: leonhwangprojects/badges | |
## use custom file name that will have repository name as prefix. | |
## this could be useful if you want to create badges for multiple repositories. | |
git-file-name: .badges/${{ github.repository }}/${{ github.ref_name }}/coverage.svg |