Skip to content

Fix Build

Fix Build #18

Workflow file for this run

name: Python CI
on: [pull_request]
jobs:
build:
name: ${{ matrix.name }} ${{ matrix.build_type }} Python ${{ matrix.python_version }}
runs-on: ${{ matrix.os }}
env:
CTEST_OUTPUT_ON_FAILURE: ON
CTEST_PARALLEL_LEVEL: 2
CMAKE_BUILD_TYPE: ${{ matrix.build_type }}
PYTHON_VERSION: ${{ matrix.python_version }}
VENV_PYTHON_EXECUTABLE: ${{ github.workspace }}/venv/bin/python
GTSAM_INSTALL_DIR: ${{ github.workspace }}/gtsam_install_prefix
strategy:
fail-fast: false
matrix:
# Github Actions requires a single row to be added to the build matrix.
# See https://help.github.com/en/articles/workflow-syntax-for-github-actions.
name: [ubuntu-22.04-gcc-9, ubuntu-22.04-clang-12, macos-14-xcode-15.4]
build_type: [Debug, Release]
python_version: [3]
include:
- name: ubuntu-22.04-gcc-9
os: ubuntu-22.04
compiler: gcc
version: "9"
- name: ubuntu-22.04-clang-12
os: ubuntu-22.04
compiler: clang
version: "12"
- name: macos-14-xcode-15.4
os: macos-14
compiler: xcode
version: "15.4"
steps:
- name: Install Dependencies (Linux)
if: runner.os == 'Linux'
run: |
if [ "${{ matrix.compiler }}" = "gcc" ]; then
sudo apt-get install -y g++-${{ matrix.version }} g++-${{ matrix.version }}-multilib
echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV
else
sudo apt-get install -y clang-${{ matrix.version }} g++-multilib
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
fi
sudo apt-get -y install libtbb-dev libboost-all-dev
sudo add-apt-repository -y ppa:borglab/gtsam-develop
sudo apt-get -y update
- name: Install Dependencies (macOS)
if: runner.os == 'macOS'
run: |
if [ "${{ matrix.compiler }}" = "gcc" ]; then
brew install gcc@${{ matrix.version }}
echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV
else
sudo xcode-select -switch /Applications/Xcode_${{ matrix.version }}.app
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
fi
brew install boost
brew tap borglab/core
- name: Python Dependencies (Linux)
if: runner.os == 'Linux'
run: |
pip3 install -U "setuptools<70" wheel "numpy>=1.11.0" pyparsing pyyaml "pybind11-stubgen>=2.5.1"
- name: Python Dependencies inside venv (MacOS)
if: runner.os == 'macOS'
shell: bash
run: |
set -e
python${{ env.PYTHON_VERSION }} -m venv venv
source venv/bin/activate
echo "${{ github.workspace }}/venv/bin" >> $GITHUB_PATH
python -m pip install --upgrade pip
python -m pip install -U "setuptools<70" wheel "numpy>=1.11.0" pyparsing pyyaml "pybind11-stubgen>=2.5.1"
- name: Install GTSAM (Linux)
if: runner.os == 'Linux'
run: |
git clone https://github.com/borglab/gtsam.git /tmp/gtsam_source
cd /tmp/gtsam_source
mkdir build && cd $_
cmake -DGTSAM_BUILD_EXAMPLES_ALWAYS=OFF -DGTSAM_BUILD_PYTHON=ON ..
sudo make -j$(nproc) install
make python-install
sudo ldconfig
cd ${{ github.workspace }}
sudo rm -rf /tmp/gtsam_source
- name: Install GTSAM (macOS)
if: runner.os == 'macOS'
run: |
set -e
git clone https://github.com/borglab/gtsam.git /tmp/gtsam_source
cd /tmp/gtsam_source
mkdir build && cd $_
cmake -D GTSAM_BUILD_EXAMPLES_ALWAYS=OFF \
-D GTSAM_BUILD_PYTHON=ON \
-D GTSAM_WITH_TBB=OFF \
-D PYTHON_EXECUTABLE=${{ env.VENV_PYTHON_EXECUTABLE }} \
-D CMAKE_INSTALL_PREFIX=${{ env.GTSAM_INSTALL_DIR }} \
..
make -j$(sysctl -n hw.physicalcpu) install
make -j$(sysctl -n hw.physicalcpu) python-install
cd ${{ github.workspace }} # go back to home directory
rm -rf /tmp/gtsam_source
- name: Checkout
uses: actions/checkout@v4
- name: Build Directory
run: mkdir build
- name: Configure (Linux)
if: runner.os == 'Linux'
run: |
cmake -DGPMP2_BUILD_PYTHON_TOOLBOX=ON ..
working-directory: ./build
- name: Configure (macOS)
if: runner.os == 'macOS'
run: |
set -e
cmake -DGPMP2_BUILD_PYTHON_TOOLBOX=ON \
-DPYTHON_EXECUTABLE=$(pwd)/venv/bin/python \
-DGTSAM_DIR="${{ env.GTSAM_INSTALL_DIR }}/lib/cmake/GTSAM" \
-DCMAKE_PREFIX_PATH="${{ env.GTSAM_INSTALL_DIR }};$(brew --prefix)" \
..
working-directory: ./build
- name: Build
run: make -j4
working-directory: ./build
- name: Test
run: make -j4 python-test
working-directory: ./build