Skip to content

Commit 4334429

Browse files
authored
Coverage (#4)
* coverage ci * separate build and test * install lcov * overwrite coverage.info * change directory * exclude benchmark and example * python cov report * local only * upload python coverage --------- Co-authored-by: k.koide <k.koide@aist.go.jp>
1 parent c020c0d commit 4334429

File tree

2 files changed

+57
-2
lines changed

2 files changed

+57
-2
lines changed

.github/workflows/coverage.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Coverage
2+
3+
on:
4+
push:
5+
branches: [ master, coverage ]
6+
paths-ignore: '**.md'
7+
pull_request:
8+
branches: [ master, coverage ]
9+
paths-ignore: '**.md'
10+
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
jobs:
15+
coverage:
16+
runs-on: ubuntu-22.04
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
with:
21+
token: ${{ secrets.GH_PAT }}
22+
submodules: recursive
23+
24+
- name: Install Dependencies
25+
run: |
26+
sudo apt-get -y update
27+
sudo apt-get install -y build-essential cmake python3-pip pybind11-dev libeigen3-dev libfmt-dev libtbb-dev libomp-dev libpcl-dev libgtest-dev lcov
28+
pip install -U setuptools pytest pytest-cov numpy scipy
29+
30+
- name: Build (C++)
31+
run: |
32+
mkdir build && cd build
33+
cmake .. -DBUILD_TESTS=ON -DBUILD_EXAMPLES=ON -DBUILD_BENCHMARKS=ON -DBUILD_WITH_TBB=ON -DBUILD_WITH_PCL=ON -DENABLE_COVERAGE=ON
34+
make -j$(nproc)
35+
36+
- name: Test (C++)
37+
run: |
38+
cd build
39+
ctest -j$(nproc)
40+
make coverage
41+
42+
- name: Build (Python)
43+
run: |
44+
python3 setup.py build && python3 setup.py install --user
45+
46+
- name: Test (Python)
47+
run: |
48+
pytest src/example/basic_registration.py --cov=src --cov-report=xml
49+
50+
- name: Upload coverage reports to Codecov
51+
uses: codecov/codecov-action@v4.0.1
52+
with:
53+
token: ${{ secrets.CODECOV_TOKEN }}
54+
slug: koide3/small_gicp
55+
files: build/coverage.info,coverage.xml

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ if(ENABLE_COVERAGE)
4545

4646
add_custom_target(coverage
4747
COMMAND ${LCOV} --directory . --capture --output-file coverage.info
48-
COMMAND ${LCOV} --remove coverage.info -o filtered_coverage.info '/usr/*'
49-
COMMAND ${GENHTML} --demangle-cpp -o coverage filtered_coverage.info
48+
COMMAND ${LCOV} --remove coverage.info -o coverage.info '/usr/*'
49+
COMMAND ${GENHTML} --demangle-cpp -o coverage coverage.info
5050
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
5151
endif()
5252

0 commit comments

Comments
 (0)