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: docs/github_action.md
+93-93Lines changed: 93 additions & 93 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,37 +18,41 @@ Action inputs and outputs are documented in [action.yml](/action.yml) file.
18
18
Here’s an example of how to integrate `go-test-coverage` in a GitHub workflow that uses a config file. This is the preferred way because the same config file can be used for running coverage checks locally.
19
19
20
20
```yml
21
-
- name: check test coverage
22
-
uses: vladopajic/go-test-coverage@v2
23
-
with:
24
-
config: ./.testcoverage.yml
21
+
- name: check test coverage
22
+
uses: vladopajic/go-test-coverage@v2
23
+
with:
24
+
config: ./.testcoverage.yml
25
25
```
26
26
27
27
Alternatively, if you don't need advanced configuration options from a config file, you can specify thresholds directly in the action properties.
28
28
29
29
```yml
30
-
- name: check test coverage
31
-
uses: vladopajic/go-test-coverage@v2
32
-
with:
33
-
profile: cover.out
34
-
threshold-file: 80
35
-
threshold-package: 80
36
-
threshold-total: 95
30
+
- name: check test coverage
31
+
uses: vladopajic/go-test-coverage@v2
32
+
with:
33
+
profile: cover.out
34
+
threshold-file: 80
35
+
threshold-package: 80
36
+
threshold-total: 95
37
37
```
38
38
39
39
Note: When using a config file alongside action properties, specifying these parameters will override the corresponding values in the config file.
40
40
41
+
## Generate Coverage Badge
42
+
43
+
Instructions for badge creation are available [here](./badge.md).
44
+
41
45
## Source Directory
42
46
43
47
Some projects, such as monorepos with multiple projects under the root directory, may require specifying the path to a project's source.
44
48
In such cases, the `source-dir` property can be used to specify the source files location relative to the root directory.
45
49
46
50
```yml
47
-
- name: check test coverage
48
-
uses: vladopajic/go-test-coverage@v2
49
-
with:
50
-
config: ./.testcoverage.yml
51
-
source-dir: ./some_project
51
+
- name: check test coverage
52
+
uses: vladopajic/go-test-coverage@v2
53
+
with:
54
+
config: ./.testcoverage.yml
55
+
source-dir: ./some_project
52
56
```
53
57
54
58
## Liberal Coverage Check
@@ -57,13 +61,13 @@ The `go-test-coverage` GitHub Action can be configured to report the current tes
57
61
58
62
Below is an example that reports files with coverage below 80% without causing the workflow to fail:
59
63
```yml
60
-
- name: check test coverage
61
-
id: coverage
62
-
uses: vladopajic/go-test-coverage@v2
63
-
continue-on-error: true
64
-
with:
65
-
profile: cover.out
66
-
threshold-file: 80
64
+
- name: check test coverage
65
+
id: coverage
66
+
uses: vladopajic/go-test-coverage@v2
67
+
continue-on-error: true
68
+
with:
69
+
profile: cover.out
70
+
threshold-file: 80
67
71
```
68
72
69
73
## Report Coverage Difference
@@ -74,37 +78,37 @@ The same logic is used in workflow in [this repo](/.github/workflows/test.yml).
74
78
Example of report that includes coverage difference is [this PR](https://github.com/vladopajic/go-test-coverage/pull/129).
0 commit comments