Merge pull request #99 from uselagoon/default-codeql #59
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@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 | |
- 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 generated code from coverage calculation | |
grep -Ev 'internal/mock|_enumer.go' cover.out.raw > cover.out | |
- name: Generage coverage badge | |
uses: vladopajic/go-test-coverage@97ecc524075d8ece0e1a406edec1c191e2dd3277 # v2.8.3 | |
with: | |
profile: cover.out | |
local-prefix: github.com/smlx/go-cli-github | |
git-token: ${{ secrets.GITHUB_TOKEN }} | |
# orphan branch for storing badges | |
git-branch: badges |