From 2515e11bd09df71137e39cd854def1d7019b03c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thor=20Anker=20Kvisg=C3=A5rd=20Lange?= Date: Thu, 4 Sep 2025 09:11:07 +0200 Subject: [PATCH 1/2] feat: :art: Adding coverage report to PR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thor Anker Kvisgård Lange --- .github/workflows/go-ci.yaml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/go-ci.yaml b/.github/workflows/go-ci.yaml index 1bfbc53..549149e 100644 --- a/.github/workflows/go-ci.yaml +++ b/.github/workflows/go-ci.yaml @@ -53,6 +53,7 @@ on: jobs: tests: + name: Tests env: GOPRIVATE: "${{ inputs.go-private }}" GH_USERNAME: ${{ secrets.gh_username || 'gh-netic-robot' }} @@ -87,7 +88,13 @@ jobs: install-mode: "goinstall" - name: Go Compile and Test - run: go test -cover -v ./... + run: go test -cover -coverprofile=coverage.txt -v ./... + + - name: Archive code coverage results + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: code-coverage + path: coverage.txt - name: Run benchmarks if: inputs.run-benchmarks @@ -163,3 +170,16 @@ jobs: - name: Clean up private repository access configuration if: always() && steps.setup_git_creds.outcome == 'success' && inputs.go-private != '' run: git config --global --unset url."https://${{ env.GH_USERNAME }}:${{ env.GH_TOKEN }}@github.com".insteadOf + + code-coverage: + name: Code Coverage + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' + needs: tests + permissions: + pull-requests: write + steps: + - uses: fgrosse/go-coverage-report@8c1d1a09864211d258937b1b1a5b849f7e4f2682 # v1 + with: + coverage-artifact-name: code-coverage + coverage-file-name: "coverage.txt" From cdb30792de25e7af142fecdf56ae8f8e25da7554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thor=20Anker=20Kvisg=C3=A5rd=20Lange?= Date: Thu, 4 Sep 2025 09:13:26 +0200 Subject: [PATCH 2/2] feat: :wrench: Specify all required permissions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thor Anker Kvisgård Lange --- .github/workflows/go-ci.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/go-ci.yaml b/.github/workflows/go-ci.yaml index 549149e..caab31d 100644 --- a/.github/workflows/go-ci.yaml +++ b/.github/workflows/go-ci.yaml @@ -177,6 +177,8 @@ jobs: if: github.event_name == 'pull_request' needs: tests permissions: + contents: read + actions: read pull-requests: write steps: - uses: fgrosse/go-coverage-report@8c1d1a09864211d258937b1b1a5b849f7e4f2682 # v1