Skip to content

Commit

Permalink
chore: add coverage workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
smlx authored and shreddedbacon committed Oct 24, 2024
1 parent 3a2b5cb commit b085def
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 15 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: coverage
on:
push:
branches:
- main
permissions: {}
jobs:
coverage:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
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@1079cd4e58dda229c04ffdb6324fc3756b8542ff # v2.10.1
with:
profile: cover.out
local-prefix: github.com/${{ github.repository }}
git-token: ${{ secrets.GITHUB_TOKEN }}
# orphan branch for storing badges
git-branch: badges
19 changes: 4 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

/vendor
/.idea
site/

/builds/lagoon-cli-*
/dist
/cover.out
/cover.out.raw
/sbom.spdx.json

0 comments on commit b085def

Please sign in to comment.