Skip to content

Commit

Permalink
Run C++ API tests in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
victorreijgwart committed Sep 4, 2024
1 parent 1f376e5 commit 65f878a
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
41 changes: 40 additions & 1 deletion .github/workflows/cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,44 @@ jobs:
working-directory: ${{github.workspace}}
run: |
echo "::add-matcher::./.github/problem-matchers/gcc.json"
cmake --build build --config Release
cmake --build build --parallel --config Release
echo "::remove-matcher owner=problem-matcher-gcc::"
test:
name: Test
needs: build
runs-on: ubuntu-20.04
steps:
- name: Fetch the package's repository
uses: actions/checkout@v4

- name: Setup CMake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.18'

- name: Setup ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ secrets.CCACHE_CACHE_VERSION }}|ubuntu-20.04-gcc-release
create-symlink: true

- name: Setup GTest
run: |
sudo apt-get update
sudo apt-get install -q -y --no-install-recommends libgtest-dev
- name: Configure CMake
working-directory: ${{github.workspace}}
run: cmake -B build -DCMAKE_BUILD_TYPE=Release -DWAVEMAP_ENABLE_TESTING=ON library/cpp

- name: Build tests
working-directory: ${{github.workspace}}
run: |
echo "::add-matcher::./.github/problem-matchers/gcc.json"
cmake --build build --parallel --config Release
echo "::remove-matcher owner=problem-matcher-gcc::"
- name: Run tests
working-directory: ${{github.workspace}}/build
run: ctest -C Release
4 changes: 3 additions & 1 deletion library/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ add_subdirectory(src/io)
add_subdirectory(src/pipeline)

# Tests
if (ENABLE_TESTING OR CATKIN_ENABLE_TESTING)
if (ENABLE_TESTING OR WAVEMAP_ENABLE_TESTING OR CATKIN_ENABLE_TESTING)
find_package(GTest REQUIRED)
enable_testing()
add_subdirectory(test)
endif ()

Expand Down
1 change: 0 additions & 1 deletion library/cpp/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
find_package(GTest REQUIRED)
include(GoogleTest)

add_subdirectory(src/core)
Expand Down

0 comments on commit 65f878a

Please sign in to comment.