chore: Use new SonarCloud action

refactor: Rename job from 'sonarcloud-analysis' to 'analyze' in SonarCloud workflow

refactor: Reorder SonarQube scan and build wrapper installation steps in SonarCloud workflow

refactor: Update SonarQube scan step to use new action and streamline options

fix: Update SonarQube scan step to correctly pass coverage report paths and environment variables

fix: Set CPU core count to a fixed value in SonarCloud analysis workflow

refactor: Move 'Install Build Wrapper' step to the correct position in the SonarCloud analysis workflow

refactor: Remove unused Sonar Scanner environment variables from analysis workflow
This commit is contained in:
Nick Bolton 2025-10-09 09:53:32 +01:00 committed by Chris Rizzitello
parent 4fb76bec41
commit 47662c359e
3 changed files with 10 additions and 12 deletions

View file

@ -21,7 +21,6 @@ jobs:
analyze: analyze:
if: ${{ !github.event.pull_request.draft }} if: ${{ !github.event.pull_request.draft }}
name: Analyze
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: debian:trixie-slim container: debian:trixie-slim
timeout-minutes: 20 timeout-minutes: 20

View file

@ -26,10 +26,7 @@ jobs:
timeout-minutes: 20 timeout-minutes: 20
env: env:
SONAR_SCANNER_VERSION: 6.1.0.4477 CPU_CORE_COUNT: 4
SONAR_SCANNER_OPTS: -server
SONAR_SCANNER_URL_BASE: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli
CPU_CORE_COUNT: ${{ vars.SONAR_SCANNER_CPU_COUNT || 4 }}
steps: steps:
- name: Install container dependencies - name: Install container dependencies
@ -45,8 +42,8 @@ jobs:
with: with:
like: "debian" like: "debian"
- name: Install sonar-scanner and build-wrapper - name: Install Build Wrapper
uses: sonarsource/sonarcloud-github-c-cpp@v3 uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v6
- name: Configure - name: Configure
run: | run: |
@ -81,11 +78,11 @@ jobs:
fi fi
echo "csv=$paths" >> $GITHUB_OUTPUT echo "csv=$paths" >> $GITHUB_OUTPUT
- name: Run SonarScanner - name: SonarQube Scan
run: | uses: SonarSource/sonarqube-scan-action@v6
export PATH=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux-x64/bin:$PATH with:
sonar-scanner \ args: >
-Dsonar.coverageReportPaths=${{ steps.coverage-paths.outputs.csv }} \ -Dsonar.coverageReportPaths=${{ steps.coverage-paths.outputs.csv }}
-Dsonar.cfamily.threads=${{ env.CPU_CORE_COUNT }} -Dsonar.cfamily.threads=${{ env.CPU_CORE_COUNT }}
env: env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

View file

@ -78,6 +78,8 @@
"Serhii", "Serhii",
"shemp", "shemp",
"SNAPPROCESS", "SNAPPROCESS",
"sonarcloud",
"sonarqube",
"Sorin", "Sorin",
"subproject", "subproject",
"subprojects", "subprojects",