From 1986fb652ac3a4cb6e2ee995817c9661259379c2 Mon Sep 17 00:00:00 2001 From: Nikita Poltorapavlo Date: Tue, 17 Jan 2023 10:01:00 +0200 Subject: [PATCH] SonarCloud test --- .github/workflows/unit-tests.yml | 14 ++++++++++++++ sonar-project.properties | 12 ++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 sonar-project.properties diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 5f86aae816..d1c6af6584 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -10,6 +10,7 @@ env: BUILD_TYPE: Debug THUNDER_REF: "0731e67a8c9dea37a728201c9d19df5fbdfcbfe5" INTERFACES_REF: "f61d710cc51628819d0fd80b8cc65e55eeec12b4" + BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory jobs: unit-tests: @@ -197,8 +198,12 @@ jobs: if: ${{ matrix.compiler == 'gcc' && matrix.coverage == 'with-coverage' && !env.ACT }} run: echo "TOOLCHAIN_FILE=${{github.workspace}}/rdkservices/Tests/gcc-with-coverage.cmake" >> $GITHUB_ENV + - name: Install sonar-scanner and build-wrapper + uses: SonarSource/sonarcloud-github-c-cpp@v1 + - name: Build rdkservices run: > + build-wrapper-linux-x86-64 --out-dir "${{github.workspace}}/rdkservices/${{ env.BUILD_WRAPPER_OUT_DIR }}" cmake -S "${{github.workspace}}/rdkservices" -B build/rdkservices @@ -342,6 +347,15 @@ jobs: -t "rdkservices coverage" filtered_coverage.info + - name: Run sonar-scanner + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: > + sonar-scanner -X + -Dproject.settings="${{github.workspace}}/rdkservices/sonar-project.properties" + --define sonar.cfamily.build-wrapper-output="${{github.workspace}}/rdkservices/${{ env.BUILD_WRAPPER_OUT_DIR }}" + - name: Upload artifacts if: ${{ !env.ACT }} uses: actions/upload-artifact@v3 diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000000..b3e29290a1 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,12 @@ +sonar.projectKey=npoltorapavlo_rdkservices +sonar.organization=npoltorapavlo + +# This is the name and version displayed in the SonarCloud UI. +#sonar.projectName=rdkservices +#sonar.projectVersion=1.0 + +# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. +#sonar.sources=. + +# Encoding of the source code. Default is default system encoding +#sonar.sourceEncoding=UTF-8