From 890fe51a5293dc842d15bbc6a570e96f6c1228bc Mon Sep 17 00:00:00 2001 From: Fabian Klebert Date: Mon, 26 Feb 2024 10:40:01 +0100 Subject: [PATCH 1/2] Add SonarCloud support to scan C++ runtime --- .github/workflows/sonarcloud.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/sonarcloud.yml diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml new file mode 100644 index 000000000..18ddbadfa --- /dev/null +++ b/.github/workflows/sonarcloud.yml @@ -0,0 +1,30 @@ +name: SonarCloud C/C++ CI +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened] +jobs: + build: + name: Build + runs-on: ubuntu-latest + env: + BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: Install sonar-scanner and build-wrapper + uses: SonarSource/sonarcloud-github-c-cpp@v2 + - name: Run build-wrapper + run: | + mkdir build + cmake -S compiler/extensions/cpp/runtime/src -B build + build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build build/ --config Release + - name: Run sonar-scanner + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Put the name of your token here + run: | + sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" \ No newline at end of file From 66d565ac977be8eb594b740ebf2ee5e2db04bf61 Mon Sep 17 00:00:00 2001 From: Fabian Klebert Date: Mon, 26 Feb 2024 10:55:09 +0100 Subject: [PATCH 2/2] Add SonarCloud config file --- sonar-project.properties | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 sonar-project.properties diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 000000000..dc0fb4dde --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,13 @@ +sonar.projectKey=ndsev_zserio +sonar.organization=ndsev + +# This is the name and version displayed in the SonarCloud UI. +#sonar.projectName=zserio +#sonar.projectVersion=1.0 + + +# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. +sonar.sources=compiler/extensions/cpp/runtime/src + +# Encoding of the source code. Default is default system encoding +sonar.sourceEncoding=UTF-8 \ No newline at end of file