ci: add unit test coverage to Sonar analysis#24622
Draft
Artur- wants to merge 2 commits into
Draft
Conversation
Run the Sonar job after the unit test matrix instead of in its own workflow, restoring the saved-workspace artifact like the test jobs do instead of compiling the whole project again. Running in this position also allows the analysis to consume output from the unit test jobs, such as coverage data. The saved-workspace cleanup moves from test-results to a job that also waits for the Sonar analysis; deleting it in test-results could race with the Sonar job downloading it when the IT matrix finishes before the unit tests. flow-gradle-plugin is excluded from the analysis because the build job does not compile it, so the workspace contains no classes for it.
Run the unit tests with a JaCoCo agent (new coverage profile) and feed the per-module XML reports to Sonar via sonar.coverage.jacoco.xmlReportPaths. The test jobs upload the reports as artifacts and the Sonar job extracts them into the restored workspace, so the tests run only once. Reports are renamed with the matrix index since split modules (see moduleSplits in computeMatrix.js) produce partial reports for the same module in several jobs; Sonar merges the partials. Also define an empty default for surefire.argLine: the unresolved expression is passed literally to the forked JVM on Maven 3.9+, which makes the fork fail to start.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Run the unit tests with a JaCoCo agent (new coverage profile) and feed the per-module XML reports to Sonar via
sonar.coverage.jacoco.xmlReportPaths. The test jobs upload the reports as artifacts and the Sonar job extracts them into the restored workspace, so the tests run only once. Reports are renamed with the matrix index since split modules (see moduleSplits in computeMatrix.js) produce partial reports for the same module in several jobs; Sonar merges the partials.