You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+29Lines changed: 29 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,7 @@
6
6
-[Screenshots](#screenshots)
7
7
-[Examples](#examples)
8
8
-[Basic](#basic)
9
+
-[Coverage](#coverage)
9
10
-[Using existing test files](#using-existing-test-files)
10
11
-[Omitting elements](#omitting-elements)
11
12
@@ -33,6 +34,12 @@ Powered by [Job Summaries](https://github.blog/2022-05-09-supercharging-github-a
33
34
# Optional. Default is './...'
34
35
testArguments:
35
36
37
+
# If true, appends `-cover` to the go test command. Skipped if testArguments
38
+
# already contains a -cover* flag (e.g. -coverprofile=...). Coverage is rendered
39
+
# as a column in the summary table.
40
+
# Optional. Default is 'false'
41
+
cover:
42
+
36
43
# Parse one or more [test2json](https://pkg.go.dev/cmd/test2json) files (newline-separated) and generate a combined summary.
37
44
# Will always exit(0) on successful test file parse.
38
45
# fromJSONFile is accepted as an alias for a single file.
@@ -89,6 +96,28 @@ jobs:
89
96
uses: robherley/go-test-action@v1
90
97
```
91
98
99
+
### Coverage
100
+
101
+
When `go test` is invoked with `-cover` (or `-coverprofile=...`), the action parses the per-package `coverage: X.Y% of statements` lines and appends a 📊 Coverage column to the summary table, plus the mean coverage to the header text.
102
+
103
+
Use the `cover` input as a shortcut to append `-cover`:
104
+
105
+
```yaml
106
+
- name: Test
107
+
uses: robherley/go-test-action@v1
108
+
with:
109
+
cover: true
110
+
```
111
+
112
+
Or pass a coverage flag directly via `testArguments`:
Copy file name to clipboardExpand all lines: action.yml
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,10 @@ inputs:
12
12
description: 'Arguments to `go test`, `-json` will be prepended'
13
13
required: false
14
14
default: './...'
15
+
cover:
16
+
description: 'Append `-cover` to the go test command (skipped if testArguments already contains a -cover* flag). Coverage is rendered as a column in the summary table.'
17
+
required: false
18
+
default: 'false'
15
19
fromJSONFile:
16
20
description: 'Alias for fromJSONFiles with a single file'
0 commit comments