From c5b417d7c84db233efb133520d1216195544286e Mon Sep 17 00:00:00 2001 From: Jamie Newbon Date: Tue, 25 Aug 2020 15:18:35 +0100 Subject: [PATCH] #6750 Got coverage working, removed clang tidy as that is automatic --- .github/workflows/job-sonarcloud.yml | 15 ++++++--------- CMakeLists.txt | 13 +------------ cmake/CodeCoverage.cmake | 2 +- 3 files changed, 8 insertions(+), 22 deletions(-) diff --git a/.github/workflows/job-sonarcloud.yml b/.github/workflows/job-sonarcloud.yml index bb997bc97..f581a6613 100644 --- a/.github/workflows/job-sonarcloud.yml +++ b/.github/workflows/job-sonarcloud.yml @@ -20,7 +20,7 @@ jobs: - name: Run Sonar run: | apt-get update - apt-get install -y gcovr clang-tidy + apt-get install -y gcovr export SONAR_SCANNER_VERSION=4.4.0.2170 export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip @@ -36,13 +36,10 @@ jobs: cd build-release cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_COVERAGE=ON .. . ./version - echo "Building, output redirected to file due to verbrosity this may take 10-15 mins to complete..." - build-wrapper-linux-x86-64 --out-dir bw-output make -j > output.txt 2>&1 - echo "Outputting last 200 lines of the build..." - tail -200 output.txt + build-wrapper-linux-x86-64 --out-dir bw-output make -j - make unit_coverage + make coverage sonar-scanner \ -Dsonar.organization=symless \ @@ -51,8 +48,8 @@ jobs: -Dsonar.projectBaseDir=../ \ -Dsonar.exclusions=./ext/**,**/build-release/** \ -Dsonar.cfamily.build-wrapper-output=bw-output \ - -Dsonar.host.url=https://sonarcloud.io - -Dsonar.cxx.coverage.reportPath=unit_coverage.xml - -Dsonar.cxx.clangtidy.reportPath=output.txt + -Dsonar.host.url=https://sonarcloud.io \ + -Dsonar.coverageReportPaths=build-release/coverage.xml + env: SONAR_TOKEN: ${{secrets.SONAR_TOKEN}} diff --git a/CMakeLists.txt b/CMakeLists.txt index ad8cd1cbb..dbccbce0d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,21 +40,10 @@ if (ENABLE_COVERAGE) include(cmake/CodeCoverage.cmake) append_coverage_compiler_flags() setup_target_for_coverage_gcovr_xml( - NAME unit_coverage + NAME coverage EXECUTABLE unittests BASE_DIRECTORY "${PROJECT_SOURCE_DIR}/src" EXCLUDE "ext/*") - setup_target_for_coverage_gcovr_xml( - NAME integ_coverage - EXECUTABLE integtests - BASE_DIRECTORY "${PROJECT_SOURCE_DIR}/src" - EXCLUDE "ext/*") - - #Add ClangTidy Reports - set(CMAKE_CXX_CLANG_TIDY - clang-tidy; - -header-filter=.; - -checks=*;) endif() diff --git a/cmake/CodeCoverage.cmake b/cmake/CodeCoverage.cmake index 35789b452..2edaeccbc 100644 --- a/cmake/CodeCoverage.cmake +++ b/cmake/CodeCoverage.cmake @@ -334,7 +334,7 @@ function(setup_target_for_coverage_gcovr_xml) ${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS} # Running gcovr - COMMAND ${GCOVR_PATH} --xml + COMMAND ${GCOVR_PATH} --sonarqube -r ${BASEDIR} ${GCOVR_EXCLUDE_ARGS} --object-directory=${PROJECT_BINARY_DIR} -o ${Coverage_NAME}.xml