From 984019f137aa857cffc4a35a00f485cd63b743d9 Mon Sep 17 00:00:00 2001
From: Zachary Ferguson
Date: Thu, 5 Oct 2023 16:24:01 -0400
Subject: [PATCH 1/8] Add codecov
---
.github/workflows/coverage.yml | 53 ++++++++++++++++++++++++++++++++++
tests/data/ccd-queries | 1 +
2 files changed, 54 insertions(+)
create mode 100644 .github/workflows/coverage.yml
create mode 160000 tests/data/ccd-queries
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
new file mode 100644
index 000000000..50de84e10
--- /dev/null
+++ b/.github/workflows/coverage.yml
@@ -0,0 +1,53 @@
+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 (Linux)
+ run: |
+ sudo apt-get install ccache
+ 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: ${{ runner.os }}-${{ matrix.config }}-cache
+
+ - name: Prepare ccache
+ run: |
+ ccache --max-size=1.0G
+ ccache -V && ccache --show-config
+ ccache --show-stats && ccache --zero-stats\
+
+ - name: Configure (Linux/macOS)
+ run: |
+ mkdir -p build
+ cd build
+ cmake .. \
+ -DIPC_TOOLKIT_BUILD_TESTS=ON \
+ -DCMAKE_BUILD_TYPE=${{ matrix.config }}
+
+ - name: Build (Linux/macOS)
+ run: cd build; make -j2; ccache --show-stats
+
+ - name: Upload coverage reports to Codecov
+ uses: codecov/codecov-action@v3
+ env:
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
\ No newline at end of file
diff --git a/tests/data/ccd-queries b/tests/data/ccd-queries
new file mode 160000
index 000000000..4d6cce334
--- /dev/null
+++ b/tests/data/ccd-queries
@@ -0,0 +1 @@
+Subproject commit 4d6cce33477d8d5c666c31c8ea23e1aea97be371
From c571ae27c77443c2f6a0c1dea5c2737d9e48703b Mon Sep 17 00:00:00 2001
From: Zachary Ferguson
Date: Thu, 5 Oct 2023 16:47:56 -0400
Subject: [PATCH 2/8] Add coverage flags to cmake
---
.github/workflows/coverage.yml | 14 +++++++++-----
CMakeLists.txt | 20 ++++++++++++++++++++
2 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
index 50de84e10..160f6b3e9 100644
--- a/.github/workflows/coverage.yml
+++ b/.github/workflows/coverage.yml
@@ -18,7 +18,7 @@ jobs:
with:
fetch-depth: 10
- - name: Dependencies (Linux)
+ - name: Dependencies
run: |
sudo apt-get install ccache
echo 'CACHE_PATH=~/.cache/ccache' >> "$GITHUB_ENV"
@@ -28,7 +28,7 @@ jobs:
uses: actions/cache@v3.0.11
with:
path: ${{ env.CACHE_PATH }}
- key: ${{ runner.os }}-${{ matrix.config }}-cache
+ key: ubuntu-latest-RelWithDebInfo-cache
- name: Prepare ccache
run: |
@@ -36,17 +36,21 @@ jobs:
ccache -V && ccache --show-config
ccache --show-stats && ccache --zero-stats\
- - name: Configure (Linux/macOS)
+ - name: Configure
run: |
mkdir -p build
cd build
cmake .. \
-DIPC_TOOLKIT_BUILD_TESTS=ON \
- -DCMAKE_BUILD_TYPE=${{ matrix.config }}
+ -DIPC_TOOLKIT_CODE_COVERAGE=ON \
+ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
- - name: Build (Linux/macOS)
+ - name: Build
run: cd build; make -j2; ccache --show-stats
+ - name: Tests
+ run: cd build; ctest --verbose -j2
+
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f70473ffe..051faaf6e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -69,6 +69,8 @@ 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_CODE_COVERAGE "Enable coverage reporting" OFF)
+mark_as_advanced(IPC_TOOLKIT_CODE_COVERAGE)
# Set default minimum C++ standard
if(IPC_TOOLKIT_TOPLEVEL_PROJECT)
@@ -255,6 +257,24 @@ if(IPC_TOOLKIT_TOPLEVEL_PROJECT AND IPC_TOOLKIT_BUILD_TESTS)
add_subdirectory(tests)
endif()
+################################################################################
+# Code Coverage
+################################################################################
+
+if(IPC_TOOLKIT_CODE_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
+ add_library(ipc_toolkit_coverage_config INTERFACE)
+
+ # Add required flags (GCC & LLVM/Clang)
+ target_compile_options(ipc_toolkit_coverage_config INTERFACE
+ -O0 # no optimization
+ -g # generate debug info
+ --coverage # sets all required flags
+ )
+ target_link_options(ipc_toolkit_coverage_config INTERFACE --coverage)
+
+ target_link_libraries(ipc_toolkit PUBLIC ipc_toolkit_coverage_config)
+endif()
+
################################################################################
# Python bindings
################################################################################
From eb68a19bf90e72dc0903df81171b4e92fcb65fac Mon Sep 17 00:00:00 2001
From: Zachary Ferguson
Date: Thu, 5 Oct 2023 19:22:39 -0400
Subject: [PATCH 3/8] Enable optimizations
---
.github/workflows/coverage.yml | 12 ++++++++----
CMakeLists.txt | 1 -
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
index 160f6b3e9..1fd9aa43a 100644
--- a/.github/workflows/coverage.yml
+++ b/.github/workflows/coverage.yml
@@ -28,7 +28,7 @@ jobs:
uses: actions/cache@v3.0.11
with:
path: ${{ env.CACHE_PATH }}
- key: ubuntu-latest-RelWithDebInfo-cache
+ key: ubuntu-latest-Release-cache
- name: Prepare ccache
run: |
@@ -43,13 +43,17 @@ jobs:
cmake .. \
-DIPC_TOOLKIT_BUILD_TESTS=ON \
-DIPC_TOOLKIT_CODE_COVERAGE=ON \
- -DCMAKE_BUILD_TYPE=RelWithDebInfo \
+ -DCMAKE_BUILD_TYPE=Release \
- name: Build
run: cd build; make -j2; ccache --show-stats
- - name: Tests
- run: cd build; ctest --verbose -j2
+ - 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
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9a96a12f5..e2dfd89e0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -274,7 +274,6 @@ if(IPC_TOOLKIT_CODE_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
# Add required flags (GCC & LLVM/Clang)
target_compile_options(ipc_toolkit_coverage_config INTERFACE
- -O0 # no optimization
-g # generate debug info
--coverage # sets all required flags
)
From 8553a39669d719071efa726dd3cdeeebf3c1d9f9 Mon Sep 17 00:00:00 2001
From: Zachary Ferguson
Date: Thu, 5 Oct 2023 19:35:05 -0400
Subject: [PATCH 4/8] Install lcov
---
.github/workflows/coverage.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
index 1fd9aa43a..b9875cbaa 100644
--- a/.github/workflows/coverage.yml
+++ b/.github/workflows/coverage.yml
@@ -20,7 +20,7 @@ jobs:
- name: Dependencies
run: |
- sudo apt-get install ccache
+ sudo apt-get install ccache lcov
echo 'CACHE_PATH=~/.cache/ccache' >> "$GITHUB_ENV"
- name: Cache Build
From 18806382fc9ea7dc5e16a276e723441caf55e893 Mon Sep 17 00:00:00 2001
From: Zachary Ferguson
Date: Thu, 5 Oct 2023 20:02:19 -0400
Subject: [PATCH 5/8] Remove ccd-queries folder
---
tests/data/ccd-queries | 1 -
1 file changed, 1 deletion(-)
delete mode 160000 tests/data/ccd-queries
diff --git a/tests/data/ccd-queries b/tests/data/ccd-queries
deleted file mode 160000
index 4d6cce334..000000000
--- a/tests/data/ccd-queries
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 4d6cce33477d8d5c666c31c8ea23e1aea97be371
From eff3d51ff418b905035b325279fbbf3a71100e9d Mon Sep 17 00:00:00 2001
From: Zachary Ferguson
Date: Thu, 5 Oct 2023 20:05:30 -0400
Subject: [PATCH 6/8] Rename IPC_TOOLKIT_WITH_CODE_COVERAGE
---
.github/workflows/coverage.yml | 2 +-
CMakeLists.txt | 19 ++++++++++---------
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
index b9875cbaa..acd6e63d1 100644
--- a/.github/workflows/coverage.yml
+++ b/.github/workflows/coverage.yml
@@ -42,7 +42,7 @@ jobs:
cd build
cmake .. \
-DIPC_TOOLKIT_BUILD_TESTS=ON \
- -DIPC_TOOLKIT_CODE_COVERAGE=ON \
+ -DIPC_TOOLKIT_WITH_CODE_COVERAGE=ON \
-DCMAKE_BUILD_TYPE=Release \
- name: Build
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e2dfd89e0..7cdb968d1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -69,14 +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_CODE_COVERAGE "Enable coverage reporting" OFF)
-mark_as_advanced(IPC_TOOLKIT_CODE_COVERAGE)
+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
@@ -269,17 +274,13 @@ endif()
# Code Coverage
################################################################################
-if(IPC_TOOLKIT_CODE_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
- add_library(ipc_toolkit_coverage_config INTERFACE)
-
+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_coverage_config INTERFACE
+ target_compile_options(ipc_toolkit INTERFACE
-g # generate debug info
--coverage # sets all required flags
)
- target_link_options(ipc_toolkit_coverage_config INTERFACE --coverage)
-
- target_link_libraries(ipc_toolkit PUBLIC ipc_toolkit_coverage_config)
+ target_link_options(ipc_toolkit INTERFACE --coverage)
endif()
################################################################################
From 84e521bb98afc8b91a7a85240f4c3d80b2a67833 Mon Sep 17 00:00:00 2001
From: Zachary Ferguson
Date: Thu, 5 Oct 2023 20:08:39 -0400
Subject: [PATCH 7/8] Add badge
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index b641b4df3..7c6e8ba5f 100644
--- a/README.md
+++ b/README.md
@@ -6,6 +6,7 @@
+
From f1611fc0173058b228c391825e122bbf8f045f37 Mon Sep 17 00:00:00 2001
From: Zachary Ferguson
Date: Thu, 5 Oct 2023 20:11:19 -0400
Subject: [PATCH 8/8] More badges
---
docs/PYPI_README.md | 1 +
docs/source/cpp.rst | 2 ++
python/README.md | 1 +
3 files changed, 4 insertions(+)
diff --git a/docs/PYPI_README.md b/docs/PYPI_README.md
index 3a0ef1264..d72da8891 100644
--- a/docs/PYPI_README.md
+++ b/docs/PYPI_README.md
@@ -3,6 +3,7 @@



+[](https://codecov.io/github/ipc-sim/ipc-toolkit)
[](https://github.com/ipc-sim/ipc-toolkit/blob/main/LICENSE)
## Description
diff --git a/docs/source/cpp.rst b/docs/source/cpp.rst
index 43d3ba0dd..bbc6bd6e8 100644
--- a/docs/source/cpp.rst
+++ b/docs/source/cpp.rst
@@ -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
diff --git a/python/README.md b/python/README.md
index c1dff7b90..28c159903 100644
--- a/python/README.md
+++ b/python/README.md
@@ -4,6 +4,7 @@

[](https://github.com/ipc-sim/ipc-toolkit/actions/workflows/python.yml)
[](https://ipctk.xyz/)
+[](https://codecov.io/github/ipc-sim/ipc-toolkit)
[](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).