From 7f59a4bb89cbff14e238345f29a5174057b9872d Mon Sep 17 00:00:00 2001 From: Razieh Behjati Date: Thu, 8 Sep 2022 14:18:10 +0100 Subject: [PATCH] Add coverage report to the CI --- .github/workflows/ci.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2dbc28f7..58cdc0ff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,6 +38,26 @@ jobs: run: | "${GITHUB_WORKSPACE}/bin/bazel" test --test_output=streamed //... + # TODO(#113): Find a better, and easier-to-navigate way to report coverage. + # Generate coverage report for ./pkg/... and ./internal/... and upload the report as an html file. + # See `go help testflag` and `go tool cover -help` for more option. + test-coverage: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: "=1.18.4" + - name: Run go test + run: | + go test -coverpkg=./... -coverprofile coverage.out ./pkg/... ./internal/... + go tool cover -func=coverage.out + go tool cover -html=coverage.out -o coverage.html + - uses: actions/upload-artifact@v3 + with: + name: coverage.html + path: coverage.html + check-license-lines: runs-on: ubuntu-20.04 steps: