From 5a038dabeffbed62ce829039f1448539d3e64d8c Mon Sep 17 00:00:00 2001 From: Cheng Peng Date: Wed, 13 Sep 2023 11:04:34 -0700 Subject: [PATCH] add build-and-test-pysophus.yml to run pysophus unit test --- .github/workflows/build-and-test-pysophus.yml | 68 +++++++++++++++++++ .github/workflows/main.yml | 21 ------ pysophus/SO3PyBind.h | 1 + 3 files changed, 69 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/build-and-test-pysophus.yml diff --git a/.github/workflows/build-and-test-pysophus.yml b/.github/workflows/build-and-test-pysophus.yml new file mode 100644 index 000000000..b1878411d --- /dev/null +++ b/.github/workflows/build-and-test-pysophus.yml @@ -0,0 +1,68 @@ +name: Build and Test + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + name: Build pysophus on ${{ matrix.os }} / ${{ matrix.cmakeOptions }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-20.04, macos-10.15] + steps: + - name : Checkout + uses: actions/checkout@v2 + with: + submodules: 'true' + + - name: Install dependencies + shell: bash + run: | + if [ "$RUNNER_OS" == "Linux" ]; then + # Update & upgrade package lists + sudo apt-get update -y + sudo apt-get upgrade + # Deal with Github CI limitation + # https://github.com/actions/runner-images/issues/6399#issuecomment-1285011525 + sudo apt install -y libunwind-dev + + # Generic dependencies + sudo apt-get install cmake + + # Clean APT cache + sudo apt-get clean + + elif [ "$RUNNER_OS" == "macOS" ]; then + # Install system deps with Homebrew + brew install cmake + # VRS dependencies + brew install fmt lz4 zstd xxhash + else + echo "$RUNNER_OS not supported" + exit 1 + fi + + - name: Install pysophus + shell: bash + run: | + # Installing Python and dependencies + if [ "$RUNNER_OS" == "Linux" ]; then + sudo apt-get install libpython3-dev python3-pip + sudo pip3 install numpy pytest + elif [ "$RUNNER_OS" == "macOS" ]; then + pip3 install numpy pytest + else + echo "$RUNNER_OS not supported" + exit 1 + fi + + # Build and install Python bindings + pip3 install . + + - name: Run pysophus tests + shell: bash + run: python3 -m pytest pysophus/tests/sophusPybindTests.py diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fd5662a99..c8a4fff12 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -64,24 +64,3 @@ jobs: - name: Run tests run: ./scripts/run_cpp_tests.sh - - - name: Install pysophus - shell: bash - run: | - # Installing Python and dependencies - if [ "$RUNNER_OS" == "Linux" ]; then - sudo apt-get install libpython3-dev python3-pip - sudo pip3 install numpy pytest - elif [ "$RUNNER_OS" == "macOS" ]; then - pip3 install numpy pytest - else - echo "$RUNNER_OS not supported" - exit 1 - fi - - # Build and install Python bindings - pip3 install . - - - name: Run pysophus tests - shell: bash - run: pytest pysophus/tests/sophusPybindTests.py diff --git a/pysophus/SO3PyBind.h b/pysophus/SO3PyBind.h index f82e9d9c1..cf27a0c14 100644 --- a/pysophus/SO3PyBind.h +++ b/pysophus/SO3PyBind.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include