-
Notifications
You must be signed in to change notification settings - Fork 13
175 lines (159 loc) · 6.63 KB
/
linux-ci.yml
File metadata and controls
175 lines (159 loc) · 6.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
name: Linux CI
on: [pull_request]
# Cancels any in-progress workflow runs for the same PR when a new push is made,
# allowing the runner to become available more quickly for the latest changes.
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build:
name: ${{ matrix.name }} ${{ matrix.build_type }} (${{ matrix.build_type == 'Release' && 'native+py' || 'no-native C++-only' }})
runs-on: ${{ matrix.os }}
env:
CMAKE_BUILD_TYPE: ${{ matrix.build_type }}
PYTHON_VERSION: ${{ matrix.python_version }}
GTSAM_INSTALL_DIR: ${{ github.workspace }}/gtsam_install
strategy:
fail-fast: false
matrix:
name: [ubuntu-24.04-gcc-14, ubuntu-24.04-clang-16]
build_type: [Debug, Release]
python_version: [3]
include:
- name: ubuntu-24.04-gcc-14
os: ubuntu-24.04
compiler: gcc
version: "14"
- name: ubuntu-24.04-clang-16
os: ubuntu-24.04
compiler: clang
version: "16"
steps:
- name: Checkout GTDynamics Repository
uses: actions/checkout@v4
- name: Install System Dependencies
run: |
set -e
NTHREADS="$(nproc)"
echo "NTHREADS=${NTHREADS}" >> $GITHUB_ENV
sudo apt-get -y update
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 sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D2486D2DD83DB69272AFE98867170598AF249743
sudo apt-get -y update
sudo apt-get -y install libtbb-dev libboost-all-dev libsdformat15-dev
# GTDynamics C++ tests use CppUnitLite (not provided by default on the runner).
git clone https://github.com/borglab/CppUnitLite.git /tmp/CppUnitLite
cd /tmp/CppUnitLite
mkdir build && cd build
# CppUnitLite's CMakeLists uses an old minimum CMake version; newer CMake
# requires explicitly opting into older policy compatibility.
# Force a modern C++ standard for newer Boost headers (Homebrew Boost requires C++11+).
cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_STANDARD_REQUIRED=ON ..
sudo make -j${NTHREADS} install
cd ${{ github.workspace }}
sudo rm -rf /tmp/CppUnitLite
- name: Python Dependencies (Release only)
if: matrix.build_type == 'Release'
shell: bash
run: |
set -e
python${{ env.PYTHON_VERSION }} -m venv venv
source venv/bin/activate
echo "VENV_PYTHON_EXECUTABLE=${{ github.workspace }}/venv/bin/python" >> $GITHUB_ENV
echo "${{ github.workspace }}/venv/bin" >> $GITHUB_PATH
python -m pip install --upgrade pip
python -m pip install -U "setuptools<70" wheel numpy pyparsing pyyaml "pybind11-stubgen>=2.5.1"
- name: Build & Install GTSAM
shell: bash
run: |
set -e
git clone https://github.com/borglab/gtsam.git /tmp/gtsam_source
cd /tmp/gtsam_source
mkdir build && cd $_
if [ "${{ matrix.build_type }}" = "Release" ]; then
if [ "${{ matrix.compiler }}" = "gcc" ]; then
MARCH_NATIVE=OFF
else
MARCH_NATIVE=ON
fi
BUILD_PYTHON=ON
PYTHON_ARGS="-D PYTHON_EXECUTABLE=${{ env.VENV_PYTHON_EXECUTABLE }}"
else
MARCH_NATIVE=OFF
BUILD_PYTHON=OFF
PYTHON_ARGS=""
fi
cmake -D GTSAM_BUILD_EXAMPLES_ALWAYS=OFF \
-D GTSAM_BUILD_WITH_MARCH_NATIVE=${MARCH_NATIVE} \
-D GTSAM_BUILD_PYTHON=${BUILD_PYTHON} \
-D GTSAM_WITH_TBB=OFF \
-D CMAKE_CXX_FLAGS="-faligned-new" \
-D CMAKE_BUILD_TYPE=${{ matrix.build_type }} \
${PYTHON_ARGS} \
-D CMAKE_INSTALL_PREFIX=${{ env.GTSAM_INSTALL_DIR }} \
..
sudo make -j${NTHREADS} install
if [ "${{ matrix.build_type }}" = "Release" ]; then
make -j${NTHREADS} python-install
fi
sudo ldconfig
cd ${{ github.workspace }}
sudo rm -rf /tmp/gtsam_source
- name: Create build directory
run: mkdir build
- name: Configure GTDynamics
run: |
set -e
if [ "${{ matrix.build_type }}" = "Release" ]; then
BUILD_PYTHON=ON
PYTHON_ARGS="-DPYTHON_EXECUTABLE=${{ env.VENV_PYTHON_EXECUTABLE }}"
else
BUILD_PYTHON=OFF
PYTHON_ARGS=""
fi
cmake -DGTDYNAMICS_BUILD_PYTHON=${BUILD_PYTHON} \
${PYTHON_ARGS} \
-DGTSAM_DIR="${{ env.GTSAM_INSTALL_DIR }}/lib/cmake/GTSAM" \
-DCMAKE_PREFIX_PATH="${{ env.GTSAM_INSTALL_DIR }}" \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
..
working-directory: ./build
- name: Build
run: make -j${NTHREADS}
working-directory: ./build
- name: Test C++
run: |
set -e
if [ "${{ matrix.compiler }}" = "gcc" ]; then
export LD_LIBRARY_PATH="${{ env.GTSAM_INSTALL_DIR }}/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
if [ -d "${{ env.GTSAM_INSTALL_DIR }}/lib64" ]; then
export LD_LIBRARY_PATH="${{ env.GTSAM_INSTALL_DIR }}/lib64:$LD_LIBRARY_PATH"
fi
fi
make -j${NTHREADS} check
working-directory: ./build
- name: Install Python Wrappers (Release only)
shell: bash
if: matrix.build_type == 'Release'
run: |
set -e
make -j${NTHREADS} python-install
working-directory: ./build
- name: Test Python (Release only)
if: matrix.build_type == 'Release'
shell: bash
run: |
set -e
source ${{ github.workspace }}/venv/bin/activate
export LD_LIBRARY_PATH="${{ env.GTSAM_INSTALL_DIR }}/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
make -j${NTHREADS} python-test
working-directory: ./build