Commit 251ad63
authored
feat(build): enhance JaCoCo reporting with coverage summary and enforce thresholds (#5352)
# Description of Changes
### What was changed
- Refactored Gradle task configuration to use `tasks.named` and
`configureEach` for better lazy configuration and compatibility.
- Centralized JaCoCo report handling by introducing a single
`jacocoReport` task reference.
- Added a post-processing step to the JaCoCo XML report to:
- Parse coverage metrics (LINE, INSTRUCTION, BRANCH).
- Calculate coverage ratios.
- Print a formatted coverage summary table directly to the build logs.
- Enabled and aligned `jacocoTestCoverageVerification` rules with
defined minimum coverage thresholds.
- Ensured the `build` task depends on the JaCoCo report to always
generate coverage output.
### Why the change was made
- To improve visibility of test coverage results directly in CI and
local builds without manually opening the HTML report.
- To enforce consistent and explicit coverage thresholds for key
metrics.
- To modernize Gradle task configuration and avoid eager task
realization.
---
> Task :proprietary:jacocoTestReport
==== JaCoCo Coverage Summary ====
Metric | Coverage | Covered/Total | Status | Target
------------|----------|---------------|--------|----------
LINE | 9.01% | 759/8426 | FAIL | >= 16.00%
INSTRUCTION | 8.41% | 2741/32590 | FAIL | >= 14.00%
BRANCH | 6.04% | 248/4103 | FAIL | >= 9.00%
---
> Task :common:jacocoTestReport
==== JaCoCo Coverage Summary ====
| Metric | Coverage | Covered/Total | Status | Target
|------------|----------|---------------|--------|----------
LINE | 39.47% | 2996/7591 | PASS | >= 16.00%
INSTRUCTION | 41.05% | 12868/31345 | PASS | >= 14.00%
BRANCH | 33.43% | 1166/3488 | PASS | >= 9.00%
---
> Task :stirling-pdf:jacocoTestReport
==== JaCoCo Coverage Summary ====
Metric | Coverage | Covered/Total | Status | Target
------------|----------|---------------|--------|----------
LINE | 13.63% | 2554/18741 | FAIL | >= 16.00%
INSTRUCTION | 14.59% | 11459/78532 | PASS | >= 14.00%
BRANCH | 10.68% | 868/8124 | PASS | >= 9.00%
---
## Checklist
### General
- [ ] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [ ] I have read the [Stirling-PDF Developer
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md)
(if applicable)
- [ ] I have read the [How to add new languages to
Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md)
(if applicable)
- [ ] I have performed a self-review of my own code
- [ ] My changes generate no new warnings
### Documentation
- [ ] I have updated relevant docs on [Stirling-PDF's doc
repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/)
(if functionality has heavily changed)
- [ ] I have read the section [Add New Translation
Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)
### Translations (if applicable)
- [ ] I ran
[`scripts/counter_translation.py`](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/docs/counter_translation.md)
### UI Changes (if applicable)
- [ ] Screenshots or videos demonstrating the UI changes are attached
(e.g., as comments or direct attachments in the PR)
### Testing (if applicable)
- [ ] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md#6-testing)
for more details.1 parent c7b713a commit 251ad63
2 files changed
Lines changed: 134 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| 100 | + | |
100 | 101 | | |
101 | 102 | | |
102 | 103 | | |
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
107 | 119 | | |
108 | 120 | | |
109 | 121 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
183 | 185 | | |
184 | 186 | | |
185 | 187 | | |
186 | | - | |
187 | | - | |
| 188 | + | |
| 189 | + | |
188 | 190 | | |
189 | 191 | | |
190 | | - | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
191 | 195 | | |
192 | | - | |
| 196 | + | |
193 | 197 | | |
194 | 198 | | |
195 | | - | |
196 | | - | |
| 199 | + | |
| 200 | + | |
197 | 201 | | |
198 | 202 | | |
199 | 203 | | |
200 | 204 | | |
201 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
202 | 299 | | |
203 | 300 | | |
204 | 301 | | |
205 | | - | |
| 302 | + | |
206 | 303 | | |
207 | 304 | | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
208 | 320 | | |
209 | | - | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
210 | 324 | | |
211 | 325 | | |
212 | 326 | | |
| |||
0 commit comments