diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index c87ddc302..f6aac9c79 100644 --- a/.github/workflows/test-unit.yml +++ b/.github/workflows/test-unit.yml @@ -37,3 +37,35 @@ jobs: - name: Test run: make test-unit + + - name: Coverage summary + run: | + { + echo "## Coverage" + echo "" + echo '```' + go tool cover -func=coverage.out | tail -n 1 + echo '```' + } >> "$GITHUB_STEP_SUMMARY" + + - name: Upload coverage profile + uses: actions/upload-artifact@v4 + with: + name: coverage + path: coverage.out + + code-coverage-report: + name: code-coverage-report + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + needs: test-unit + permissions: + contents: read + actions: read + pull-requests: write + steps: + - name: Post coverage report on the PR + uses: fgrosse/go-coverage-report@v1.3.0 + with: + coverage-artifact-name: coverage + coverage-file-name: coverage.out