-
Notifications
You must be signed in to change notification settings - Fork 105
236 lines (218 loc) · 10.7 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
name: CI Workflow
on:
push:
branches:
- master
- devel
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
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 * * *'
workflow_dispatch:
jobs:
build:
name: '[${{ matrix.os }}@${{ matrix.build_type }}@BUILD_SHARED_LIBS:${{ matrix.build_shared_libs }}]'
runs-on: ${{ matrix.os }}
strategy:
matrix:
build_type: [Release]
os: [ubuntu-latest, windows-latest]
build_shared_libs: [ON, OFF]
steps:
- name: Checkout the code
uses: actions/checkout@main
- name: Environment Variables
shell: bash
run: env
# Remove apt repos that are known to break from time to time
# See https://github.com/actions/virtual-environments/issues/323
- name: Remove broken apt repos [Ubuntu]
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done
# ============
# DEPENDENCIES
# ============
- name: Dependencies [Windows]
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
$response = gh api --paginate -H "Accept: application/vnd.github.v3+json" /repos/robotology/robotology-superbuild-dependencies-vcpkg/releases/latest
$latest_tag = ($response | ConvertFrom-Json).tag_name
echo "Installing robotology-superbuild-dependencies-vcpkg@$latest_tag"
iwr -Uri https://github.com/robotology/robotology-superbuild-dependencies-vcpkg/releases/download/$latest_tag/vcpkg-robotology.zip -OutFile C:/vcpkg-robotology.zip
7z x C:/vcpkg-robotology.zip -oC:/
"VCPKG_INSTALLATION_ROOT=C:/robotology/vcpkg" >> $env:GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Dependencies [Ubuntu]
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
sudo apt update
sudo apt install -y git build-essential cmake libace-dev coinor-libipopt-dev libeigen3-dev libopencv-dev qtbase5-dev \
qtdeclarative5-dev qtmultimedia5-dev libtinyxml-dev libgsl-dev libpython3-dev swig
- name: Determine YCM and YARP required versions
shell: bash
run: |
grep -m 1 YCM_REQUIRED_VERSION CMakeLists.txt | sed "s/[^0-9.]//g" > YCM_VERSION.txt
grep -m 1 YARP_REQUIRED_VERSION CMakeLists.txt | sed "s/[^0-9.]//g" > YARP_VERSION.txt
cat YARP_VERSION.txt | awk -F '.' '{ print $1 }' > YARP_VERSION_MAJOR.txt
cat YARP_VERSION.txt | awk -F '.' '{ print $2 }' > YARP_VERSION_MINOR.txt
echo "ycm_version=$(cat YCM_VERSION.txt)" >> $GITHUB_ENV
echo "yarp_branch=yarp-$(cat YARP_VERSION_MAJOR.txt).$(cat YARP_VERSION_MINOR.txt)" >> $GITHUB_ENV
- name: Determine icub-firmware-shared required branch
shell: bash
run: |
grep -m 1 icub_firmware_shared_VERSION conf/iCubFindDependencies.cmake | sed "s/[^0-9.]//g" > icub_firmware_shared_VERSION.txt
gh --repo robotology/icub-firmware-shared release list > icub_firmware_shared_RELEASES.txt
if grep -q $(cat icub_firmware_shared_VERSION.txt) icub_firmware_shared_RELEASES.txt; then
echo "icub_firmware_shared_branch=v$(cat icub_firmware_shared_VERSION.txt)" >> $GITHUB_ENV
elif [[ "${{ github.event_name }}" == "schedule" || "${{ github.ref }}" == "refs/heads/master" || "${{ github.base_ref }}" == "master" || "${{ github.head_ref }}" == "master" ]]; then
echo "icub_firmware_shared_branch=master" >> $GITHUB_ENV
else
echo "icub_firmware_shared_branch=devel" >> $GITHUB_ENV
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Source-based Dependencies [Windows]
if: matrix.os == 'windows-latest'
shell: bash
run: |
# YCM
cd ${GITHUB_WORKSPACE}
git clone https://github.com/robotology/ycm.git --depth 1 --branch v${{ env.ycm_version }}
cd ycm && mkdir -p build && cd build
cmake -A x64 -DCMAKE_TOOLCHAIN_FILE=${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install ..
cmake --build . --config ${{ matrix.build_type }} --target INSTALL
# YARP
cd ${GITHUB_WORKSPACE}
git clone https://github.com/robotology/yarp.git --depth 1 --branch ${{ env.yarp_branch }}
cd yarp && mkdir -p build && cd build
cmake -A x64 -DCMAKE_TOOLCHAIN_FILE=${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake -DYARP_COMPILE_GUIS:BOOL=OFF \
-DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install ..
cmake --build . --config ${{ matrix.build_type }} --target INSTALL
# icub-firmware-shared
cd ${GITHUB_WORKSPACE}
git clone https://github.com/robotology/icub-firmware-shared.git --depth 1 --branch ${{ env.icub_firmware_shared_branch }}
cd icub-firmware-shared && mkdir -p build && cd build
cmake -A x64 -DCMAKE_TOOLCHAIN_FILE=${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake \
-DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install ..
cmake --build . --config ${{ matrix.build_type }} --target INSTALL
- name: Source-based Dependencies [Ubuntu]
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
# YCM
cd ${GITHUB_WORKSPACE}
git clone https://github.com/robotology/ycm.git --depth 1 --branch v${{ env.ycm_version }}
cd ycm && mkdir -p build && cd build
cmake -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install ..
cmake --build . --config ${{ matrix.build_type }} --target install
# YARP
cd ${GITHUB_WORKSPACE}
git clone https://github.com/robotology/yarp.git --depth 1 --branch ${{ env.yarp_branch }}
cd yarp && mkdir -p build && cd build
cmake -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install -DYARP_COMPILE_GUIS:BOOL=OFF ..
cmake --build . --config ${{ matrix.build_type }} --target install
# icub-firmware-shared
cd ${GITHUB_WORKSPACE}
git clone https://github.com/robotology/icub-firmware-shared.git --depth 1 --branch ${{ env.icub_firmware_shared_branch }}
cd icub-firmware-shared && mkdir -p build && cd build
cmake -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install ..
cmake --build . --config ${{ matrix.build_type }} --target install
# ===================
# CMAKE-BASED PROJECT
# ===================
- name: Configure [Windows]
# Use bash also on Windows (otherwise cd, mkdir, ... do not work)
if: matrix.os == 'windows-latest'
shell: bash
run: |
mkdir -p build
cd build
cmake -A x64 -DCMAKE_TOOLCHAIN_FILE=${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake \
-DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install \
-DBUILD_SHARED_LIBS:BOOL=${{ matrix.build_shared_libs }} \
-DICUB_USE_icub_firmware_shared:BOOL=ON \
-DENABLE_icubmod_skinWrapper:BOOL=ON \
-DENABLE_icubmod_sharedcan:BOOL=ON \
-DENABLE_icubmod_bcbBattery:BOOL=ON \
-DENABLE_icubmod_canmotioncontrol:BOOL=ON \
-DENABLE_icubmod_canBusAnalogSensor:BOOL=ON \
-DENABLE_icubmod_canBusInertialMTB:BOOL=ON \
-DENABLE_icubmod_canBusSkin:BOOL=ON \
-DENABLE_icubmod_canBusVirtualAnalogSensor:BOOL=ON \
-DENABLE_icubmod_embObjFTsensor:BOOL=ON \
-DENABLE_icubmod_embObjIMU:BOOL=ON \
-DENABLE_icubmod_embObjInertials:BOOL=ON \
-DENABLE_icubmod_embObjMais:BOOL=ON \
-DENABLE_icubmod_embObjMotionControl:BOOL=ON \
-DENABLE_icubmod_embObjBattery:BOOL=ON \
-DENABLE_icubmod_embObjSkin:BOOL=ON \
-DENABLE_icubmod_embObjMultipleFTsensors:BOOL=ON \
-DENABLE_icubmod_parametricCalibrator:BOOL=ON \
-DENABLE_icubmod_parametricCalibratorEth:BOOL=ON \
-DBUILD_TESTING:BOOL=ON \
-DICUB_SHARED_LIBRARY=OFF \
-DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install ..
- name: Configure [Ubuntu]
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
mkdir -p build
cd build
cmake -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install \
-DBUILD_SHARED_LIBS:BOOL=${{ matrix.build_shared_libs }} \
-DICUB_USE_icub_firmware_shared:BOOL=ON \
-DENABLE_icubmod_skinWrapper:BOOL=ON \
-DENABLE_icubmod_sharedcan:BOOL=ON \
-DENABLE_icubmod_canmotioncontrol:BOOL=ON \
-DENABLE_icubmod_canBusAnalogSensor:BOOL=ON \
-DENABLE_icubmod_canBusInertialMTB:BOOL=ON \
-DENABLE_icubmod_canBusSkin:BOOL=ON \
-DENABLE_icubmod_canBusVirtualAnalogSensor:BOOL=ON \
-DENABLE_icubmod_embObjFTsensor:BOOL=ON \
-DENABLE_icubmod_embObjIMU:BOOL=ON \
-DENABLE_icubmod_embObjInertials:BOOL=ON \
-DENABLE_icubmod_embObjMais:BOOL=ON \
-DENABLE_icubmod_embObjMotionControl:BOOL=ON \
-DENABLE_icubmod_embObjBattery:BOOL=ON \
-DENABLE_icubmod_embObjSkin:BOOL=ON \
-DENABLE_icubmod_embObjMultipleFTsensors:BOOL=ON \
-DENABLE_icubmod_parametricCalibrator:BOOL=ON \
-DENABLE_icubmod_parametricCalibratorEth:BOOL=ON \
-DBUILD_TESTING:BOOL=ON \
-DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install ..
- name: Enable python bindings on Ubuntu
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
cd build
# Enable ICUB_COMPILE_BINDINGS in Ubuntu
cmake -DICUB_COMPILE_BINDINGS:BOOL=ON -DCREATE_PYTHON:BOOL=ON .
- name: Extend Path
shell: bash
run: |
echo "${{ github.workspace }}/install/bin" >> $GITHUB_PATH
echo "${{ github.workspace }}/install/lib/yarp" >> $GITHUB_PATH
# Fix for using YARP idl generators (that link ACE) in Windows (https://github.com/robotology/idyntree/issues/569)
echo "${VCPKG_INSTALLATION_ROOT}/installed/x64-windows/bin" >> $GITHUB_PATH
- name: Build
shell: bash
run: |
cd build
cmake --build . --config ${{ matrix.build_type }}
- name: Install
shell: bash
run: |
cd build
cmake --build . --config ${{ matrix.build_type }} --target install
- name: Test
shell: bash
run: |
cd build
ctest run_unit_test --output-on-failure -C ${{ matrix.build_type }} .