Skip to content

Commit

Permalink
Generate coverage build and upload
Browse files Browse the repository at this point in the history
  • Loading branch information
emlowe committed Jan 23, 2024
1 parent f28916f commit ab8774c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 11 deletions.
43 changes: 32 additions & 11 deletions .github/workflows/build-test-cplusplus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,39 @@ name: Build and Test C++
on:
push:
branches:
- main
- main
release:
types: [published]
pull_request:
branches:
- '**'
- "**"

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}--${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }}
cancel-in-progress: true

jobs:
coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Collect coverage data
run: |
sudo apt-get update
sudo apt-get install lcov -y
cmake -B ../build -DCMAKE_BUILD_TYPE=Debug -DWITH_COVERAGE=1
cmake --build ../build -- -j 6
../build/RunTests
lcov --directory ../build --capture --output-file lcov.info
lcov --remove lcov.info '*_deps/*' '/usr/*' --output-file lcov.info
- name: Upload to Coveralls
uses: coverallsapp/github-action@v2
if: always()
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
with:
path-to-lcov: "./lcov.info"
valgrind:
name: valgrind ubuntu
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -82,13 +103,13 @@ jobs:
name: Windows Latest
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4

- name: cmake, RunTests with Windows
run: |
mkdir build-win
cd build-win
cmake ..
cmake --build . --config Release -j 6
ctest -C Release -j 6
- name: cmake, RunTests with Windows
run: |
mkdir build-win
cd build-win
cmake ..
cmake --build . --config Release -j 6
ctest -C Release -j 6
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ target_link_libraries(RunTests
blake3
)

if(WITH_COVERAGE)
target_compile_options(RunTests PRIVATE --coverage)
target_link_options(RunTests PRIVATE --coverage)
endif()

find_package(Threads REQUIRED)

add_library(uint128 STATIC uint128_t/uint128_t.cpp)
Expand Down

0 comments on commit ab8774c

Please sign in to comment.