Skip to content

ci: add SonarQube analysis with coverage#3

Merged
rezaramadhan merged 7 commits into
mainfrom
ci/sonarqube-scan
Jun 25, 2026
Merged

ci: add SonarQube analysis with coverage#3
rezaramadhan merged 7 commits into
mainfrom
ci/sonarqube-scan

Conversation

@rezaramadhan

@rezaramadhan rezaramadhan commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds SonarQube static analysis with unit-test coverage, plus GitHub Actions workflow linting. Coverage is generated by the existing unit-test suite (no separate coverage process), and analysis paths are configured in sonar-project.properties.

Changes

CI workflow (.github/workflows/ci.yml)

  • Converted to a reusable workflow (workflow_call) that exposes the coverage and JUnit artifact names as outputs.
  • The existing unit-test matrix job now runs with coverage enabled (pcov): Pest emits coverage/clover.xml and coverage/junit.xml, absolute paths are normalized, and both are uploaded as per-PHP-version artifacts. SonarQube consumes the latest PHP version's reports.
  • No separate coverage job — coverage piggybacks on the unit tests that already run.

Main workflow (.github/workflows/main.yml, new)

  • Triggers on push to main. Runs ci, then a sonar job that downloads the coverage/JUnit artifacts and runs SonarSource/sonarqube-scan-action on a GitHub-hosted runner.

Pull request workflow (.github/workflows/pull-request.yml, new)

  • Triggers on all pull requests. Runs actionlint to lint workflow files, and ci.

Sonar config (sonar-project.properties, new)

  • Project key Accredifysg_PHP-RDF-Canonicalize. Points PHP coverage at coverage_BE/clover.xml and tests at junit_BE/junit.xml, with those artifact directories excluded from analysis.

Notes

  • Requires SONAR_TOKEN and SONAR_HOST_URL repository secrets. The GitHub-hosted runner must be able to reach the configured SONAR_HOST_URL.

rezaramadhan and others added 7 commits June 18, 2026 16:50
Adds a coverage job that generates Clover + JUnit reports and a sonar
job that calls the shared Accredify sonar-scan reusable workflow,
following Accredifysg/VerifiableCredentials-PHP#32.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Public repos cannot call a reusable workflow hosted in an internal
repo, so replicate the sonar-scan steps inline.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Fold coverage into the existing unit test matrix job (no separate
coverage process), make ci.yml a reusable workflow, and split
triggers into main.yml (push -> ci + sonar) and pull-request.yml
(PR -> actionlint + ci). Adds actionlint workflow linting.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Runs Sonar on PRs to validate the setup before relying on main.yml.
To be removed once confirmed working on main.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drop the branches: [main] filter so the workflow runs on PRs to any
base branch.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rezaramadhan rezaramadhan requested a review from skydudie June 22, 2026 03:12
@rezaramadhan rezaramadhan merged commit ee9a4dd into main Jun 25, 2026
5 checks passed
@rezaramadhan rezaramadhan deleted the ci/sonarqube-scan branch June 25, 2026 01:44
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.

2 participants