Skip to content

Commit

Permalink
check coverage on pull request only
Browse files Browse the repository at this point in the history
  • Loading branch information
hgiasac committed Feb 3, 2024
1 parent 43a3a89 commit d364fe9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ jobs:
checks: write
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-go@v4
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.20"
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
Expand Down Expand Up @@ -55,11 +55,13 @@ jobs:
- name: Run Go unit tests
run: go test -v -race -timeout 3m -coverprofile=coverage.out ./...
- name: Go coverage format
if: ${{ github.event_name == 'pull_request' }}
run: |
go get github.com/boumenot/gocover-cobertura
go install github.com/boumenot/gocover-cobertura
gocover-cobertura < coverage.out > coverage.xml
- name: Code Coverage Summary Report
if: ${{ github.event_name == 'pull_request' }}
uses: irongut/[email protected]
with:
filename: coverage.xml
Expand All @@ -73,7 +75,7 @@ jobs:
thresholds: "60 80"
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: ${{ github.event_name == 'pull_request_target' }}
if: ${{ github.event_name == 'pull_request' }}
with:
path: code-coverage-results.md
- name: Dump docker logs on failure
Expand Down

0 comments on commit d364fe9

Please sign in to comment.