-
Notifications
You must be signed in to change notification settings - Fork 68
285 lines (248 loc) · 11.3 KB
/
ci.yml
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
name: CI Workflow
on:
push:
pull_request:
schedule:
# * is a special character in YAML so you have to quote this string
# Execute a "nightly" build at 2 AM UTC
- cron: '0 2 * * *'
env:
YCM_TAG: v0.15.1
YARP_TAG: v3.8.0
ICUB_TAG: v2.1.1
jobs:
build-with-conda-dependencies:
name: '[conda:${{ matrix.os }}]'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
build_type: [Release]
os: [ubuntu-20.04, macos-13, windows-2019]
steps:
- uses: actions/checkout@v3
- name: Print used environment (no conda) [Conda]
shell: bash
run: |
env
- name: Get current week
id: week
run: echo "week=$(date +%Y-%U)" >> "${GITHUB_OUTPUT}"
- uses: mamba-org/setup-micromamba@v1
with:
environment-file: ci_env.yml
cache-environment-key: environment-${{ steps.week.outputs.week }}
- name: Install files to enable compilation of mex files [Conda/Linux]
if: contains(matrix.os, 'ubuntu')
run: |
curl -L -O https://github.com/robotology/robotology-vcpkg-ports/releases/download/storage/msdk_R2020b_mexa64.zip
unzip msdk_R2020b_mexa64.zip
rm msdk_R2020b_mexa64.zip
echo "GHA_Matlab_ROOT_DIR=${GITHUB_WORKSPACE}/msdk_R2020b_mexa64" >> $GITHUB_ENV
echo "GHA_Matlab_MEX_EXTENSION=mexa64" >> $GITHUB_ENV
- name: Install files to enable compilation of mex files [Conda/macOS]
if: contains(matrix.os, 'macos')
run: |
curl -L -O https://github.com/robotology/robotology-vcpkg-ports/releases/download/storage/msdk_R2020a_mexmaci64.zip
unzip msdk_R2020a_mexmaci64.zip
rm msdk_R2020a_mexmaci64.zip
echo "GHA_Matlab_ROOT_DIR=${GITHUB_WORKSPACE}/msdk_R2020a_mexmaci64" >> $GITHUB_ENV
echo "GHA_Matlab_MEX_EXTENSION=mexmaci64" >> $GITHUB_ENV
- name: Install files to enable compilation of mex files [Conda/Windows]
if: contains(matrix.os, 'windows')
shell: bash
run: |
curl -L -O https://github.com/robotology/robotology-vcpkg-ports/releases/download/storage/msdk_R2020a_mexw64.zip
unzip msdk_R2020a_mexw64.zip
rm msdk_R2020a_mexw64.zip
echo "GHA_Matlab_ROOT_DIR=${GITHUB_WORKSPACE}/msdk_R2020a_mexw64" >> $GITHUB_ENV
echo "GHA_Matlab_MEX_EXTENSION=mexw64" >> $GITHUB_ENV
- name: Configure VS Toolchain (Windows)
if: contains(matrix.os, 'windows')
uses: ilammy/[email protected]
- name: Setup compilation env variables [Conda/Windows]
if: contains(matrix.os, 'windows')
shell: bash -l {0}
run: |
bash_vc_install=${VCToolsInstallDir//\\//}
compiler_path=${bash_vc_install}bin/Hostx64/x64/cl.exe
echo "CC=${compiler_path}" >> $GITHUB_ENV
echo "CXX=${compiler_path}" >> $GITHUB_ENV
echo "CONDA_CXX_LIBRARIES_INSTALL_PREFIX=${CONDA_PREFIX}\Library" >> $GITHUB_ENV
# Visualizer tests excluded as a workaround for https://github.com/robotology/idyntree/issues/808
# Python tests excluded as a workaround for https://github.com/robotology/idyntree/issues/939
# InverseKinematics tests are excluded as a workaround for https://github.com/robotology/idyntree/issues/1019
# ConsistencyTestiKin tests are excluded as a workaround for https://github.com/robotology/idyntree/issues/1029
echo "IDYNTREE_TEST_TO_SKIP=Visualizer|matlab|Python|pybind|InverseKinematics|ConsistencyTestiKin" >> $GITHUB_ENV
- name: Setup compilation env variables [Conda/Linux&macOS]
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')
shell: bash -l {0}
run: |
echo "CONDA_CXX_LIBRARIES_INSTALL_PREFIX=${CONDA_PREFIX}" >> $GITHUB_ENV
# Visualizer tests excluded as a workaround for https://github.com/robotology/idyntree/issues/808
echo "IDYNTREE_TEST_TO_SKIP=Visualizer|matlab" >> $GITHUB_ENV
# Additional dependencies useful only on Linux
- name: Dependencies [Conda/Linux]
if: contains(matrix.os, 'ubuntu')
shell: bash -l {0}
run: |
# Additional dependencies only useful on Linux
micromamba install xorg-xorgproto libgl-devel
- name: Print used environment [Conda]
shell: bash -l {0}
run: |
micromamba list
env
- name: Configure [Conda]
shell: bash -l {0}
run: |
mkdir build
cd build
cmake -GNinja -DCMAKE_INSTALL_PREFIX=${CONDA_CXX_LIBRARIES_INSTALL_PREFIX} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DMATLAB_FIND_DEBUG:BOOL=ON -DIDYNTREE_USES_MATLAB:BOOL=ON -DMatlab_ROOT_DIR=${GHA_Matlab_ROOT_DIR} -DMatlab_MEX_EXTENSION:STRING=${GHA_Matlab_MEX_EXTENSION} -DIDYNTREE_DISABLE_MATLAB_TESTS:BOOL=ON -DBUILD_TESTING:BOOL=ON -DIDYNTREE_USES_ASSIMP:BOOL=ON -DIDYNTREE_USES_IPOPT:BOOL=ON -DIDYNTREE_USES_IRRLICHT:BOOL=ON -DIDYNTREE_USES_YARP:BOOL=ON -DIDYNTREE_USES_ICUB_MAIN:BOOL=ON -DIDYNTREE_USES_OSQPEIGEN:BOOL=ON -DIDYNTREE_USES_PYTHON:BOOL=ON -DIDYNTREE_USES_PYTHON_PYBIND11:BOOL=ON ..
- name: Build [Conda]
shell: bash -l {0}
run: |
cd build
cmake --build . --config ${{ matrix.build_type }}
- name: Inspect libraries linked by iDynTreeMEX.mexa64 [Conda/Linux]
if: contains(matrix.os, 'ubuntu')
shell: bash -l {0}
run: |
cd build
ldd ./lib/iDynTreeMEX.mexa64
- name: Test [Conda]
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')
shell: bash -l {0}
run: |
cd build
ctest --output-on-failure -C ${{ matrix.build_type }} -E "${IDYNTREE_TEST_TO_SKIP}" .
- name: Install [Conda]
shell: bash -l {0}
run: |
cd build
cmake --install . --config ${{ matrix.build_type }}
- name: Test standalone installation of MATLAB bindings [Conda]
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')
shell: bash -l {0}
run: |
cd bindings
mkdir build
cd build
cmake -GNinja -DCMAKE_INSTALL_PREFIX=${CONDA_CXX_LIBRARIES_INSTALL_PREFIX}/idyntree_bindings_install_test -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DMATLAB_FIND_DEBUG:BOOL=ON -DIDYNTREE_USES_MATLAB:BOOL=ON -DMatlab_ROOT_DIR=${GHA_Matlab_ROOT_DIR} -DMatlab_MEX_EXTENSION:STRING=${GHA_Matlab_MEX_EXTENSION} -DIDYNTREE_DISABLE_MATLAB_TESTS:BOOL=ON ..
cmake --build . --config ${{ matrix.build_type }}
cmake --install . --config ${{ matrix.build_type }}
build-with-apt-dependencies:
name: '[apt:${{ matrix.docker_image }}@${{ matrix.build_type }}]'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
build_type: [Release]
os:
- ubuntu-latest
docker_image:
- "ubuntu:20.04"
- "ubuntu:22.04"
container:
image: ${{ matrix.docker_image }}
steps:
- uses: actions/checkout@v3
- name: Dependencies [apt]
run: |
# See https://stackoverflow.com/questions/44331836/apt-get-install-tzdata-noninteractive,
# only required by Ubuntu 20.04
export DEBIAN_FRONTEND=noninteractive
apt-get -y update
apt-get -y install \
git build-essential cmake libace-dev coinor-libipopt-dev libeigen3-dev swig \
libxml2-dev liboctave-dev python3-dev python3-numpy valgrind libassimp-dev libirrlicht-dev curl unzip libglfw3-dev
- name: Install files to enable compilation of mex files [apt]
run: |
curl -L -O https://github.com/robotology/robotology-vcpkg-ports/releases/download/storage/msdk_R2020b_mexa64.zip
unzip msdk_R2020b_mexa64.zip
rm msdk_R2020b_mexa64.zip
echo "GHA_Matlab_ROOT_DIR=${GITHUB_WORKSPACE}/msdk_R2020b_mexa64" >> $GITHUB_ENV
echo "GHA_Matlab_MEX_EXTENSION=mexa64" >> $GITHUB_ENV
# Print environment variables to simplify development and debugging
- name: Environment Variables
shell: bash
run: env
- name: Cache Source-based Dependencies
id: cache-source-deps
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/install/deps
key: source-deps-${{ matrix.docker_image }}-ycm-${{ env.YCM_TAG }}-yarp-${{ env.YARP_TAG }}-icub-${{ env.ICUB_TAG }}
- name: Source-based Dependencies [apt]
if: steps.cache-source-deps.outputs.cache-hit != 'true' && contains(matrix.os, 'ubuntu')
shell: bash
run: |
# YCM
git clone -b ${YCM_TAG} https://github.com/robotology/ycm
cd ycm
mkdir -p build
cd build
cmake -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install/deps ..
cmake --build . --config ${{ matrix.build_type }} --target install
# YARP
git clone -b ${YARP_TAG} https://github.com/robotology/yarp
cd yarp
mkdir -p build
cd build
cmake -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install/deps -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install/deps ..
cmake --build . --config ${{ matrix.build_type }} --target install
# ICUB
git clone -b ${ICUB_TAG} https://github.com/robotology/icub-main
cd icub-main
mkdir -p build
cd build
cmake -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install/deps -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install/deps ..
cmake --build . --config ${{ matrix.build_type }} --target install
# ===================
# CMAKE-BASED PROJECT
# ===================
- name: Configure [apt]
shell: bash
run: |
mkdir -p build
cd build
cmake -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install/deps -DBUILD_TESTING:BOOL=ON -DIDYNTREE_USES_YARP:BOOL=ON \
-DIDYNTREE_USES_ICUB_MAIN:BOOL=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DIDYNTREE_USES_ASSIMP:BOOL=ON \
-DIDYNTREE_USES_MATLAB:BOOL=ON -DMatlab_ROOT_DIR=${GHA_Matlab_ROOT_DIR} -DMatlab_MEX_EXTENSION:STRING=${GHA_Matlab_MEX_EXTENSION} -DIDYNTREE_DISABLE_MATLAB_TESTS:BOOL=ON \
-DIDYNTREE_USES_IPOPT:BOOL=ON -DIDYNTREE_USES_PYTHON:BOOL=ON -DIDYNTREE_RUN_VALGRIND_TESTS:BOOL=ON -DIDYNTREE_USES_OCTAVE:BOOL=ON -DIDYNTREE_USES_IRRLICHT:BOOL=ON -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install ..
- name: Build
shell: bash
run: |
cd build
cmake --build . --config ${{ matrix.build_type }}
- name: Test
shell: bash
run: |
cd build
# Visualizer tests excluded as a workaround for https://github.com/robotology/idyntree/issues/808
ctest --output-on-failure -C ${{ matrix.build_type }} -E "Visualizer|matlab" .
- name: Install [apt]
shell: bash
run: |
cd build
cmake --build . --config ${{ matrix.build_type }} --target install
- name: Compile Examples [apt]
shell: bash
run: |
cd examples
mkdir -p build
cd build
cmake -DCMAKE_PREFIX_PATH="${GITHUB_WORKSPACE}/install/deps;${GITHUB_WORKSPACE}/install" ..
cmake --build . --config ${{ matrix.build_type }}
- name: Check build if some dependencies are not enabled [apt]
shell: bash
run: |
cd build
for missing_dep in ASSIMP IPOPT; do
echo "Testing ${missing_dep} as missing dependency."
# Deselect missing dependency and build
cmake -DIDYNTREE_USES_${missing_dep}:BOOL=OFF .
cmake --build . --config ${{ matrix.build_type }}
# Enable again dependency
cmake -DIDYNTREE_USES_${missing_dep}:BOOL=ON .
done