Skip to content

Sonarcloud Analysis #707

Sonarcloud Analysis

Sonarcloud Analysis #707

Workflow file for this run

name: Sonarcloud Analysis
on:
schedule:
- cron: '21 9 * * 4'
push:
branches:
- 'master'
pull_request:
# Declare default permissions as read only.
permissions: read-all
jobs:
sonarcloud:
runs-on: ubuntu-latest
container: egecetinn/ubuntu2204
env:
BUILD_WRAPPER_OUT_DIR: build/sonar
steps:
- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
submodules: recursive
- name: Prepare
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Install Test Requirements
run: pip install -r tests/data/requirements.txt
- name: Install sonar-scanner and build-wrapper
uses: sonarsource/sonarcloud-github-c-cpp@816b1822d71776ee0d32bc012e95024ec52ac1fc # v3.1.0
- name: Configure
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DXXX_ENABLE_COVERAGE=ON
- name: Run build-wrapper
run: build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build build/ --config Debug --parallel --target coverage-xml
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: sonar-scanner --define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json" --define sonar.coverageReportPaths=./build/coverage-xml-sonar.xml