-
Notifications
You must be signed in to change notification settings - Fork 2
391 lines (335 loc) · 13.3 KB
/
ros.yml
File metadata and controls
391 lines (335 loc) · 13.3 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
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
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
################################################################################
# This workflow will do a clean install of project dependencies, build the
# source code and run tests.
################################################################################
name: OASIS ROS
# Controls when the action will run. Triggers the workflow on push or pull
# request events
on:
push:
pull_request:
schedule:
# Schedule the workflow to run at midnight on the first day of each month (UTC time)
- cron: '0 0 1 * *'
# A workflow run is made up of one or more jobs that can run sequentially or in
# parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
ros2_distro: kilted
# Steps represent a sequence of tasks that will be executed as part of the
# job
steps:
- name: Build environment information
run: 'echo "Matrix OS: ${{ matrix.os }} on $HOSTNAME with $(getconf _NPROCESSORS_ONLN) cores"'
# Check-out the repository under $GITHUB_WORKSPACE, so the job can
# access it
- name: Checkout main repo
uses: actions/checkout@v4
# Compute all cache hashes once
- name: Compute cache hashes
uses: actions/github-script@v7
with:
# Include messages with perception_cpp as keys can't be longer than
# 512 characters
script: |
async function hash(patterns) {
return await glob.hashFiles(patterns.join('\n'));
}
async function setHash(name, patterns) {
const value = await hash(patterns);
core.setOutput(name, value);
core.exportVariable(name, value);
}
await setHash('CMAKE_HASH', [
'oasis_tooling/scripts/*cmake.sh',
]);
await setHash('OPENCV_HASH', [
'oasis_tooling/config/opencv/**',
'oasis_tooling/scripts/*cv.sh',
]);
await setHash('ROS2_DESKTOP_HASH', [
'oasis_tooling/config/image_common/**',
'oasis_tooling/scripts/*ros2_desktop.sh',
]);
await setHash('OASIS_DEPENDS_HASH', [
'oasis_tooling/config/bgslibrary/**',
'oasis_tooling/config/camera_ros/**',
'oasis_tooling/config/depends.repos',
'oasis_tooling/config/i2cdevlib/**',
'oasis_tooling/config/libcamera_cmake/**',
'oasis_tooling/config/libcec/**',
'oasis_tooling/config/libfreenect2/**',
'oasis_tooling/config/OpenNI/**',
'oasis_tooling/config/ORB_SLAM_OASIS/**',
'oasis_tooling/config/p8-platform/**',
'oasis_tooling/config/pangolin/**',
'oasis_tooling/config/vision_opencv/**',
'oasis_tooling/scripts/*oasis_deps.sh',
]);
await setHash('MEDIAPIPE_HASH', [
'oasis_tooling/config/mediapipe/**',
'oasis_tooling/scripts/*mediapipe.sh',
]);
await setHash('ARDUINO_BOOTSTRAP_HASH', [
'oasis_avr/bootstrap.sh',
'oasis_avr/scripts/get_arduino_platform.sh',
]);
await setHash('OASIS_AVR_HASH', [
'oasis_avr/**',
]);
await setHash('OASIS_DRIVERS_CPP_HASH', [
'oasis_drivers_cpp/**',
]);
await setHash('OASIS_MESSAGES_HASH', [
'oasis_msgs/**',
]);
await setHash('OASIS_PERCEPTION_CPP_HASH', [
'oasis_msgs/**',
'oasis_perception_cpp/**',
]);
await setHash('OASIS_RUNTIME_HASH', [
'oasis_tooling/scripts/rdepinstall_oasis.sh',
]);
- name: Restore CMake
id: restore-cmake
if: matrix.os != 'macbook'
uses: actions/cache@v4
with:
path: |
ros-ws/cmake/install
key: >
restore-cmake-\
${{ matrix.os }}-\
${{ env.CMAKE_HASH }}
- name: Restore OpenCV
id: restore-opencv
uses: actions/cache@v4
with:
path: |
ros-ws/cv/install
key: >
restore-opencv-\
${{ matrix.os }}-\
${{ env.OPENCV_HASH }}-\
${{ env.CMAKE_HASH }}
- name: Restore ROS 2 Desktop
id: restore-ros2-desktop
uses: actions/cache@v4
with:
path: |
ros-ws/ros2-desktop-${{ matrix.ros2_distro }}/install
key: >
restore-ros2-desktop-\
${{ matrix.os }}-\
${{ matrix.ros2_distro }}-\
${{ env.ROS2_DESKTOP_HASH }}-\
${{ env.CMAKE_HASH }}
- name: Restore OASIS dependencies
id: restore-oasis-depends
uses: actions/cache@v4
with:
path: |
ros-ws/oasis-depends-${{ matrix.ros2_distro }}/install
key: >
restore-oasis-depends-\
${{ matrix.os }}-\
${{ matrix.ros2_distro }}-\
${{ env.OASIS_DEPENDS_HASH }}-\
${{ env.ROS2_DESKTOP_HASH }}-\
${{ env.OPENCV_HASH }}-\
${{ env.CMAKE_HASH }}
- name: Restore MediaPipe
id: restore-mediapipe
uses: actions/cache@v4
with:
path: |
ros-ws/abseil/install
ros-ws/mediapipe/install
key: >
restore-mediapipe-\
${{ matrix.os }}-\
${{ env.MEDIAPIPE_HASH }}-\
${{ env.OPENCV_HASH }}
- name: Restore Arduino IDE and CLI
id: restore-arduino-tools
uses: actions/cache@v4
with:
path: |
oasis_avr/arduino-*
ros-ws/arduino-*
~/.arduino15
key: >
restore-arduino-tools-\
${{ matrix.os }}-\
${{ env.ARDUINO_BOOTSTRAP_HASH }}
- name: Restore OASIS AVR
id: restore-oasis-avr
uses: actions/cache@v4
with:
path: |
ros-ws/oasis-${{ matrix.ros2_distro }}/install/share/**/oasis_avr
key: >
restore-oasis-avr-\
${{ matrix.os }}-\
${{ matrix.ros2_distro }}-\
${{ env.CMAKE_HASH }}-\
${{ env.ARDUINO_BOOTSTRAP_HASH }}-\
${{ env.OASIS_AVR_HASH }}
- name: Restore OASIS drivers_cpp
id: restore-oasis-drivers-cpp
uses: actions/cache@v4
with:
path: |
ros-ws/oasis-${{ matrix.ros2_distro }}/install/include/oasis_drivers_cpp
ros-ws/oasis-${{ matrix.ros2_distro }}/install/lib/oasis_drivers_cpp
ros-ws/oasis-${{ matrix.ros2_distro }}/install/share/**/oasis_drivers_cpp
key: >
restore-oasis-drivers-cpp-\
${{ matrix.os }}-\
${{ matrix.ros2_distro }}-\
${{ env.CMAKE_HASH }}-\
${{ env.ROS2_DESKTOP_HASH }}-\
${{ env.OASIS_DEPENDS_HASH }}-\
${{ env.OASIS_MESSAGES_HASH }}-\
${{ env.OASIS_DRIVERS_CPP_HASH }}
- name: Restore OASIS messages
id: restore-oasis-msgs
uses: actions/cache@v4
with:
path: |
ros-ws/oasis-${{ matrix.ros2_distro }}/install/include/oasis_msgs
ros-ws/oasis-${{ matrix.ros2_distro }}/install/lib/liboasis_msgs*
ros-ws/oasis-${{ matrix.ros2_distro }}/install/share/**/oasis_msgs
key: >
restore-oasis-msgs-\
${{ matrix.os }}-\
${{ matrix.ros2_distro }}-\
${{ env.CMAKE_HASH }}-\
${{ env.ROS2_DESKTOP_HASH }}-\
${{ env.OASIS_MESSAGES_HASH }}
- name: Restore OASIS perception_cpp
id: restore-oasis-perception-cpp
uses: actions/cache@v4
with:
path: |
ros-ws/oasis-${{ matrix.ros2_distro }}/install/include/oasis_perception_cpp
ros-ws/oasis-${{ matrix.ros2_distro }}/install/lib/oasis_perception_cpp
ros-ws/oasis-${{ matrix.ros2_distro }}/install/share/**/oasis_perception_cpp
key: >
restore-oasis-perception-cpp-\
${{ matrix.os }}-\
${{ matrix.ros2_distro }}-\
${{ env.CMAKE_HASH }}-\
${{ env.OPENCV_HASH }}-\
${{ env.MEDIAPIPE_HASH }}-\
${{ env.ROS2_DESKTOP_HASH }}-\
${{ env.OASIS_DEPENDS_HASH }}-\
${{ env.OASIS_PERCEPTION_CPP_HASH }}
- name: Restore OASIS runtime dependencies
id: restore-oasis-runtime
uses: actions/cache@v4
with:
path: |
ros-ws/oasis-${{ matrix.ros2_distro }}/install/share/oasis_tooling/package.xml
key: >
restore-oasis-runtime-\
${{ matrix.os }}-\
${{ env.OASIS_RUNTIME_HASH }}
- name: Install CMake dependencies
if: steps.restore-cmake.outputs.cache-hit != 'true'
run: ./oasis_tooling/scripts/depinstall_cmake.sh
- name: Build CMake
if: steps.restore-cmake.outputs.cache-hit != 'true'
run: ./oasis_tooling/scripts/build_cmake.sh
- name: Install OpenCV dependencies
if: steps.restore-opencv.outputs.cache-hit != 'true'
run: ./oasis_tooling/scripts/depinstall_cv.sh
- name: Build OpenCV
if: steps.restore-opencv.outputs.cache-hit != 'true'
run: ./oasis_tooling/scripts/build_cv.sh
- name: Install ROS 2 Desktop dependencies
if: steps.restore-ros2-desktop.outputs.cache-hit != 'true'
run: ./oasis_tooling/scripts/depinstall_ros2_desktop.sh
- name: Build ROS 2 Desktop
if: steps.restore-ros2-desktop.outputs.cache-hit != 'true'
run: ./oasis_tooling/scripts/build_ros2_desktop.sh
- name: Install OASIS dependency rosdeps
if: steps.restore-oasis-depends.outputs.cache-hit != 'true'
run: ./oasis_tooling/scripts/depinstall_oasis_deps.sh
- name: Build OASIS dependencies
if: steps.restore-oasis-depends.outputs.cache-hit != 'true'
run: ./oasis_tooling/scripts/build_oasis_deps.sh
- name: Install MediaPipe dependencies
if: steps.restore-mediapipe.outputs.cache-hit != 'true'
run: ./oasis_tooling/scripts/depinstall_mediapipe.sh
- name: Build MediaPipe
if: steps.restore-mediapipe.outputs.cache-hit != 'true'
run: ./oasis_tooling/scripts/build_mediapipe.sh
- name: Mark cached packages as skipped
run: |
set -euo pipefail
if [ "${{ steps.restore-oasis-avr.outputs.cache-hit }}" = 'true' ]; then
echo "Marking oasis_avr as ignored (cache hit detected)"
touch "oasis_avr/COLCON_IGNORE"
fi
if [ "${{ steps.restore-oasis-drivers-cpp.outputs.cache-hit }}" = 'true' ]; then
echo "Marking oasis_drivers_cpp as ignored (cache hit detected)"
touch "oasis_drivers_cpp/COLCON_IGNORE"
fi
if [ "${{ steps.restore-oasis-perception-cpp.outputs.cache-hit }}" = 'true' ]; then
echo "Marking oasis_perception_cpp as ignored (cache hit detected)"
touch "oasis_perception_cpp/COLCON_IGNORE"
fi
- name: Install OASIS rosdeps
run: ./oasis_tooling/scripts/depinstall_oasis.sh
- name: colcon build
run: |
set -euo pipefail
args=()
if [ "${{ steps.restore-oasis-avr.outputs.cache-hit }}" = 'true' ]; then
echo "Skipping oasis_avr build (cache hit detected)"
args+=(--skip-avr)
fi
if [ "${{ steps.restore-oasis-drivers-cpp.outputs.cache-hit }}" = 'true' ]; then
echo "Skipping oasis_drivers_cpp build (cache hit detected)"
args+=(--skip-drivers-cpp)
fi
if [ "${{ steps.restore-oasis-msgs.outputs.cache-hit }}" = 'true' ]; then
echo "Skipping oasis_msgs build (cache hit detected)"
args+=(--skip-messages)
fi
if [ "${{ steps.restore-oasis-perception-cpp.outputs.cache-hit }}" = 'true' ]; then
echo "Skipping oasis_perception_cpp build (cache hit detected)"
args+=(--skip-perception-cpp)
fi
if [ ${#args[@]} -eq 0 ]; then
echo "No packages skipped; performing full build."
./oasis_tooling/scripts/build_oasis.sh
else
echo "Running build with skipped packages: ${args[*]}"
./oasis_tooling/scripts/build_oasis.sh "${args[@]}"
fi
- name: Install OASIS files
run: ./oasis_tooling/scripts/install_oasis.sh
- name: Install OASIS runtime dependencies
if: steps.restore-oasis-runtime.outputs.cache-hit != 'true'
run: ./oasis_tooling/scripts/rdepinstall_oasis.sh
#- name: Upload Ardino hex to /dev/ttyACM0
# if: matrix.os == 'cinder'
# run: |
# ./oasis_avr/scripts/reset_leonardo.py /dev/ttyACM0
# sleep 2
# source oasis_tooling/scripts/env_ros2_desktop.sh && cmake --build "build/oasis_avr" --target upload -- TARGET=firmata_node SERIAL_PORT=/dev/ttyACM0
# sleep 2
#- name: Test Ardino
# if: matrix.os == 'cinder'
# run: |
# source install/setup.bash && ros2 run oasis_drivers_py firmata_test