1+ name : go-test-coverage (as source)
2+ author : vladopajic
3+ description : go-test-coverage is a tool designed to report issues when test coverage falls below a specified threshold.
4+ branding :
5+ icon : ' code'
6+ color : ' blue'
7+
8+ inputs :
9+ # Config
10+ config :
11+ description : Path to the configuration file (.testcoverage.yml), which defines test coverage settings and thresholds.
12+ required : false
13+ default : " "
14+ type : string
15+ source-dir :
16+ description : Sets relative path to source files.
17+ required : false
18+ default : " "
19+ type : string
20+ debug :
21+ description : Prints additional debugging output when running action.
22+ required : false
23+ default : false
24+ type : boolean
25+
26+ # Individual properties
27+ profile :
28+ description : Path to the coverage profile file. Overrides value from configuration.
29+ required : false
30+ default : " "
31+ type : string
32+ # DEPRECATED
33+ local-prefix :
34+ description : DEPRECATED! not used anymore.
35+ required : false
36+ default : " "
37+ type : string
38+ threshold-file :
39+ description : Minimum coverage percentage required for individual files. Overrides value from configuration.
40+ required : false
41+ default : -1
42+ type : number
43+ threshold-package :
44+ description : Minimum coverage percentage required for each package. Overrides value from configuration.
45+ required : false
46+ default : -1
47+ type : number
48+ threshold-total :
49+ description : Minimum overall project coverage percentage required. Overrides value from configuration.
50+ required : false
51+ default : -1
52+ type : number
53+
54+ breakdown-file-name :
55+ description : File name of go-test-coverage breakdown file, which can be used to analyze coverage difference. Overrides value from configuration.
56+ required : false
57+ default : " "
58+ type : string
59+
60+ diff-base-breakdown-file-name :
61+ description : File name of go-test-coverage breakdown file used to calculate coverage difference from current (head).
62+ required : false
63+ default : " "
64+ type : string
65+
66+ # Badge (as file)
67+ badge-file-name :
68+ description : If specified, a coverage badge will be generated and saved to the given file path.
69+ required : false
70+ default : " "
71+ type : string
72+
73+ # Badge (on CDN)
74+ cdn-secret :
75+ description : API secret key for CDN. If specified, the badge will be uploaded to the CDN.
76+ required : false
77+ default : " "
78+ type : string
79+ cdn-key :
80+ description : API key for CDN access.
81+ required : false
82+ default : " "
83+ type : string
84+ cdn-region :
85+ description : Specifies the CDN region for the badge upload.
86+ required : false
87+ default : " "
88+ type : string
89+ cdn-endpoint :
90+ description : URL endpoint for CDN where the badge will be uploaded.
91+ required : false
92+ default : " "
93+ type : string
94+ cdn-file-name :
95+ description : Filename (including path) for storing the badge on the CDN.
96+ required : false
97+ default : " "
98+ type : string
99+ cdn-bucket-name :
100+ description : Name of the CDN bucket where the badge will be saved.
101+ required : false
102+ default : " "
103+ type : string
104+ cdn-force-path-style :
105+ description : Forces path-style URL access in the CDN.
106+ required : false
107+ default : false
108+ type : boolean
109+
110+ # Badge (on Git)
111+ git-token :
112+ description : GitHub token for authorization. If provided, the badge will be uploaded to the specified GitHub repository.
113+ required : false
114+ default : " "
115+ type : string
116+ git-repository :
117+ description : Target GitHub repository in {owner}/{repository} format where the badge will be stored.
118+ required : false
119+ default : ${{ github.repository }}
120+ type : string
121+ git-branch :
122+ description : Repository branch where the badge file will be saved.
123+ required : false
124+ default : " "
125+ type : string
126+ git-file-name :
127+ description : File name (including path) for storing the badge in the specified repository.
128+ required : false
129+ default : .badges/${{ github.ref_name }}/coverage.svg
130+ type : string
131+
132+ version :
133+ # VERSION: when changing version update version in other places
134+ description : Version of go-test-coverage source to run
135+ required : false
136+ default : v2.14.3
137+ type : string
138+
139+ outputs :
140+ report :
141+ description : JSON-encoded string containing the detailed test coverage report.
142+ value : ${{steps.coverage.outputs.report}}
143+ total-coverage :
144+ description : Integer value in the range [0-100], representing the overall project test coverage percentage.
145+ value : ${{steps.coverage.outputs.total-coverage}}
146+ badge-color :
147+ description : Color hex code for the badge (e.g., `#44cc11`), representing the coverage status.
148+ value : ${{steps.coverage.outputs.badge-color}}
149+ badge-text :
150+ description : Deprecated! Text label for the badge.
151+ value : ${{steps.coverage.outputs.badge-text}}
152+
153+ runs :
154+ using : composite
155+ steps :
156+ - name : check if go is installed
157+ shell : bash
158+ run : |
159+ if command -v go >/dev/null 2>&1; then
160+ echo "Go is installed"
161+ go version
162+ else
163+ echo "Go is NOT installed. Please install Go before running this action."
164+ exit 1
165+ fi
166+
167+ - name : run go-test-coverage
168+ id : coverage
169+ shell : bash
170+ run : |
171+ go run github.com/vladopajic/go-test-coverage/v2@${{ inputs.version }} \
172+ --config=${{ inputs.config || '***' }} \
173+ --profile=${{ inputs.profile || '***' }} \
174+ --source-dir=${{ inputs.source-dir || '***' }} \
175+ --debug=${{ inputs.debug }} \
176+ --github-action-output=true \
177+ --threshold-file=${{ inputs.threshold-file }} \
178+ --threshold-package=${{ inputs.threshold-package }} \
179+ --threshold-total=${{ inputs.threshold-total }} \
180+ --breakdown-file-name=${{ inputs.breakdown-file-name || '***' }} \
181+ --diff-base-breakdown-file-name=${{ inputs.diff-base-breakdown-file-name || '***' }} \
182+ --badge-file-name=${{ inputs.badge-file-name || '***' }} \
183+ --cdn-key=${{ inputs.cdn-key || '***' }} \
184+ --cdn-secret=${{ inputs.cdn-secret || '***' }} \
185+ --cdn-region=${{ inputs.cdn-region || '***' }} \
186+ --cdn-endpoint=${{ inputs.cdn-endpoint || '***' }} \
187+ --cdn-file-name=${{ inputs.cdn-file-name || '***' }} \
188+ --cdn-bucket-name=${{ inputs.cdn-bucket-name || '***' }} \
189+ --cdn-force-path-style=${{ inputs.cdn-force-path-style }} \
190+ --git-token=${{ inputs.git-token || '***' }} \
191+ --git-branch=${{ inputs.git-branch || '***' }} \
192+ --git-repository=${{ inputs.git-repository || '***'}} \
193+ --git-file-name=${{ inputs.git-file-name || '***' }}
0 commit comments