Skip to content

Commit

Permalink
Run for coverage and upload to Coveralls.
Browse files Browse the repository at this point in the history
  • Loading branch information
AmineKhaldi committed May 11, 2023
1 parent 956d310 commit f4b90cf
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,31 @@ concurrency:
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
sudo apt-get install snap -y
sudo snap install cmake --classic
hash -r
cmake -B ../build -DCMAKE_BUILD_TYPE=Debug -DWITH_COVERAGE=1 -DBUILD_BLS_PYTHON_BINDINGS=0 -DBUILD_BLS_BENCHMARKS=0
cmake --build ../build -- -j 6
../build/src/runtest
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'

build_wheels:
name: Build and Test on ${{ matrix.os }} CPython ${{ matrix.python }}
runs-on: ${{ matrix.os }}
Expand Down
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ if(BUILD_BLS_TESTS)
Catch2::Catch2
Threads::Threads
)
if(WITH_COVERAGE)
target_compile_options(runtest PRIVATE --coverage)
target_link_options(runtest PRIVATE --coverage)
endif()
endif()

if(BUILD_BLS_BENCHMARKS)
Expand Down

0 comments on commit f4b90cf

Please sign in to comment.