diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index 158c487..2ba4ad8 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -71,8 +71,7 @@ jobs: unzip TemplateCoverage_Linux_x86_64.zip chmod +x ./TemplateCoverage_Linux_x86_64/template-coverage export RESOURCE_DIR=$(clang++ -print-resource-dir) - mkdir ${{github.workspace}}/coverage - python3 ./TemplateCoverage_Linux_x86_64/run_on_compile_commands.py -p ${{github.workspace}}/build/${{env.conan_preset}}/compile_commands.json ./TemplateCoverage_Linux_x86_64/template-coverage -- --format=lcov --out-file=${{github.workspace}}/coverage/template_coverage.info -extra-arg=-resource-dir=$RESOURCE_DIR + python3 ./TemplateCoverage_Linux_x86_64/run_on_compile_commands.py -p ${{github.workspace}}/build/${{env.conan_preset}}/compile_commands.json ./TemplateCoverage_Linux_x86_64/template-coverage -- --format=lcov --out-file=${{github.workspace}}/template_coverage.info -extra-arg=-resource-dir=$RESOURCE_DIR - name: Test & code coverage working-directory: ${{github.workspace}}/build/${{ env.conan_preset }}/bin @@ -80,7 +79,9 @@ jobs: run: | ./test --reporter junit --out ${{github.workspace}}/tests.xml llvm-profdata merge -sparse default.profraw -o coverage.profdata - llvm-cov export -format=lcov -object ./test -instr-profile=coverage.profdata > ${{github.workspace}}/coverage/test_coverage.info + llvm-cov export -format=lcov -object ./test -instr-profile=coverage.profdata > ${{github.workspace}}/test_coverage.info + pip install gcovr + gcovr -a ${{github.workspace}}/test_coverage.info -a ${{github.workspace}}/template_coverage.info --sonarqube ${{github.workspace}}/coverage.xml - name: Run sonar-scanner env: diff --git a/sonar-project.properties b/sonar-project.properties index 4387cab..cb9f6f7 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -6,6 +6,6 @@ sonar.projectName=asyncpp sonar.sources=./src,./include #sonar.exclusions= -sonar.cfamily.gcov.reportsPath=./coverage +sonar.coverageReportPaths=./coverage.xml sonar.junit.reportPaths=./tests.xml sonar.cfamily.threads=4 \ No newline at end of file