From 82fcc4a6b460e97aa94b26b924b76e12238513b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Mon, 1 Apr 2024 14:58:58 +0200 Subject: [PATCH 01/12] ci test --- .github/workflows/sonarqube.yml | 10 +++++++++- include/asyncpp/CMakeLists.txt | 33 ++++++++++++++++++++++++++++++++- include/asyncpp/lock.hpp | 2 +- sonar-project.properties | 2 +- 4 files changed, 43 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index bff515f..4aeab07 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -40,6 +40,7 @@ jobs: sudo update-alternatives --remove-all gcc || true sudo update-alternatives --remove-all g++ || true sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 10 --slave /usr/bin/g++ g++ /usr/bin/g++-13 + sudo apt install lcov - name: Cache conan packages id: cache-conan @@ -65,13 +66,20 @@ 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.1.0/TemplateCoverage_Linux_x86_64.zip + unzip TemplateCoverage_Linux_x86_64.zip + python3 ./TemplateCoverage_Linux_x86_64/run_on_compile_commands.py -p ${{github.workspace}}/${{env.conan_preset}} ./TemplateCoverage_Linux_x86_64/template-coverage -- --format=lcov --out-file=${{github.workspace}}/template_coverage.info + - 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 + lcov -a ${{github.workspace}}/template_coverage.info -a ${{github.workspace}}/test_coverage.info -o ${{github.workspace}}/coverage.info - name: Run sonar-scanner env: 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..d345e7f 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.cfamily.lcov.reportPaths=./coverage.info sonar.junit.reportPaths=./tests.xml sonar.cfamily.threads=4 \ No newline at end of file From 0c1d190bd38e6870ce3132fa3ae84c9dc48d6377 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Mon, 1 Apr 2024 15:09:07 +0200 Subject: [PATCH 02/12] fix --- .github/workflows/sonarqube.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index 4aeab07..91cc013 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -70,7 +70,7 @@ jobs: run: | wget https://github.com/petiaccja/TemplateCoverage/releases/download/v1.1.0/TemplateCoverage_Linux_x86_64.zip unzip TemplateCoverage_Linux_x86_64.zip - python3 ./TemplateCoverage_Linux_x86_64/run_on_compile_commands.py -p ${{github.workspace}}/${{env.conan_preset}} ./TemplateCoverage_Linux_x86_64/template-coverage -- --format=lcov --out-file=${{github.workspace}}/template_coverage.info + python3 ./TemplateCoverage_Linux_x86_64/run_on_compile_commands.py -p ${{github.workspace}}/build/${{env.conan_preset}} ./TemplateCoverage_Linux_x86_64/template-coverage -- --format=lcov --out-file=${{github.workspace}}/template_coverage.info - name: Test & code coverage working-directory: ${{github.workspace}}/build/${{ env.conan_preset }}/bin From 0c55f00f2657aca00c1b05cc4bd64f198adc39ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Mon, 1 Apr 2024 15:18:19 +0200 Subject: [PATCH 03/12] fix --- .github/workflows/sonarqube.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index 91cc013..1dcacf6 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -70,7 +70,7 @@ jobs: run: | wget https://github.com/petiaccja/TemplateCoverage/releases/download/v1.1.0/TemplateCoverage_Linux_x86_64.zip unzip TemplateCoverage_Linux_x86_64.zip - python3 ./TemplateCoverage_Linux_x86_64/run_on_compile_commands.py -p ${{github.workspace}}/build/${{env.conan_preset}} ./TemplateCoverage_Linux_x86_64/template-coverage -- --format=lcov --out-file=${{github.workspace}}/template_coverage.info + 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 - name: Test & code coverage working-directory: ${{github.workspace}}/build/${{ env.conan_preset }}/bin From 10b62075f9ad6f7ce0ac3bf4a22619b76c72564d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Mon, 1 Apr 2024 15:26:36 +0200 Subject: [PATCH 04/12] fix --- .github/workflows/sonarqube.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index 1dcacf6..a5d6af3 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -70,6 +70,7 @@ jobs: run: | wget https://github.com/petiaccja/TemplateCoverage/releases/download/v1.1.0/TemplateCoverage_Linux_x86_64.zip unzip TemplateCoverage_Linux_x86_64.zip + chmod +x ./TemplateCoverage_Linux_x86_64/template-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}}/template_coverage.info - name: Test & code coverage From 019b3b80295bffe3ab5c3227400b8beb6334373a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Mon, 1 Apr 2024 15:32:15 +0200 Subject: [PATCH 05/12] resource dir --- .github/workflows/sonarqube.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index a5d6af3..24dd953 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -71,7 +71,8 @@ jobs: wget https://github.com/petiaccja/TemplateCoverage/releases/download/v1.1.0/TemplateCoverage_Linux_x86_64.zip unzip TemplateCoverage_Linux_x86_64.zip chmod +x ./TemplateCoverage_Linux_x86_64/template-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}}/template_coverage.info + 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 From e0af9d38ad6b05a0400db081bdd26e3c17b85603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Mon, 1 Apr 2024 15:50:20 +0200 Subject: [PATCH 06/12] coverage path --- sonar-project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-project.properties b/sonar-project.properties index d345e7f..adb6031 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -6,6 +6,6 @@ sonar.projectName=asyncpp sonar.sources=./src,./include #sonar.exclusions= -sonar.cfamily.lcov.reportPaths=./coverage.info +sonar.cfamily.gcov.reportsPath=./coverage.info sonar.junit.reportPaths=./tests.xml sonar.cfamily.threads=4 \ No newline at end of file From f371fc030b52eb8759663d439847957843b325e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Mon, 1 Apr 2024 20:30:21 +0200 Subject: [PATCH 07/12] bump version --- .github/workflows/sonarqube.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index 24dd953..81912ff 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -68,7 +68,7 @@ jobs: - name: Template coverage run: | - wget https://github.com/petiaccja/TemplateCoverage/releases/download/v1.1.0/TemplateCoverage_Linux_x86_64.zip + wget https://github.com/petiaccja/TemplateCoverage/releases/download/v1.2.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) From 1710275aebc0e8a4926d3da30288c0924b1b5b0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Mon, 1 Apr 2024 21:36:18 +0200 Subject: [PATCH 08/12] bump version --- .github/workflows/sonarqube.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index 81912ff..b6feadc 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -68,7 +68,7 @@ jobs: - name: Template coverage run: | - wget https://github.com/petiaccja/TemplateCoverage/releases/download/v1.2.0/TemplateCoverage_Linux_x86_64.zip + 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) From c87bdf7740c1f877e8ea21997a8fc251aaa2ec8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Mon, 1 Apr 2024 21:49:28 +0200 Subject: [PATCH 09/12] coverage dir --- .github/workflows/sonarqube.yml | 7 +++---- sonar-project.properties | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index b6feadc..158c487 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -40,7 +40,6 @@ jobs: sudo update-alternatives --remove-all gcc || true sudo update-alternatives --remove-all g++ || true sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 10 --slave /usr/bin/g++ g++ /usr/bin/g++-13 - sudo apt install lcov - name: Cache conan packages id: cache-conan @@ -72,7 +71,8 @@ jobs: 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 + 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 - name: Test & code coverage working-directory: ${{github.workspace}}/build/${{ env.conan_preset }}/bin @@ -80,8 +80,7 @@ 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}}/test_coverage.info - lcov -a ${{github.workspace}}/template_coverage.info -a ${{github.workspace}}/test_coverage.info -o ${{github.workspace}}/coverage.info + llvm-cov export -format=lcov -object ./test -instr-profile=coverage.profdata > ${{github.workspace}}/coverage/test_coverage.info - name: Run sonar-scanner env: diff --git a/sonar-project.properties b/sonar-project.properties index adb6031..4387cab 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.info +sonar.cfamily.gcov.reportsPath=./coverage sonar.junit.reportPaths=./tests.xml sonar.cfamily.threads=4 \ No newline at end of file From 1f12ecd23cb114e78e6f056e50ecf079231dba14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Mon, 1 Apr 2024 22:03:43 +0200 Subject: [PATCH 10/12] merge w/ gcovr --- .github/workflows/sonarqube.yml | 7 ++++--- sonar-project.properties | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) 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 From 52a706b4f64359b1e988a9f0f3693b12b9704001 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Wed, 3 Apr 2024 20:01:00 +0200 Subject: [PATCH 11/12] with ReportGenerator --- .github/workflows/sonarqube.yml | 16 +++++++++++++--- sonar-project.properties | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index 2ba4ad8..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 @@ -80,9 +85,14 @@ jobs: ./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}}/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: 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/sonar-project.properties b/sonar-project.properties index cb9f6f7..9ec1182 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -6,6 +6,6 @@ sonar.projectName=asyncpp sonar.sources=./src,./include #sonar.exclusions= -sonar.coverageReportPaths=./coverage.xml +sonar.coverageReportPaths=./coverage sonar.junit.reportPaths=./tests.xml sonar.cfamily.threads=4 \ No newline at end of file From f2fb912d77414a17cba342568ed7b77cae4aa20a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Wed, 3 Apr 2024 20:38:19 +0200 Subject: [PATCH 12/12] fix --- sonar-project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-project.properties b/sonar-project.properties index 9ec1182..3523b8d 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -6,6 +6,6 @@ sonar.projectName=asyncpp sonar.sources=./src,./include #sonar.exclusions= -sonar.coverageReportPaths=./coverage +sonar.coverageReportPaths=./coverage/SonarQube.xml sonar.junit.reportPaths=./tests.xml sonar.cfamily.threads=4 \ No newline at end of file