Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enabled tests on CI #904

Merged
merged 9 commits into from
Jan 21, 2024
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
14 changes: 9 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@ jobs:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
- os: ubuntu-22.04
package_manager: "apt"
test: "ON"

- os: macos-13
package_manager: "brew"
test: "OFF"

- os: windows-2022
package_manager: "vcpkg"
test: "OFF"

steps:
- name: Checkout Pangolin
Expand Down Expand Up @@ -57,14 +60,15 @@ jobs:

- name: Configure CMake
run: |
cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN_FILE" -DBUILD_TESTS=ON
cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN_FILE" -DBUILD_TESTS=${{matrix.test}}

- name: Build
run: cmake --build build --config $BUILD_TYPE

- name: Run all tests
working-directory: ${{runner.workspace}}/Pangolin/build
run: ctest
if: ${{ matrix.test == 'ON' }}
run: |
cmake --build build --target test

emscripten:
runs-on: ubuntu-22.04
Expand All @@ -76,7 +80,7 @@ jobs:
- name: install build dependencies
run: |
sudo apt update
sudo apt install -y emscripten ninja-build libeigen3-dev
sudo apt install -y emscripten ninja-build libeigen3-dev catch2

- name: Configure Pangolin
run: emcmake cmake -G Ninja -B pangolin-build -D CMAKE_BUILD_TYPE=$BUILD_TYPE -D Eigen3_DIR=/usr/share/eigen3/cmake/
Expand Down
11 changes: 3 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,11 @@ endif()
#######################################################
## Testing setup

option( BUILD_TESTS "Build Tests" OFF)
find_package(Catch2 2 QUIET)
if(Catch2_FOUND)
option(BUILD_TESTS "Build Tests" OFF)
if(BUILD_TESTS)
find_package(Catch2 2 REQUIRED)
include(CTest)
include(Catch)
else()
if(BUILD_TESTS)
message(WARNING "Building Tests requested, but Catch2 library not found.")
set( BUILD_TESTS OFF)
endif()
endif()

#######################################################
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ cmake --build build
cmake --build build -t pypangolin_pip_install

# Run me some tests! (Requires Catch2 which must be manually installed on Ubuntu.)
cmake -B build -G Ninja -D BUILD_TESTS=ON
cmake --build build
cd build
ctest
```

Expand Down
2 changes: 2 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
<build_depend>wayland-dev</build_depend>
<exec_depend>wayland</exec_depend>

<test_depend>catch2</test_depend>

<export>
<build_type>cmake</build_type>
</export>
Expand Down
10 changes: 5 additions & 5 deletions scripts/install_prerequisites.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,17 @@ if [[ "$MANAGER" == "apt" ]]; then
if ((DRYRUN > 0)); then PKGS_OPTIONS+=(--dry-run); SUDO=""; fi
PKGS_REQUIRED+=(libgl1-mesa-dev libwayland-dev libxkbcommon-dev wayland-protocols libegl1-mesa-dev)
PKGS_REQUIRED+=(libc++-dev libglew-dev libeigen3-dev cmake g++ ninja-build)
PKGS_RECOMMENDED+=(libjpeg-dev libpng-dev)
PKGS_RECOMMENDED+=(libjpeg-dev libpng-dev catch2)
PKGS_RECOMMENDED+=(libavcodec-dev libavutil-dev libavformat-dev libswscale-dev libavdevice-dev)
PKGS_ALL+=(libdc1394-22-dev libraw1394-dev libopenni-dev python3.9-dev python3-distutils)
PKGS_ALL+=(libdc1394-dev libraw1394-dev libopenni-dev python3-dev python3-distutils)
elif [[ "$MANAGER" == "dnf" ]]; then
SUDO="sudo"
PKGS_UPDATE="dnf check-update"
PKGS_OPTIONS+=(install)
PKGS_REQUIRED+=(wayland-devel libxkbcommon-devel g++ ninja-build)
PKGS_REQUIRED+=(glew-devel eigen3 cmake)
PKGS_RECOMMENDED+=(libjpeg-devel libpng-devel OpenEXR-devel)
PKGS_ALL+=(libdc1394-22-devel libraw1394-devel librealsense-devel openni-devel)
PKGS_RECOMMENDED+=(libjpeg-devel libpng-devel OpenEXR-devel catch2)
PKGS_ALL+=(libdc1394-devel libraw1394-devel librealsense-devel openni-devel)
if ((DRYRUN > 0)); then
MANAGER="echo $MANAGER"
SUDO=""
Expand All @@ -142,7 +142,7 @@ elif [[ "$MANAGER" == "pacman" ]]; then
PKGS_OPTIONS+=(-Syu)
PKGS_REQUIRED+=(mesa wayland libxkbcommon wayland-protocols libc++ glew eigen cmake gcc ninja)
PKGS_RECOMMENDED+=(libjpeg-turbo libpng ffmpeg)
PKGS_ALL+=(libdc1394 libraw1394 openni python39 python-distutils-extra)
PKGS_ALL+=(libdc1394 libraw1394 openni python3 python-distutils-extra)
if ((DRYRUN > 0)); then
MANAGER="echo $MANAGER"
SUDO=""
Expand Down
Loading