Skip to content

CAMEL-23274: Add incremental coverage to SonarCloud PR analysis#22469

Open
gnodet wants to merge 1 commit intoapache:mainfrom
gnodet:sonar-coverage-incremental
Open

CAMEL-23274: Add incremental coverage to SonarCloud PR analysis#22469
gnodet wants to merge 1 commit intoapache:mainfrom
gnodet:sonar-coverage-incremental

Conversation

@gnodet
Copy link
Copy Markdown
Contributor

@gnodet gnodet commented Apr 7, 2026

CAMEL-23274

Summary

Replaces the hardcoded core-only coverage step with dynamic, incremental coverage for all PR-affected modules.

  • Remove the hardcoded core test step from sonar-build.yml (no more stale module list to maintain)
  • Add jacoco:report goal to the coverage profile in parent/pom.xml so each tested module generates its own XML report
  • Update sonar.coverage.jacoco.xmlReportPaths to include both per-module and aggregated report paths
  • Add dynamic coverage aggregation in incremental-build.sh: when core modules are detected among affected modules and -Dcoverage is active, automatically generate the aggregated report via the coverage module

Coverage strategy

Scope Approach Report path
Core modules (when affected) Aggregated report via coverage -am (camel-core tests exercise classes across camel-core-model, camel-core-processor, etc.) coverage/target/site/jacoco-aggregate/jacoco.xml
Components (when affected) Per-module reports (each component's tests cover its own classes) */target/site/jacoco/jacoco.xml

Key improvements over previous approach:

  • No hardcoded module list — core coverage aggregation triggers dynamically when any core/ module is in the PR diff
  • No wasted CI time — core tests only run when core modules are actually affected
  • Single test step — the incremental-build action handles everything

Test plan

  • Verified on gnodet/camel#15 — SonarBuild passed, coverage aggregation triggered correctly when core module was affected
  • Verify SonarCloud picks up both aggregated and per-module coverage data

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using build-all, build-dependents, skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@gnodet gnodet marked this pull request as draft April 7, 2026 08:45
@gnodet gnodet force-pushed the sonar-coverage-incremental branch from 85272ce to 851f479 Compare April 7, 2026 11:36
@gnodet gnodet force-pushed the ci-merge-incremental-build-detect-dependencies branch from b0ac394 to 93a50e0 Compare April 8, 2026 07:04
@gnodet gnodet force-pushed the sonar-coverage-incremental branch from 851f479 to 2004324 Compare April 8, 2026 07:20
@gnodet gnodet changed the base branch from ci-merge-incremental-build-detect-dependencies to main April 8, 2026 07:21
@gnodet gnodet force-pushed the sonar-coverage-incremental branch from 2004324 to b1d517e Compare April 8, 2026 07:23
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

ℹ️ CI did not run targeted module tests (root project files changed).


⚙️ View full build and test results

@gnodet gnodet force-pushed the sonar-coverage-incremental branch from b1d517e to 2fe8dba Compare April 8, 2026 08:07
Build on top of the core coverage baseline by adding per-module
coverage for PR-affected components using the incremental-build action.

Changes:
- parent/pom.xml: Add jacoco:report goal to coverage profile so each
  tested module generates its own XML report
- pom.xml: Update sonar.coverage.jacoco.xmlReportPaths to include
  both per-module and aggregated report paths
- sonar-build.yml: Add incremental-build step with -Dcoverage in
  MVND_OPTS to test PR-affected modules with JaCoCo

Coverage strategy:
- Core: aggregated report via coverage module (camel-core tests
  exercise classes across multiple core source modules)
- Components: per-module reports (each component's tests cover
  its own classes)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet gnodet force-pushed the sonar-coverage-incremental branch from 2fe8dba to 2dbee5f Compare April 9, 2026 08:49
@gnodet gnodet marked this pull request as ready for review April 9, 2026 13:17
@gnodet gnodet requested a review from apupier April 9, 2026 13:17
@gnodet gnodet requested a review from cunningt April 9, 2026 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant