Skip to content

Commit cbdb586

Browse files
committed
add test coverage
1 parent 056ae2e commit cbdb586

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

.github/workflows/ci.yaml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ jobs:
2626
- name: Test
2727
run: make test
2828

29+
- name: Archive code coverage results
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: code-coverage
33+
path: coverage.out
34+
2935
config:
3036
name: Check GoReleaser config
3137
runs-on: ubuntu-latest
@@ -36,4 +42,18 @@ jobs:
3642
- name: Check GoReleaser
3743
uses: goreleaser/goreleaser-action@v6
3844
with:
39-
args: check
45+
args: check
46+
47+
code_coverage:
48+
name: "Code coverage report"
49+
if: github.event_name == 'pull_request' # Do not run when workflow is triggered by push to main branch
50+
runs-on: ubuntu-latest
51+
needs: main
52+
permissions:
53+
contents: read
54+
actions: read # to download code coverage results from "test" job
55+
pull-requests: write # write permission needed to comment on PR
56+
steps:
57+
- uses: fgrosse/go-coverage-report@v1.1.1
58+
with:
59+
coverage-file-name: "coverage.out"

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ lint: lint-golangci-lint lint-yamllint
2525
# Test
2626
test:
2727
@echo ">> Running tests for the CLI application"
28-
@go test ./... -count=1
28+
@go test ./... -count=1 -coverprofile=coverage.out
2929

3030
# Test coverage
3131
coverage:

0 commit comments

Comments
 (0)