feat: enhance CI workflows with Sonar analysis and coverage merging s…#1263
Open
essiembre wants to merge 13 commits into
Open
feat: enhance CI workflows with Sonar analysis and coverage merging s…#1263essiembre wants to merge 13 commits into
essiembre wants to merge 13 commits into
Conversation
…teps Signed-off-by: Pascal Essiembre <pascal.essiembre@norconex.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR moves Sonar analysis orchestration out of the Maven lifecycle and into GitHub Actions, adding a parallel, multi-module Sonar runner and introducing coverage exec artifact exchange between nightly IT runs and CI builds to stabilize Sonar coverage reporting.
Changes:
- Removed the root-POM
verify-phase Groovy execution previously used to run Sonar. - Reworked
assembly/sonar/run-sonar-analysis.groovyinto a parallel multi-module uploader with optional “gate changed/all/none” behavior and downstream gating logic. - Updated CI and nightly workflows to run Sonar via the new orchestrator and to upload/download JaCoCo exec artifacts for coverage merging.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
pom.xml |
Removes the previous verify-phase Sonar Groovy execution, shifting responsibility to CI workflows. |
assembly/sonar/run-sonar-analysis.groovy |
Implements parallel Sonar uploads, conditional quality-gate waiting, and consolidated failure reporting. |
.github/workflows/nightly-tests.yaml |
Adds Sonar token env, Sonar cache, uploads JaCoCo exec artifacts, and runs the new Sonar orchestrator nightly. |
.github/workflows/maven-ci-cd.yaml |
Splits build/test from Sonar, adds PR/main/release Sonar steps, and merges nightly coverage into CI reports on main pushes. |
Comment on lines
+188
to
+192
| def ceStatus = (readJson(ceTaskUrl).task ?: [:]).status ?: "UNKNOWN" | ||
|
|
||
| def projectStatusUrl = serverUrl + "/api/qualitygates/project_status?analysisId=" + | ||
| URLEncoder.encode(analysisId, StandardCharsets.UTF_8) | ||
| def qualityGateResponse = readJson(projectStatusUrl) | ||
| def projectStatus = qualityGateResponse.projectStatus ?: [:] | ||
| if (ceStatus == "SUCCESS") { | ||
| def analysisId = readJson(ceTaskUrl).task?.analysisId | ||
| def gateResp = readJson( |
Comment on lines
+289
to
293
| // Non-gated upload failures are warnings only — don't block CI. | ||
| uploadErrors.findAll { dir, _ -> !gatedDirs.contains(dir) }.each { dir, err -> | ||
| println "[Sonar] WARNING — async upload failed for ${dir}: ${err.message}" | ||
| } | ||
|
|
Contributor
There was a problem hiding this comment.
Updated in bf1f35d. The warning-only path is now restricted to sonar.gate.mode=changed when there are gated modules; when no modules are gated, upload failures remain blocking so the step cannot go false-green.
Comment on lines
+216
to
+223
| - name: Download latest nightly IT exec coverage | ||
| id: dl-nightly | ||
| if: > | ||
| github.event_name == 'push' && github.ref == 'refs/heads/main' && | ||
| endsWith(steps.get_version.outputs.version, '-SNAPSHOT') | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | |
Comment on lines
+178
to
+184
| mvn -N -q groovy:execute \ | ||
| -Dsource=assembly/sonar/run-sonar-analysis.groovy \ | ||
| -Dsonar.gate.mode=changed \ | ||
| "-Dsonar.base.sha=${{ github.event.pull_request.base.sha }}" \ | ||
| "-Dsonar.pullrequest.key=${{ github.event.number }}" \ | ||
| "-Dsonar.pullrequest.branch=${{ github.head_ref }}" \ | ||
| "-Dsonar.pullrequest.base=${{ github.base_ref }}" |
Comment on lines
+91
to
+97
| - name: Sonar analysis (nightly — parallel, gate all modules) | ||
| if: env.SONAR_TOKEN != '' | ||
| run: | | ||
| mvn -N -q groovy:execute \ | ||
| -Dsource=assembly/sonar/run-sonar-analysis.groovy \ | ||
| -Dsonar.gate.mode=all \ | ||
| -Dsonar.qualitygate.timeout=300 |
Signed-off-by: Pascal Essiembre <pascal.essiembre@norconex.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Pascal Essiembre <pascal.essiembre@norconex.com>
Signed-off-by: Pascal Essiembre <pascal.essiembre@norconex.com>
Signed-off-by: Pascal Essiembre <pascal.essiembre@norconex.com>
…rawler into feature/docker-deploy
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.
…teps