[
https://issues.apache.org/jira/browse/HDDS-17463?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18145097#comment-18145097
]
JyunSheng Kao commented on HDDS-17463:
--------------------------------------
Hi [~adoroszlai] ,
I have started on this, following the pattern of
{{dev-support/ci/junit_summary.py}} from HDDS-14072.
h3. 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{}}}.
Note: the relocated Hadoop packages {{org.apache.hadoop.ipc_*}} top the package
list. They are not Ozone source and could be excluded in {{coverage.sh}} in a
follow-up, out of scope here.
h3. Markdown coverage summary content
* Overall coverage table
** 2-row table for lines and branches (coverage, missed, total)
** one line count of untested methods and classes
* Download link to artifact (full report contains html and all.xml report)
* Collapsed {{<details>}} block with per-package table
** sorted by missed lines + missed branches, so the biggest gap come first
h3. Sample generated markdown
{noformat}
## Coverage Summary
**Overall coverage: 81.8%** (lines and branches combined, same formula as
SonarCloud)
|Counter|Coverage|Missed|Total|
|---|---|---|---|
|Lines|84.5%|27237|175849|
|Branches|73.2%|14855|55354|
Untested: 4366 methods, 211 classes
📦 Full HTML report: [download artifact](https://example.com/artifact)
<details><summary><b>Coverage by package (316)</b></summary>
|Package|Coverage|Lines|Missed lines|Branches|Missed branches|
|---|---|---|---|---|---|
|org.apache.hadoop.ipc_.protobuf|35.5%|38.9%|2149|27.9%|1135|
|org.apache.hadoop.ozone.om|85.8%|88.0%|1357|78.3%|725|
|org.apache.hadoop.ipc_|65.8%|69.5%|1135|55.7%|612|
...
</details>
{noformat}
h3. Â
Â
||Â ||Screenshot||
|h3. Summary|h3. !image-2026-11-15-16-46-16-777.png|width=472,height=283!|
|h3. Extend package-level|h3. !Screenshot 2026-11-15 at
16.43.09.png|width=447,height=261!|
Â
Â
h3. 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]
** I don't think providing these two values summary reports will give any more
relevant insights. I prefer keeping things simple.
* 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
Happy to adjust any of the above. I will open the PR shortly. Since this is my
first issue I cannot assign it to myself; could you assign it to me when you
get a chance?
CC [~chihsuan] [~peterxcli]
h3. 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]
> Publish coverage summary
> ------------------------
>
> Key: HDDS-17463
> URL: https://issues.apache.org/jira/browse/HDDS-17463
> Project: Apache Ozone
> Issue Type: Sub-task
> Components: CI
> Reporter: Attila Doroszlai
> Priority: Major
> Labels: GoodForNewContributors
> Attachments: Screenshot 2026-11-15 at 16.42.48.png, Screenshot
> 2026-11-15 at 16.43.09.png, image-2026-11-15-16-46-07-382.png,
> image-2026-11-15-16-46-16-777.png
>
>
> 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.
> References:
> - [coverage
> check|https://github.com/apache/ozone/blob/d406a7feccc4dcf254348d1c4e8aa0391de7b139/.github/workflows/ci.yml#L439]
> - [Adding a job
> summary|https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-commands#adding-a-job-summary]
> - [junit summary
> script|https://github.com/apache/ozone/blob/master/dev-support/ci/junit_summary.py]
> CC [~chihsuan] [~peterxcli]
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]