Skip to content

Fix Build

Fix Build #13

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 }}
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.11]
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
shell: bash
run: |
# Install dependencies for gtwrap
python$PYTHON_VERSION -m pip install -U setuptools numpy pyparsing pyyaml
- name: GTSAM (Linux)
if: runner.os == 'Linux'
run: |
# Install gtsam
git clone https://github.com/borglab/gtsam.git /home/runner/work/gtsam
cd /home/runner/work/gtsam
mkdir build && cd $_
cmake -D GTSAM_BUILD_EXAMPLES_ALWAYS=OFF -DGTSAM_BUILD_PYTHON=ON ..
sudo make -j$(nproc) install && sudo make python-install
sudo ldconfig
cd $GITHUB_WORKSPACE # go back to home directory
- name: GTSAM (macOS)
if: runner.os == 'macOS'
run: |
# Install gtsam
git clone https://github.com/borglab/gtsam.git /Users/runner/work/gtsam
cd /Users/runner/work/gtsam
mkdir build && cd $_
cmake -D GTSAM_BUILD_EXAMPLES_ALWAYS=OFF -DGTSAM_BUILD_PYTHON=ON -DPYTHON_EXECUTABLE=/usr/local/bin/python$PYTHON_VERSION ..
make -j$(sysctl -n hw.physicalcpu) install && make python-install
cd $GITHUB_WORKSPACE # go back to home directory
- 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: |
cmake -DGPMP2_BUILD_PYTHON_TOOLBOX=ON -DPYTHON_EXECUTABLE=/usr/local/bin/python$PYTHON_VERSION ..
working-directory: ./build
- name: Build
run: make -j4
working-directory: ./build
- name: Test
run: make -j4 python-test
working-directory: ./build