Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Coverage

on:
push:
branches:
- main
pull_request:

jobs:
Coverage:
name: Code Coverage
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout Repository
uses: actions/checkout@v4.0.0
with:
fetch-depth: 10

- name: Dependencies
run: |
sudo apt-get install ccache lcov
echo 'CACHE_PATH=~/.cache/ccache' >> "$GITHUB_ENV"

- name: Cache Build
id: cache-build
uses: actions/cache@v3.0.11
with:
path: ${{ env.CACHE_PATH }}
key: ubuntu-latest-Release-cache

- name: Prepare ccache
run: |
ccache --max-size=1.0G
ccache -V && ccache --show-config
ccache --show-stats && ccache --zero-stats\

- name: Configure
run: |
mkdir -p build
cd build
cmake .. \
-DIPC_TOOLKIT_BUILD_TESTS=ON \
-DIPC_TOOLKIT_WITH_CODE_COVERAGE=ON \
-DCMAKE_BUILD_TYPE=Release \

- name: Build
run: cd build; make -j2; ccache --show-stats

- name: Run Coverage
run: |
cd build
ctest --verbose --output-on-failure -j2
lcov --directory . --capture --output-file coverage.info
lcov --remove coverage.info '/usr/*' "${HOME}"'/.cache/*' '*tests/*.cpp' --output-file coverage.info

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
20 changes: 20 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,19 @@ option(IPC_TOOLKIT_WITH_CUDA "Enable CUDA CCD"
option(IPC_TOOLKIT_WITH_RATIONAL_INTERSECTION "Use rational edge-triangle intersection check" OFF)
option(IPC_TOOLKIT_WITH_ROBIN_MAP "Use Tessil's robin-map rather than std maps" ON)
option(IPC_TOOLKIT_WITH_ABSEIL "Use Abseil's hash functions" ON)
option(IPC_TOOLKIT_WITH_CODE_COVERAGE "Enable coverage reporting" OFF)
mark_as_advanced(IPC_TOOLKIT_WITH_CODE_COVERAGE)

include(CMakeDependentOption)
cmake_dependent_option(IPC_TOOLKIT_TEST_CCD_BENCHMARK "Enable CCD benchmark test" OFF "IPC_TOOLKIT_BUILD_TESTS" OFF)
if(IPC_TOOLKIT_TEST_CCD_BENCHMARK)
mark_as_advanced(CLEAR IPC_TOOLKIT_CCD_BENCHMARK_DIR)
mark_as_advanced(CLEAR IPC_TOOLKIT_CCD_NEW_BENCHMARK_DIR)
set(IPC_TOOLKIT_CCD_BENCHMARK_DIR "" CACHE PATH "Path to the CCD benchmark directory")
set(IPC_TOOLKIT_CCD_NEW_BENCHMARK_DIR "" CACHE PATH "Path to the new CCD benchmark directory")
else()
mark_as_advanced(FORCE IPC_TOOLKIT_CCD_BENCHMARK_DIR)
mark_as_advanced(FORCE IPC_TOOLKIT_CCD_NEW_BENCHMARK_DIR)
endif()

# Set default minimum C++ standard
Expand Down Expand Up @@ -263,6 +270,19 @@ if(IPC_TOOLKIT_TOPLEVEL_PROJECT AND IPC_TOOLKIT_BUILD_TESTS)
add_subdirectory(tests)
endif()

################################################################################
# Code Coverage
################################################################################

if(IPC_TOOLKIT_WITH_CODE_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
# Add required flags (GCC & LLVM/Clang)
target_compile_options(ipc_toolkit INTERFACE
-g # generate debug info
--coverage # sets all required flags
)
target_link_options(ipc_toolkit INTERFACE --coverage)
endif()

################################################################################
# Python bindings
################################################################################
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<a href="https://github.com/ipc-sim/ipc-toolkit/actions/workflows/continuous.yml"><img src="https://github.com/ipc-sim/ipc-toolkit/actions/workflows/continuous.yml/badge.svg"></a>
<a href="https://github.com/ipc-sim/ipc-toolkit/actions/workflows/python.yml"><img src="https://github.com/ipc-sim/ipc-toolkit/actions/workflows/python.yml/badge.svg"></a>
<a href="https://ipctk.xyz"><img src="https://github.com/ipc-sim/ipc-toolkit/actions/workflows/docs.yml/badge.svg"></a>
<a href="https://codecov.io/github/ipc-sim/ipc-toolkit"><img src="https://codecov.io/github/ipc-sim/ipc-toolkit/graph/badge.svg?token=9BR6GPKRY8"/></a>
<a href="https://github.com/ipc-sim/ipc-toolkit/blob/main/LICENSE"><img src="https://img.shields.io/github/license/ipc-sim/ipc-toolkit.svg?color=blue"></a>
</p>

Expand Down
1 change: 1 addition & 0 deletions docs/PYPI_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
![PyPI](https://img.shields.io/pypi/v/ipctk?color=brightgreen&label=PyPI&logo=python&logoColor=white)
![PyPI - Downloads](https://img.shields.io/pypi/dm/ipctk?label=PyPI%20Downloads&logo=python&logoColor=white)
![GitHub Repo stars](https://img.shields.io/github/stars/ipc-sim/ipc-toolkit?label=Stars&logo=github)
[![codecov](https://codecov.io/github/ipc-sim/ipc-toolkit/graph/badge.svg?token=9BR6GPKRY8)](https://codecov.io/github/ipc-sim/ipc-toolkit)
[![License](https://img.shields.io/github/license/ipc-sim/ipc-toolkit.svg?color=blue&label=License)](https://github.com/ipc-sim/ipc-toolkit/blob/main/LICENSE)

## Description
Expand Down
2 changes: 2 additions & 0 deletions docs/source/cpp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ C++
.. image:: https://github.com/ipc-sim/ipc-toolkit/actions/workflows/docs.yml/badge.svg
:target: https://ipctk.xyz/
:alt: Docs
.. image:: https://codecov.io/github/ipc-sim/ipc-toolkit/graph/badge.svg?token=9BR6GPKRY8
:target: https://codecov.io/github/ipc-sim/ipc-toolkit
.. image:: https://img.shields.io/github/license/ipc-sim/ipc-toolkit.svg?color=blue
:target: https://github.com/ipc-sim/ipc-toolkit/blob/main/LICENSE
:alt: License
Expand Down
1 change: 1 addition & 0 deletions python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
![PyPI - Downloads](https://img.shields.io/pypi/dm/ipctk?label=PyPI%20Downloads&logo=python&logoColor=white)
[![Python](https://github.com/ipc-sim/ipc-toolkit/actions/workflows/python.yml/badge.svg)](https://github.com/ipc-sim/ipc-toolkit/actions/workflows/python.yml)
[![Docs](https://github.com/ipc-sim/ipc-toolkit/actions/workflows/docs.yml/badge.svg)](https://ipctk.xyz/)
[![codecov](https://codecov.io/github/ipc-sim/ipc-toolkit/graph/badge.svg?token=9BR6GPKRY8)](https://codecov.io/github/ipc-sim/ipc-toolkit)
[![License](https://img.shields.io/github/license/ipc-sim/ipc-toolkit.svg?color=blue)](https://github.com/ipc-sim/ipc-toolkit/blob/main/LICENSE)

We provide Python bindings for functions in the toolkit using [pybind11](https://github.com/pybind/pybind11).
Expand Down