Merge pull request #37 from smlx/dashboard #5
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: coverage | |
on: | |
push: | |
branches: | |
- main | |
permissions: {} | |
jobs: | |
coverage: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version: stable | |
- name: Calculate coverage | |
run: | | |
go test -v -covermode=atomic -coverprofile=cover.out.raw -coverpkg=./... ./... | |
# remove mocks from coverage calculation | |
grep -Ev 'mock_|_enumer.go' cover.out.raw > cover.out | |
- name: Generage coverage badge | |
uses: vladopajic/go-test-coverage@bcd064e5ceef1ccec5441519eb054263b6a44787 # v2.8.2 | |
with: | |
profile: cover.out | |
local-prefix: github.com/smlx/goodwe-exporters | |
git-token: ${{ secrets.GITHUB_TOKEN }} | |
# orphan branch for storing badges | |
git-branch: badges |