-
Notifications
You must be signed in to change notification settings - Fork 13
175 lines (159 loc) · 6.71 KB
/
macos-ci.yml
File metadata and controls
175 lines (159 loc) · 6.71 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: macOS 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: [macos-15-xcode-16.4]
build_type: [Debug, Release]
python_version: [3]
include:
- name: macos-15-xcode-16.4
os: macos-15
compiler: xcode
version: "16.4"
steps:
- name: Checkout GTDynamics Repository
uses: actions/checkout@v4
- name: Install System Dependencies
run: |
set -e
NTHREADS="$(sysctl -n hw.ncpu)"
echo "NTHREADS=${NTHREADS}" >> $GITHUB_ENV
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 osrf/simulation
# Refresh formula metadata on GitHub runners to avoid stale bottle mixes.
brew update
# Install sdformat and ensure its declared dependency closure is current.
brew install sdformat15
SDF_DEPS="$(brew deps --formula --1 sdformat15)"
OUTDATED_DEPS="$(brew outdated --formula ${SDF_DEPS} sdformat15 || true)"
if [ -n "${OUTDATED_DEPS}" ]; then
brew upgrade ${OUTDATED_DEPS}
fi
brew list --versions sdformat15 ${SDF_DEPS}
brew linkage --test sdformat15
# GTDynamics C++ tests use CppUnitLite (install it once per job).
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 }}
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
MARCH_NATIVE=ON
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 }} \
..
make -j${NTHREADS} install
if [ "${{ matrix.build_type }}" = "Release" ]; then
make -j${NTHREADS} python-install
fi
cd ${{ github.workspace }}
rm -rf /tmp/gtsam_source
- name: Create build directory
run: mkdir build
- name: Configure GTDynamics
shell: bash
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 }};$(brew --prefix)" \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
..
working-directory: ./build
- name: Build
run: make -j${NTHREADS}
working-directory: ./build
- name: Test C++
shell: bash
run: |
# Mirror the python-test linker settings: GTSAM is installed to a local prefix.
set -e
export DYLD_LIBRARY_PATH="${{ env.GTSAM_INSTALL_DIR }}/lib${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}"
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'
# For macOS, set DYLD_LIBRARY_PATH so the dynamic linker can find the installed GTSAM libraries.
# Also, ensure the venv is active for the context of running the tests.
shell: bash
run: |
set -e
source ${{ github.workspace }}/venv/bin/activate # Ensure venv Python and its site-packages are primary
export DYLD_LIBRARY_PATH="${{ env.GTSAM_INSTALL_DIR }}/lib${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}"
echo "DYLD_LIBRARY_PATH is set to: $DYLD_LIBRARY_PATH"
make -j${NTHREADS} python-test
working-directory: ./build