From 415bc73190a672504cc683a602f5b4688c388f73 Mon Sep 17 00:00:00 2001 From: Martin Melik-Merkumians Date: Mon, 8 Jan 2024 12:14:07 +0100 Subject: [PATCH] Change SonarCloud wrapper Signed-off-by: Martin Melik-Merkumians --- .github/workflows/cmake.yml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 013137909..0f0631be8 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -35,15 +35,12 @@ jobs: - name: install gcovr 5.0 run: | pip install gcovr==5.0 # 5.1 is not supported + + - name: Install libcap, lcov, and CppUTest + run: sudo apt-get install -y libcap-dev lcov cpputest - name: Install sonar-scanner and build-wrapper uses: SonarSource/sonarcloud-github-c-cpp@v2 - - - name: Install sonar-scanner and build-wrapper - uses: SonarSource/sonarcloud-github-c-cpp@v1 - - - name: Install libcap, lcov, and CppUTest - run: sudo apt-get install -y libcap-dev lcov cpputest - name: Configure CMake # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. @@ -53,19 +50,23 @@ jobs: - name: Build # Build your program with the given configuration run: | - cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} - name: Test working-directory: ${{github.workspace}}/build # Execute tests defined by the CMake configuration. # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail run: ctest -C ${{env.BUILD_TYPE}} + + - name: Collect coverage into one XML report + run: | + gcovr --sonarqube > coverage.xml - name: Run sonar-scanner env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Put the name of your token here run: | - cmake --build ${{github.workspace}}/build --target clean - build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build ${{github.workspace}}/build --config Release - sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" + sonar-scanner \ + --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" \ + --define sonar.coverageReportPaths=coverage.xml \ No newline at end of file