From f59002d82054f7bd30209927e74217755a413390 Mon Sep 17 00:00:00 2001 From: Rajil Bajracharya Date: Fri, 1 Sep 2023 16:18:32 +0545 Subject: [PATCH] ci: get coverage badge --- .github/workflows/go.yml | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index f1fe0bc..f5e2755 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -29,20 +29,12 @@ jobs: - name: Test run: go test -v -cover ./... - - name: Export Test Results - run: go test -json > TestResults.json - - - name: Upload Go test results - uses: actions/upload-artifact@v3 - with: - name: Test-results - path: TestResults.json - - name: Get Coverage Report - uses: ncruces/go-coverage-report@v0 + run: | + go test -v ./... -covermode=count -coverprofile=coverage.out + go tool cover -func=coverage.out -o=coverage.out + + - name: Go Coverage Badge # Pass the `coverage.out` output to this action + uses: tj-actions/coverage-badge-go@v2 with: - report: 'true' - chart: 'true' - amend: 'false' - if: github.event_name == 'push' - continue-on-error: true + filename: coverage.out