Skip to content

feat: enhance CI workflows with Sonar analysis and coverage merging s…#1263

Open
essiembre wants to merge 13 commits into
mainfrom
feature/docker-deploy
Open

feat: enhance CI workflows with Sonar analysis and coverage merging s…#1263
essiembre wants to merge 13 commits into
mainfrom
feature/docker-deploy

Conversation

@essiembre

Copy link
Copy Markdown
Contributor

…teps

…teps

Signed-off-by: Pascal Essiembre <pascal.essiembre@norconex.com>
Copilot AI review requested due to automatic review settings June 13, 2026 06:14

Copilot AI 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.

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.groovy into 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 thread assembly/sonar/run-sonar-analysis.groovy Outdated
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}"
}

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.

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 thread .github/workflows/maven-ci-cd.yaml Outdated
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
essiembre and others added 2 commits June 13, 2026 02:26
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>
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.

3 participants