diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 239a463dc..dac68831d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -26,6 +26,12 @@ jobs: - name: Test run: make test + - name: Archive code coverage results + uses: actions/upload-artifact@v4 + with: + name: code-coverage + path: coverage.out + config: name: Check GoReleaser config runs-on: ubuntu-latest @@ -36,4 +42,18 @@ jobs: - name: Check GoReleaser uses: goreleaser/goreleaser-action@v6 with: - args: check \ No newline at end of file + args: check + + code_coverage: + name: "Code coverage report" + if: github.event_name == 'pull_request' # Do not run when workflow is triggered by push to main branch + runs-on: ubuntu-latest + needs: main + permissions: + contents: read + actions: read # to download code coverage results from "test" job + pull-requests: write # write permission needed to comment on PR + steps: + - uses: fgrosse/go-coverage-report@v1.1.1 + with: + coverage-file-name: "coverage.out" \ No newline at end of file diff --git a/Makefile b/Makefile index 171d9864d..a3b64bb3d 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ lint: lint-golangci-lint lint-yamllint # Test test: @echo ">> Running tests for the CLI application" - @go test ./... -count=1 + @go test ./... -count=1 -coverprofile=coverage.out # Test coverage coverage: