Skip to content

Commit 64045d2

Browse files
committed
docs improvements
1 parent 4c0c73d commit 64045d2

File tree

4 files changed

+60
-45
lines changed

4 files changed

+60
-45
lines changed

.testcoverage.example.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# (mandatory)
2-
# Path to coverprofile file (output of `go test -coverprofile` command).
2+
# Path to coverage profile file (output of `go test -coverprofile` command).
33
#
44
# For cases where there are many coverage profiles, such as when running
55
# unit tests and integration tests separately, you can combine all those
@@ -8,21 +8,21 @@
88
profile: cover.out
99

1010
# (optional; but recommended to set)
11-
# When specified reported file paths will not contain local prefix in the output
11+
# When specified reported file paths will not contain local prefix in the output.
1212
local-prefix: "github.com/org/project"
1313

14-
# Holds coverage thresholds percentages, values should be in range [0-100]
14+
# Holds coverage thresholds percentages, values should be in range [0-100].
1515
threshold:
1616
# (optional; default 0)
17-
# The minimum coverage that each file should have
17+
# Minimum coverage percentage required for individual files.
1818
file: 70
1919

2020
# (optional; default 0)
21-
# The minimum coverage that each package should have
21+
# Minimum coverage percentage required for each package.
2222
package: 80
2323

2424
# (optional; default 0)
25-
# The minimum total coverage project should have
25+
# Minimum overall project coverage percentage required.
2626
total: 95
2727

2828
# Holds regexp rules which will override thresholds for matched files or packages
@@ -33,12 +33,12 @@ threshold:
3333
# override rules should be listed in order from specific to more general rules.
3434
override:
3535
# Increase coverage threshold to 100% for `foo` package
36-
# (default is 80, as configured above in this example)
36+
# (default is 80, as configured above in this example).
3737
- threshold: 100
3838
path: ^pkg/lib/foo$
3939

4040
# Holds regexp rules which will exclude matched files or packages
41-
# from coverage statistics
41+
# from coverage statistics.
4242
exclude:
4343
# Exclude files or packages matching their paths
4444
paths:
@@ -47,4 +47,4 @@ exclude:
4747

4848
# NOTES:
4949
# - symbol `/` in all path regexps will be replaced by current OS file path separator
50-
# to properly work on Windows
50+
# to properly work on Windows.

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Here’s an example [.testcoverage.yml](./.testcoverage.example.yml) configurati
8080

8181
```yml
8282
# (mandatory)
83-
# Path to coverprofile file (output of `go test -coverprofile` command).
83+
# Path to coverage profile file (output of `go test -coverprofile` command).
8484
#
8585
# For cases where there are many coverage profiles, such as when running
8686
# unit tests and integration tests separately, you can combine all those
@@ -89,21 +89,21 @@ Here’s an example [.testcoverage.yml](./.testcoverage.example.yml) configurati
8989
profile: cover.out
9090

9191
# (optional; but recommended to set)
92-
# When specified reported file paths will not contain local prefix in the output
92+
# When specified reported file paths will not contain local prefix in the output.
9393
local-prefix: "github.com/org/project"
9494

95-
# Holds coverage thresholds percentages, values should be in range [0-100]
95+
# Holds coverage thresholds percentages, values should be in range [0-100].
9696
threshold:
9797
# (optional; default 0)
98-
# The minimum coverage that each file should have
98+
# Minimum coverage percentage required for individual files.
9999
file: 70
100100

101101
# (optional; default 0)
102-
# The minimum coverage that each package should have
102+
# Minimum coverage percentage required for each package.
103103
package: 80
104104

105105
# (optional; default 0)
106-
# The minimum total coverage project should have
106+
# Minimum overall project coverage percentage required.
107107
total: 95
108108

109109
# Holds regexp rules which will override thresholds for matched files or packages
@@ -114,12 +114,12 @@ threshold:
114114
# override rules should be listed in order from specific to more general rules.
115115
override:
116116
# Increase coverage threshold to 100% for `foo` package
117-
# (default is 80, as configured above in this example)
117+
# (default is 80, as configured above in this example).
118118
- threshold: 100
119119
path: ^pkg/lib/foo$
120120

121121
# Holds regexp rules which will exclude matched files or packages
122-
# from coverage statistics
122+
# from coverage statistics.
123123
exclude:
124124
# Exclude files or packages matching their paths
125125
paths:
@@ -128,7 +128,7 @@ exclude:
128128

129129
# NOTES:
130130
# - symbol `/` in all path regexps will be replaced by current OS file path separator
131-
# to properly work on Windows
131+
# to properly work on Windows.
132132
```
133133

134134
### Exclude Code from Coverage

action.yml

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,117 @@
11
name: go-test-coverage
22
author: vladopajic
3-
description: go-test-coverage is tool which reports issues when test coverage is below set threshold.
3+
description: go-test-coverage is a tool designed to report issues when test coverage falls below a specified threshold, ensuring higher code quality and preventing regressions in test coverage over time.
44
inputs:
5+
# Config
56
config:
6-
description: Path of configuration file.
7+
description: Path to the configuration file (.testcoverage.yml), which defines test coverage settings and thresholds.
78
required: false
89
default: ""
910
type: string
11+
12+
# Individual properties
1013
profile:
11-
description: Path of coverage profile file.
14+
description: Path to the coverage profile file. Overrides value from configuration.
1215
required: false
1316
default: ""
1417
type: string
1518
local-prefix:
16-
description: When specified reported file paths will not contain local prefix in the output.
19+
description: When specified reported file paths will not contain local prefix in the output. Overrides value from configuration.
1720
required: false
1821
default: ""
1922
type: string
2023
threshold-file:
21-
description: The minimum coverage that each file should have.
24+
description: Minimum coverage percentage required for individual files. Overrides value from configuration.
2225
required: false
2326
default: -1
2427
type: number
2528
threshold-package:
26-
description: The minimum coverage that each package should have.
29+
description: Minimum coverage percentage required for each package. Overrides value from configuration.
2730
required: false
2831
default: -1
2932
type: number
3033
threshold-total:
31-
description: The minimum total coverage project should have.
34+
description: Minimum overall project coverage percentage required. Overrides value from configuration.
3235
required: false
3336
default: -1
3437
type: number
38+
39+
# Badge (as file)
3540
badge-file-name:
36-
description: When specified coverage badge will be created and saved to this file.
41+
description: If specified, a coverage badge will be generated and saved to the given file path.
3742
required: false
3843
default: ""
3944
type: string
45+
46+
# Badge (on CDN)
4047
cdn-secret:
41-
description: CDN API secret. When specified action will create and upload badge to CDN.
48+
description: API secret key for CDN. If specified, the badge will be uploaded to the CDN.
4249
required: false
4350
default: ""
4451
type: string
4552
cdn-key:
46-
description: CDN API key.
53+
description: API key for CDN access.
4754
required: false
4855
default: ""
4956
type: string
5057
cdn-region:
51-
description: CDN region.
58+
description: Specifies the CDN region for the badge upload.
5259
required: false
5360
default: ""
5461
type: string
5562
cdn-endpoint:
56-
description: CDN endpoint.
63+
description: URL endpoint for CDN where the badge will be uploaded.
5764
required: false
5865
default: ""
5966
type: string
6067
cdn-file-name:
61-
description: File name (including path) of badge on CDN.
68+
description: Filename (including path) for storing the badge on the CDN.
6269
required: false
6370
default: ""
6471
type: string
6572
cdn-bucket-name:
66-
description: CDN bucket name.
73+
description: Name of the CDN bucket where the badge will be saved.
6774
required: false
6875
default: ""
6976
type: string
7077
cdn-force-path-style:
71-
description: CDN force path style.
78+
description: Forces path-style URL access in the CDN.
7279
required: false
7380
default: false
7481
type: boolean
82+
83+
# Badge (on Git)
7584
git-token:
76-
description: GitHub token. When specified action will create and upload badge to GitHub repository.
85+
description: GitHub token for authorization. If provided, the badge will be uploaded to the specified GitHub repository.
7786
required: false
7887
default: ""
7988
type: string
8089
git-repository:
81-
description: GitHub repository in format {owner}/{repository} where badge is stored.
90+
description: Target GitHub repository in {owner}/{repository} format where the badge will be stored.
8291
required: false
8392
default: ${{ github.repository }}
8493
type: string
8594
git-branch:
86-
description: Branch where badge is stored.
95+
description: Repository branch where the badge file will be saved.
8796
required: false
8897
default: ""
8998
type: string
9099
git-file-name:
91-
description: File name (including path) of badge stored to specified repository.
100+
description: File name (including path) for storing the badge in the specified repository.
92101
required: false
93102
default: .badges/${{ github.ref_name }}/coverage.svg
94103
type: string
104+
95105
outputs:
96106
total-coverage:
97-
description: Holds total coverage value.
98-
badge-text:
99-
description: Deprecated! Holds badge text value.
107+
description: Integer value in the range [0-100], representing the overall project test coverage percentage.
100108
badge-color:
101-
description: Deprecated! Holds badge color value.
109+
description: Color hex code for the badge (e.g., `#44cc11`), representing the coverage status.
110+
report:
111+
description: JSON-encoded string containing the detailed test coverage report.
112+
badge-text:
113+
description: Deprecated! Text label for the badge.
114+
102115
runs:
103116
using: docker
104117
image: docker://ghcr.io/vladopajic/go-test-coverage:v2.10.4
@@ -122,6 +135,7 @@ runs:
122135
- --git-branch=${{ inputs.git-branch || '''''' }}
123136
- --git-repository=${{ inputs.git-repository || ''''''}}
124137
- --git-file-name=${{ inputs.git-file-name || '''''' }}
138+
125139
branding:
126140
icon: 'code'
127141
color: 'blue'

docs/github_action.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ The GitHub Action will set the following outputs, which can be used later in you
3333
3434
| Name | Description |
3535
|-----------------|------------------------------|
36-
|`total-coverage` | Integer value in the range [0-100], representing the total coverage percentage. |
37-
|`badge-color` | String value holding the color hex code for the badge (e.g., `#44cc11`). |
38-
|`badge-text` | The total-coverage value concatenated with a % (e.g., `100%`). |
39-
|`report` | JSON-encoded string representing the coverage report from `go-test-coverage`. |
36+
|`total-coverage` | Integer value in the range [0-100], representing the overall project test coverage percentage. |
37+
|`badge-color` | Color hex code for the badge (e.g., `#44cc11`), representing the coverage status. |
38+
|`badge-text` | Deprecated! Text label for the badge. |
39+
|`report` | JSON-encoded string containing the detailed test coverage report. |
4040

41+
Note: Action outputs and inputs are also documented in [action.yml](/action.yml) file.
4142

4243
# Post Coverage Report to PR
4344

0 commit comments

Comments
 (0)