Skip to content

Fix cibuildwheel install #403

Fix cibuildwheel install

Fix cibuildwheel install #403

Workflow file for this run

name: CI
on:
push:
branches:
- 'main'
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:
jobs:
test-on-ubuntu:
if: github.event.event_name == 'workflow_dispatch' || github.event.pull_request.draft == false
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
python: [python3.8, python3.9, python3.10, python3.11, python3.12]
compiler:
- C: gcc-11
CXX: g++-11
package: g++-11
repos: ['"ppa:ubuntu-toolchain-r/test"']
include:
# gcc 5
- os: ubuntu-20.04
python: python3.8
compiler:
C: gcc-5
CXX: g++-5
package: g++-5
repos:
- '"deb http://us.archive.ubuntu.com/ubuntu/ bionic main"'
- '"deb http://us.archive.ubuntu.com/ubuntu/ bionic universe"'
# Clang 7
- os: ubuntu-20.04
python: python3.8
compiler:
C: clang-7
CXX: clang++-7
package: clang-7
repos: []
# Clang 15
- os: ubuntu-22.04
python: python3.10
compiler:
C: clang-15
CXX: clang++-15
package: clang-15
repos: []
steps:
- name: Checkout
uses: actions/checkout@v4
# - Installing software-properties-common adds add-apt-repository
- name: Update install tools
run: |
sudo apt-get update
sudo apt-get install -y software-properties-common curl
# - Adding matrix.compiler.repos is needed to have compiler available on all ubuntu versions
- name: Install C and CXX compilers
run: |
for repo in ${{ join(matrix.compiler.repos, ' ') }}
do
sudo add-apt-repository -y "$repo"
done
sudo apt-get install -y ${{ matrix.compiler.package }}
# - ppa:deadsnakes/ppa is needed to have python3.x-dev available on all ubuntu versions
# - python3.x-dev is used instead of python3.x because the -dev version includes python header
# files needed to compile C extension modules
- name: Install python
run: |
sudo add-apt-repository -y ppa:deadsnakes/ppa
sudo apt-get install -y \
${{ matrix.python }}-dev \
${{ matrix.python }}-distutils \
${{ matrix.python }}-venv
curl https://bootstrap.pypa.io/get-pip.py | ${{ matrix.python }}
pip install --upgrade setuptools
- name: Install general build dependencies
run: |
sudo apt-get install -y \
doxygen \
libgmp-dev \
pandoc
# NOTE(brad): libunwind-dev is a broken dependency of libgoogle-glog-dev, itself
# a dependency of ceres. Without this step on jammy, apt-get install libgoogle-glog-dev
# would fail. If this step could be removed and still have the build succeed, it should.
- name: Fix libunwind-dev install on jammy
if: ${{ matrix.os == 'ubuntu-22.04' }}
run: |
sudo apt-get install -yf libunwind-dev
- name: Install build dependencies for SymForce benchmarks
run: |
sudo apt-get install -y \
libboost-dev \
libboost-serialization-dev \
libboost-system-dev \
libboost-filesystem-dev \
libboost-thread-dev \
libboost-program-options-dev \
libboost-date-time-dev \
libboost-timer-dev \
libboost-chrono-dev \
libboost-regex-dev \
libgoogle-glog-dev \
libeigen3-dev
# NOTE(aaron): Some packages do not have a version that supports py3.8..py3.12
- name: Fix py3.12 versions
if: ${{ matrix.python == 'python3.12' }}
run: |
sed -i 's|numba==0.58.1|numba~=0.59.0|g' dev_requirements.txt
sed -i 's|llvmlite==0.41.1|llvmlite~=0.42.0|g' dev_requirements.txt
sed -i 's|numpy==1.24.4|numpy~=1.26.0|g' dev_requirements.txt
sed -i 's|scipy==1.10.1|scipy~=1.12.0|g' dev_requirements.txt
sed -i 's|pandas==2.0.3|pandas~=2.2.0|g' dev_requirements.txt
- name: Install python dependencies
run: pip install -r dev_requirements.txt
- name: Run cmake build
run: |
cmake -B build \
-D CMAKE_C_COMPILER=${{ matrix.compiler.C }} \
-D CMAKE_CXX_COMPILER=${{ matrix.compiler.CXX }} \
-D "SYMFORCE_COMPILE_OPTIONS=-Wall;-Wextra;-Werror" \
-D SYMFORCE_PYTHON_OVERRIDE=${{ matrix.python }} \
-D SYMFORCE_BUILD_BENCHMARKS=ON
cmake --build build -j $(nproc)
# - lcmtypes need to be available for tests
# - Exact contents of dev_requirements.txt depend on python version. Need to update file to
# match current python version to avoid failure of corresponding gen test. symforce needs
# to be on the PYTHONPATH to run gen test in this manner.
- name: Run tests
run: |
pip install build/lcmtypes/python2.7
export PYTHONPATH=$PYTHONPATH:$(pwd)
${{ matrix.python }} test/symforce_requirements_test.py --update
echo "Modifications made to requirements:"
git diff
EXIT_CODE=0
ctest --test-dir build -j $(nproc) || EXIT_CODE=$?
if [ $EXIT_CODE -ne 0 ]; then
ctest --test-dir build -j $(nproc) --rerun-failed --output-on-failure
fi
# Upload the docs as an artifact
# To view, download the `docs` artifact from the build and matrix entry you're interested in
# (probably any is good, assuming they all pass)
# Unzip to a directory and run `npx http-server` in that directory
- name: Upload Generated Docs
uses: actions/upload-artifact@v4
with:
name: docs ${{ matrix.os }}-${{ matrix.python }}-${{ matrix.compiler.C }}
path: build/docs