Skip to content

[SymForce] Add Unit3 to symforce_cc_sym_test #355

[SymForce] Add Unit3 to symforce_cc_sym_test

[SymForce] Add Unit3 to symforce_cc_sym_test #355

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]
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 14
- os: ubuntu-22.04
python: python3.10
compiler:
C: clang-14
CXX: clang++-14
package: clang-14
repos: []
steps:
- name: Checkout
uses: actions/checkout@v3
# - 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
- 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_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
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@v3
with:
name: docs ${{ matrix.os }}-${{ matrix.python }}-${{ matrix.compiler.C }}
path: build/docs