Skip to content

[SymForce] Fix CI on new compilers #486

[SymForce] Fix CI on new compilers

[SymForce] Fix CI on new compilers #486

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-24.04]
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
compiler:
# Newest gcc on 24.04
- C: gcc-14
CXX: g++-14
package: g++-14
# -Wdangling-reference was added to the warnings list in gcc 13, and has false positives
# in fmtlib, so we exclude it. array-bounds similarly has false positives in Eigen on
# gcc 12+.
warning_options: "-Wall;-Wextra;-Wno-dangling-reference;-Wno-array-bounds;-Werror"
include:
# gcc 9 (Oldest gcc available on Ubuntu 22.04)
- os: ubuntu-22.04
python: "3.8"
compiler:
C: gcc-9
CXX: g++-9
package: g++-9
warning_options: "-Wall;-Wextra;-Werror"
# gcc 14 (Newest gcc available on Ubuntu 24.04)
- os: ubuntu-24.04
python: "3.12"
compiler:
C: gcc-14
CXX: g++-14
package: g++-14
warning_options: "-Wall;-Wextra;-Wno-dangling-reference;-Wno-array-bounds;-Werror"
# Clang 11 (Oldest clang available on Ubuntu 22.04)
- os: ubuntu-22.04
python: "3.8"
compiler:
C: clang-11
CXX: clang++-11
package: clang-11
repos: []
warning_options: "-Wall;-Wextra;-Werror"
# Clang 19 (Newest clang available on Ubuntu 24.04)
- os: ubuntu-24.04
python: "3.12"
compiler:
C: clang-19
CXX: clang++-19
package: clang-19
repos: []
warning_options: "-Wall;-Wextra;-Werror"
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 }}
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install general build dependencies
run: |
sudo apt-get install -y \
doxygen \
libgmp-dev \
pandoc
- name: Install rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > installer.sh
chmod +x installer.sh
./installer.sh -y
# 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 == '3.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=${{ matrix.compiler.warning_options }}" \
-D SYMFORCE_PYTHON_OVERRIDE=python${{ 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)
python${{ 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 }}-python${{ matrix.python }}-${{ matrix.compiler.C }}
path: build/docs