#56 - Make Sonar analysis step optional to support fork CI #57

Merged
GuillaumeHemmen merged 3 commits from 56-Make-Sonar-analysis-step-optional-to-support-fork-CI into master 2026-04-13 11:31:15 +00:00

Description

Make the Sonar analysis step optional across all CI workflows to support forked repositories. Sonar-specific configuration (host URL, project key, project name) is moved out of sonar-project.properties and into CI variables/secrets. All four workflows now skip the Sonar job gracefully when the required values are not configured, so fork CI passes cleanly without any Sonar setup.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Refactoring (no functional changes)
  • CI/CD update

Fixes #56

Testing

  • Unit tests added/updated
  • Manual testing performed
  • Tested on iOS
  • Tested on Android

No application code was changed. CI changes can be validated by verifying that:

  • The upstream repository with all values configured continues to run Sonar as before.
  • On tag.yaml, the publish job still runs when the Sonar job is skipped.

Breaking Changes

None. The Sonar job behaviour is unchanged for repositories that have all required values configured.

Checklist

  • Code follows the project's code style (Prettier, ESLint)
  • TypeScript types are properly defined
  • Tests pass locally
  • Documentation updated (if needed)
  • CI checks pass (Prettier, TypeScript, Lint, Tests, Sonar)

Additional Notes

Changed files:

  • .forgejo/workflows/pr.yaml — added if condition + env vars (SONAR_HOST_URL, SONAR_PROJECT_KEY, SONAR_PROJECT_NAME) + passed via -D flags
  • .forgejo/workflows/master.yaml — same changes
  • .forgejo/workflows/dev.yaml — same changes
  • .forgejo/workflows/tag.yaml — same changes + publish job updated with if: always() && (needs.sonar.result == 'success' || needs.sonar.result == 'skipped') to prevent blocking on skipped Sonar
  • sonar-project.properties — removed sonar.host.url, sonar.projectKey, sonar.projectName
  • CONTRIBUTING.md — added "CI & Sonar Analysis" section documenting the required secret and variables for fork contributors

Required CI configuration for Sonar to run:

Name Type Description
SONAR_TOKEN Secret Authentication token
SONAR_HOST_URL Variable SonarQube instance URL
SONAR_PROJECT_KEY Variable Project key in SonarQube
SONAR_PROJECT_NAME Variable Project name in SonarQube
## Description Make the Sonar analysis step optional across all CI workflows to support forked repositories. Sonar-specific configuration (`host URL`, `project key`, `project name`) is moved out of `sonar-project.properties` and into CI variables/secrets. All four workflows now skip the Sonar job gracefully when the required values are not configured, so fork CI passes cleanly without any Sonar setup. ## Type of Change - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Documentation update - [ ] Performance improvement - [ ] Refactoring (no functional changes) - [x] CI/CD update ## Related Issue Fixes #56 ## Testing - [ ] Unit tests added/updated - [ ] Manual testing performed - [ ] Tested on iOS - [ ] Tested on Android No application code was changed. CI changes can be validated by verifying that: - The upstream repository with all values configured continues to run Sonar as before. - On `tag.yaml`, the `publish` job still runs when the Sonar job is skipped. ## Breaking Changes None. The Sonar job behaviour is unchanged for repositories that have all required values configured. ## Checklist - [x] Code follows the project's code style (Prettier, ESLint) - [x] TypeScript types are properly defined - [x] Tests pass locally - [x] Documentation updated (if needed) - [x] CI checks pass (Prettier, TypeScript, Lint, Tests, Sonar) ## Additional Notes **Changed files:** - `.forgejo/workflows/pr.yaml` — added `if` condition + env vars (`SONAR_HOST_URL`, `SONAR_PROJECT_KEY`, `SONAR_PROJECT_NAME`) + passed via `-D` flags - `.forgejo/workflows/master.yaml` — same changes - `.forgejo/workflows/dev.yaml` — same changes - `.forgejo/workflows/tag.yaml` — same changes + `publish` job updated with `if: always() && (needs.sonar.result == 'success' || needs.sonar.result == 'skipped')` to prevent blocking on skipped Sonar - `sonar-project.properties` — removed `sonar.host.url`, `sonar.projectKey`, `sonar.projectName` - `CONTRIBUTING.md` — added "CI & Sonar Analysis" section documenting the required secret and variables for fork contributors **Required CI configuration for Sonar to run:** | Name | Type | Description | |---|---|---| | `SONAR_TOKEN` | Secret | Authentication token | | `SONAR_HOST_URL` | Variable | SonarQube instance URL | | `SONAR_PROJECT_KEY` | Variable | Project key in SonarQube | | `SONAR_PROJECT_NAME` | Variable | Project name in SonarQube |
#56 - make Sonar analysis optional to support fork CI, update documentation
All checks were successful
/ pre-check (push) Successful in 12s
/ tsc (push) Successful in 30s
/ prettier (push) Successful in 33s
/ lint (push) Successful in 31s
/ unit-testing (push) Successful in 40s
/ sonar (push) Successful in 1m25s
/ prettier (pull_request) Successful in 29s
/ tsc (pull_request) Successful in 32s
/ lint (pull_request) Successful in 34s
/ unit-testing (pull_request) Successful in 35s
/ sonar (pull_request) Successful in 55s
b3bf88f2c2
#56 - remove condition for publish job
Some checks failed
/ pre-check (push) Successful in 9s
/ prettier (push) Successful in 27s
/ tsc (push) Successful in 31s
/ lint (push) Successful in 36s
/ prettier (pull_request) Successful in 30s
/ tsc (pull_request) Failing after 24s
/ lint (pull_request) Has been cancelled
/ unit-testing (pull_request) Has been cancelled
/ unit-testing (push) Has been cancelled
/ sonar (pull_request) Has been cancelled
/ sonar (push) Has been cancelled
21bb04032e
#56 - improve CONTRIBUTING.md formatting for readability and consistency
All checks were successful
/ pre-check (push) Successful in 12s
/ tsc (push) Successful in 28s
/ prettier (push) Successful in 32s
/ lint (push) Successful in 32s
/ prettier (pull_request) Successful in 29s
/ unit-testing (push) Successful in 33s
/ tsc (pull_request) Successful in 30s
/ lint (pull_request) Successful in 34s
/ unit-testing (pull_request) Successful in 34s
/ sonar (push) Successful in 1m3s
/ sonar (pull_request) Successful in 57s
edbe25034f
GuillaumeHemmen scheduled this pull request to auto merge when all checks succeed 2026-04-13 11:29:58 +00:00
GuillaumeHemmen canceled auto merging this pull request when all checks succeed 2026-04-13 11:30:28 +00:00
GuillaumeHemmen deleted branch 56-Make-Sonar-analysis-step-optional-to-support-fork-CI 2026-04-13 11:31:15 +00:00
Sign in to join this conversation.
No description provided.