diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index bff515f..2b723c2 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -27,6 +27,11 @@ jobs: version: "17.0" directory: ${{ runner.temp }}/llvm - run: pip install conan + - name: Setup .NET Core # Required to execute ReportGenerator + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 8.x + dotnet-quality: 'ga' - name: Install sonar-scanner and build-wrapper uses: SonarSource/sonarcloud-github-c-cpp@v2 @@ -65,14 +70,29 @@ jobs: run: | build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build --preset conan-${{ env.conan_preset }} + - name: Template coverage + run: | + wget https://github.com/petiaccja/TemplateCoverage/releases/download/v1.3.0/TemplateCoverage_Linux_x86_64.zip + unzip TemplateCoverage_Linux_x86_64.zip + chmod +x ./TemplateCoverage_Linux_x86_64/template-coverage + export RESOURCE_DIR=$(clang++ -print-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 shell: bash run: | ./test --reporter junit --out ${{github.workspace}}/tests.xml llvm-profdata merge -sparse default.profraw -o coverage.profdata - llvm-cov show ./test -instr-profile=coverage.profdata > ${{github.workspace}}/coverage.txt - + llvm-cov export -format=lcov -object ./test -instr-profile=coverage.profdata > ${{github.workspace}}/test_coverage.info + + - name: Merge coverage reports + uses: danielpalme/ReportGenerator-GitHub-Action@5.2.4 + with: + reports: template_coverage.info;test_coverage.info + targetdir: coverage + reporttypes: SonarQube + - name: Run sonar-scanner env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/include/asyncpp/CMakeLists.txt b/include/asyncpp/CMakeLists.txt index 2aebc7e..eb5db6b 100644 --- a/include/asyncpp/CMakeLists.txt +++ b/include/asyncpp/CMakeLists.txt @@ -1,4 +1,35 @@ add_library(asyncpp-headers INTERFACE) -target_include_directories(asyncpp-headers INTERFACE "${CMAKE_CURRENT_LIST_DIR}/..") \ No newline at end of file +target_include_directories(asyncpp-headers INTERFACE "${CMAKE_CURRENT_LIST_DIR}/..") + + +target_sources(asyncpp-headers + INTERFACE FILE_SET headers TYPE HEADERS FILES + container/atomic_collection.hpp + container/atomic_deque.hpp + container/atomic_item.hpp + container/atomic_stack.hpp + memory/rc_ptr.hpp + testing/interleaver.hpp + testing/suspension_point.hpp + threading/spinlock.hpp + threading/cache.hpp + concepts.hpp + event.hpp + generator.hpp + join.hpp + lock.hpp + mutex.hpp + promise.hpp + scheduler.hpp + semaphore.hpp + shared_mutex.hpp + sleep.hpp + stream.hpp + task.hpp + thread_pool.hpp +) + + +set_target_properties(asyncpp-headers PROPERTIES VERIFY_INTERFACE_HEADER_SETS ON) \ No newline at end of file diff --git a/include/asyncpp/lock.hpp b/include/asyncpp/lock.hpp index a12edf4..eb81972 100644 --- a/include/asyncpp/lock.hpp +++ b/include/asyncpp/lock.hpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include diff --git a/sonar-project.properties b/sonar-project.properties index 6ff9c57..3523b8d 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -6,6 +6,6 @@ sonar.projectName=asyncpp sonar.sources=./src,./include #sonar.exclusions= -sonar.cfamily.llvm-cov.reportPath=./coverage.txt +sonar.coverageReportPaths=./coverage/SonarQube.xml sonar.junit.reportPaths=./tests.xml sonar.cfamily.threads=4 \ No newline at end of file