Skip to content

Add aggregate-coverage profile and consolidate CI coverage - #3156

Merged
dbwiddis merged 1 commit into
oshi:masterfrom
dbwiddis:aggregate-coverage
Apr 13, 2026
Merged

dbwiddis merged 1 commit into
oshi:masterfrom
dbwiddis:aggregate-coverage

Conversation

@dbwiddis

@dbwiddis dbwiddis commented Apr 13, 2026 •

Copy link
Copy Markdown
Member

Adds a -Paggregate-coverage Maven profile that runs all module tests (oshi-common, oshi-core, oshi-core-java25, oshi-benchmark) including the JNA vs FFM comparison tests, then produces a cross-module JaCoCo aggregate report -- all in a single mvnw test invocation.

Changes

  • Parent POM: New aggregate-coverage profile placeholder with usage comment
  • oshi-benchmark POM:
    • Added oshi-common and oshi-core as explicit dependencies (needed for report-aggregate class resolution)
    • Added JaCoCo report-aggregate execution bound to test phase
    • Added aggregate-coverage profile that sets maven.test.skip=false
  • CI workflows (pr.yaml, linux.yaml, macos.yaml, windows.yaml):
    • JDK 25 matrix entries now use -Paggregate-coverage instead of plain test
    • Non-JDK 25 entries run plain test as before
    • Coverage upload uses always() so it runs even when comparison tests fail
    • PR workflow job names show (+ JNA==FFM) suffix on JDK 25 for visibility
  • Deleted native-comparison.yaml: Subsumed by the JDK 25 path in each per-OS workflow. The -Pnative-comparison profile remains available for standalone CLI use.

Usage

# Run all tests + comparison + aggregate coverage report
./mvnw test -Paggregate-coverage

# Run only comparison tests (still works, skips other tests)
./mvnw test -pl oshi-benchmark -Pnative-comparison

Summary by CodeRabbit

  • Chores
    • Updated CI/CD workflows to optimize test execution and coverage reporting across Linux, macOS, and Windows platforms.
    • Consolidated build configuration with new Maven profiles to improve coverage aggregation.
    • Removed native comparison workflow to streamline testing pipeline and reduce maintenance overhead.

Add -Paggregate-coverage profile that runs all module tests including
the JNA vs FFM comparison tests and produces a cross-module JaCoCo
aggregate report in a single Maven invocation.

CI workflows now use this profile on JDK 25 matrix entries, replacing
the separate native-comparison.yaml workflow. Coverage uploads use
always() so they run even when comparison tests fail.

PR workflow job names include '(+ JNA==FFM)' suffix on JDK 25 for
visibility into comparison test status.
@coderabbitai

coderabbitai Bot commented Apr 13, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The PR consolidates Java 25 coverage reporting by introducing conditional Maven test execution across CI workflows. When Java 25 is detected, tests run with an aggregate-coverage profile to collect aggregated JaCoCo metrics. The native-comparison.yaml workflow is removed, while aggregate-coverage profiles are added to root and benchmark module POMs.

Changes

Cohort / File(s) Summary
Workflow Java 25 Coverage
.github/workflows/linux.yaml, .github/workflows/macos.yaml, .github/workflows/windows.yaml, .github/workflows/pr.yaml
Maven tests conditionally execute: standard tests for non-25 JDKs, and -Paggregate-coverage tests for Java 25. Codecov uploads now target Java 25 specifically with if: always() and explicitly upload aggregated JaCoCo report from oshi-benchmark/target/site/jacoco-aggregate/jacoco.xml.
Workflow Removal
.github/workflows/native-comparison.yaml
Entire workflow file deleted (34 lines removed). Removed manual dispatch job that performed Native Comparison (JNA vs FFM) testing across multiple OS platforms with Java 25.
Maven Profile & Build Config
pom.xml, oshi-benchmark/pom.xml
Added aggregate-coverage Maven profile to root POM. Extended benchmark module with direct dependencies on oshi-common and oshi-core, configured JaCoCo Maven plugin with aggregate-report execution, and added aggregate-coverage profile enabling tests during profile activation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • rohan-coder02

Poem

🐰 Coverage streams now converge, Java twenty-five takes flight,
Aggregate reports bundled tight, workflows streamlined right!
Native paths fade away, profiles dance and sway,
Benchmarks bloom with test embrace—hop hip hooray! 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add aggregate-coverage profile and consolidate CI coverage' accurately summarizes the main changes: adding a new Maven profile and consolidating CI workflows to use it for coverage reporting.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Apr 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.33%. Comparing base (562ee17) to head (988d242).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3156      +/-   ##
============================================
+ Coverage     54.58%   56.33%   +1.75%     
============================================
  Files           211      212       +1     
  Lines         13476    13485       +9     
  Branches       2193     2193              
============================================
+ Hits           7356     7597     +241     
+ Misses         4991     4736     -255     
- Partials       1129     1152      +23     
Flag Coverage Δ
linux ?
macos ?
macos-latest 30.47% <ø> (?)
ubuntu-latest 18.02% <ø> (?)
windows ?
windows-latest 28.37% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@pom.xml`:
- Around line 1029-1032: The usage note for the Maven profile
"aggregate-coverage" is misleading because the profile only takes effect when
the auto-activated "java25" profile adds "oshi-benchmark"; update the comment to
state that running "./mvnw test -Paggregate-coverage" will produce comparison
tests and an aggregate JaCoCo report only on JDK 25 (when the java25 profile
activates oshi-benchmark), and explicitly mention that on JDK 11/21 those
tests/reports will not run despite using -Paggregate-coverage.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cd1e010a-3969-48de-bb9d-b550642d82ce

📥 Commits

Reviewing files that changed from the base of the PR and between 562ee17 and 988d242.

📒 Files selected for processing (7)
  • .github/workflows/linux.yaml
  • .github/workflows/macos.yaml
  • .github/workflows/native-comparison.yaml
  • .github/workflows/pr.yaml
  • .github/workflows/windows.yaml
  • oshi-benchmark/pom.xml
  • pom.xml
💤 Files with no reviewable changes (1)
  • .github/workflows/native-comparison.yaml
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Test JDK 11, windows-latest
  • GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 21, windows-latest
  • GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 25, ubuntu-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 11, ubuntu-latest
  • GitHub Check: Test JDK 11, macos-latest
  • GitHub Check: Test JDK 21, macos-latest
  • GitHub Check: Test JDK 21, ubuntu-latest
  • GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
  • GitHub Check: Analyze (java)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2026-04-06T04:45:51.516Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3121
File: oshi-core/src/main/java/oshi/software/os/linux/LinuxOperatingSystem.java:53-53
Timestamp: 2026-04-06T04:45:51.516Z
Learning: In the oshi/oshi project, the public API is strictly limited to interfaces and classes in the `oshi`, `oshi.hardware`, and `oshi.software.os` packages. All platform-specific code under subpackages like `oshi.software.os.linux`, `oshi.hardware.platform.linux`, etc., is considered implementation detail — not public API. Do not flag changes to platform-specific classes (e.g., making `LinuxOperatingSystem` abstract, narrowing constructor visibility, adding abstract methods) as public API breaks.

Applied to files:

  • oshi-benchmark/pom.xml
📚 Learning: 2026-03-29T20:01:06.452Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3014
File: oshi-core-java11/src/main/java/module-info.java:10-17
Timestamp: 2026-03-29T20:01:06.452Z
Learning: In the oshi project, `oshi-core-java25/src/main/java/module-info.java` intentionally does NOT export `oshi.util.platform.unix.freebsd`, `oshi.util.platform.unix.openbsd`, or `oshi.util.platform.unix.solaris`, because the FFM (Foreign Function & Memory) implementation only supports Windows, macOS, and Linux. This differs from `oshi-core-java11/src/main/java/module-info.java` which exports all Unix platform packages. The asymmetry is by design.

Applied to files:

  • oshi-benchmark/pom.xml
🔇 Additional comments (1)
oshi-benchmark/pom.xml (1)

147-157: This comment can be removed. Maven continues executing other mojos in the same phase when a test failure occurs—Surefire throws MojoFailureException (not MojoExecutionException) on test failures, which allows the build to proceed to subsequent mojos in the test phase. The aggregate report will be generated even if the comparison tests fail, so the Codecov uploads with always() will have the XML file available.

			> Likely an incorrect or invalid review comment.

Comment thread pom.xml Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant