Skip to content

Commit

Permalink
add template code coverage (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
petiaccja authored Apr 3, 2024
1 parent 7f100f6 commit 6607fad
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 5 deletions.
24 changes: 22 additions & 2 deletions .github/workflows/sonarqube.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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/[email protected]
with:
reports: template_coverage.info;test_coverage.info
targetdir: coverage
reporttypes: SonarQube

- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
33 changes: 32 additions & 1 deletion include/asyncpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,35 @@
add_library(asyncpp-headers INTERFACE)


target_include_directories(asyncpp-headers INTERFACE "${CMAKE_CURRENT_LIST_DIR}/..")
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)
2 changes: 1 addition & 1 deletion include/asyncpp/lock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <cassert>
#include <coroutine>
#include <optional>
#include <mutex>
#include <utility>


Expand Down
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 6607fad

Please sign in to comment.