kjs1095 opened a new pull request, #12054:
URL: https://github.com/apache/ozone/pull/12054

   ## What changes were proposed in this pull request?
   
   ### From JIRA description
   Coverage check (runs for push builds) publishes report and posts to Sonar 
(only in Apache). It could also post a GitHub Actions summary to make it easier 
to quickly understand coverage of a commit without downloading the bundle.
   
   ### Scope
   - New script parses the JaCoCo XML report produced by `coverage.sh` and 
prints a Markdown summary
   - The coverage job in `ci.yml` gets a new step after the archive step that 
appends the output to `$GITHUB_STEP_SUMMARY`
   - Unit tests in `test_coverage_summary.py`, run through a bats wrapper like 
`junit_summary.bats`.
   
   ###  Markdown coverage summary content
   (Refer screenshots in section `How was this patch tested?`)
   - Overall coverage table
     - two-row table for lines and branches (coverage, missed, total)
     - one line count of untested methods and classes
   - Download link to artifact
   - Collapsed `<details>` block with per-package table
     - sorted by missed lines + missed branches, so the biggest gap come first
   
   ### Design decisions
   
   - Combined coverage using SonarCloud's formula : `(covered lines + covered 
branches) / (lines + branches)` [1]
     - This is a very common standard, and the numbers are easy to understand.
   - Ignore the INSTRUCTION and COMPLEXITY JaCoCo counters
     - These two numbers are similar to LINE and BRANCH. [2] These two metrics 
will not give any more helpful insights.
   - Output the package level coverage table
      - Master has 316 packages (2026/11) and the size of the resulting 
package-level table is ~21KB, well inside the 1MB summary limit. [3]
      - Why just package-level?
        - Class-level metrics provide too much information. I believe 
package-level already give us big hint about which module worth to enhance 
coverage.
      - Why sorted by missed lines + missed branches?
        - Sorting by percentage would put tiny packages (a few constants) at 
the top
   
   ### Reference
   [1] 
https://docs.sonarsource.com/sonarqube-cloud/managing-your-projects/metric-definitions
   [2] https://www.jacoco.org/jacoco/trunk/doc/counters.html
   [3] 
https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-commands#step-isolation-and-limits
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-17463
   
   ## How was this patch tested?
   
   Local ran:
   
   ```bash
   [ozone] $ cd dev-support/ci && python3 -m unittest test_coverage_summary -v
   
   test_invalid_report (test_coverage_summary.TestMain) ... ok
   test_missing_report (test_coverage_summary.TestMain) ... ok
   test_prints_summary (test_coverage_summary.TestMain) ... ok
   test_combined_uses_sonar_formula (test_coverage_summary.TestParseReport) ... 
ok
   test_overall_counters (test_coverage_summary.TestParseReport) ... ok
   test_packages_counters (test_coverage_summary.TestParseReport) ... ok
   test_percent (test_coverage_summary.TestPercent) ... ok
   test_no_packages (test_coverage_summary.TestRenderSummary) ... ok
   test_overall_section (test_coverage_summary.TestRenderSummary) ... ok
   test_package_table_sorted_by_missed 
(test_coverage_summary.TestRenderSummary) ... ok
   test_report_url (test_coverage_summary.TestRenderSummary) ... ok
   
   ----------------------------------------------------------------------
   Ran 11 tests in 0.009s
   
   OK
   ```
   
   Fork CI ran [CI Run 
Link](https://github.com/kjs1095/ozone/actions/runs/43688892836)
   - all checks passed
   - rat.sh check passed
   
   Screenshot
   | Item | Screenshot |
   | --- | --- |
   | Coverage Summary | <img width="726" height="435" alt="Screenshot 
2026-11-15 at 16 42 48" 
src="https://github.com/user-attachments/assets/e51ae27b-30c2-46bf-957a-973df88bfca4";
 />| 
   | Expand Package-level | <img width="1082" height="633" alt="Screenshot 
2026-11-15 at 16 43 09" 
src="https://github.com/user-attachments/assets/fae36f0d-d36b-476b-8649-bddc1c9da54d";
 />
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to