-
Notifications
You must be signed in to change notification settings - Fork 30
386 lines (332 loc) · 11.7 KB
/
Copy pathci.yml
File metadata and controls
386 lines (332 loc) · 11.7 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
name: CI
on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
build-and-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- ros_distro: humble
os_image: ubuntu:jammy
- ros_distro: lyrical
os_image: ubuntu:resolute
container:
image: ${{ matrix.os_image }}
timeout-minutes: 60
defaults:
run:
shell: bash
steps:
- name: Install Git
run: |
apt-get update
apt-get install -y git
- name: Checkout repository
uses: actions/checkout@v4
- name: Pre-install ROS 2 apt source
uses: ./.github/actions/ros-apt-source
- name: Set up ROS 2 ${{ matrix.ros_distro }}
uses: ros-tooling/setup-ros@v0.7
with:
required-ros-distributions: ${{ matrix.ros_distro }}
- name: Install ccache
run: apt-get install -y ccache
- name: Cache ccache
uses: actions/cache@v4
with:
path: /root/.cache/ccache
key: ccache-${{ matrix.ros_distro }}-${{ github.sha }}
restore-keys: |
ccache-${{ matrix.ros_distro }}-
- name: Install dependencies
run: |
apt-get update
apt-get install -y ros-${{ matrix.ros_distro }}-test-msgs
if [ "${{ matrix.ros_distro }}" = "humble" ]; then
apt-get install -y ros-humble-rmw-cyclonedds-cpp
fi
source /opt/ros/${{ matrix.ros_distro }}/setup.bash
rosdep update
# Linters (clang-tidy / clang-format) only run in the Jazzy quality
# job (quality.yml). Multiple package.xml files still list them as
# <test_depend>, so we skip the rosdep keys here to keep build-and-
# test runners from pulling in linter packages they never use. Also
# defensive against transient binary-deb gaps on newly-released
# distros.
rosdep install --from-paths src --ignore-src -y \
--skip-keys "ament_cmake_clang_tidy ament_cmake_clang_format"
- name: Build packages
env:
CCACHE_DIR: /root/.cache/ccache
CCACHE_MAXSIZE: 500M
CCACHE_SLOPPINESS: pch_defines,time_macros
run: |
source /opt/ros/${{ matrix.ros_distro }}/setup.bash
colcon build --symlink-install \
--packages-skip ros2_medkit_opcua \
--cmake-args -DCMAKE_BUILD_TYPE=Release \
--event-handlers console_direct+
ccache -s
- name: Run unit and integration tests
timeout-minutes: 15
env:
# FastRTPS 2.6 on Humble has a known use-after-free in the
# discovery-teardown path (EDP::unpairWriterProxy) that segfaults
# peer nodes when the gateway shuts down, so we force CycloneDDS
# there. Lyrical ships a newer FastRTPS without that bug and hits
# a separate iceoryx-shared-memory crash under CycloneDDS during
# shutdown ("string capacity was zero for allocated data"), so on
# Lyrical we keep the default FastRTPS. (Jazzy still uses
# CycloneDDS - see jazzy-test job below for its rationale.)
RMW_IMPLEMENTATION: ${{ matrix.ros_distro == 'humble' && 'rmw_cyclonedds_cpp' || '' }}
run: |
source /opt/ros/${{ matrix.ros_distro }}/setup.bash
colcon test --return-code-on-test-failure \
--packages-skip ros2_medkit_opcua \
--ctest-args -LE linter \
--event-handlers console_direct+
- name: Show test results
if: always()
run: colcon test-result --verbose
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.ros_distro }}
path: |
log/
build/*/test_results/
jazzy-build:
runs-on: ubuntu-latest
container:
image: ubuntu:noble
timeout-minutes: 60
defaults:
run:
shell: bash
steps:
- name: Install Git
run: |
apt-get update
apt-get install -y git
- name: Checkout repository
uses: actions/checkout@v4
- name: Pre-install ROS 2 apt source
uses: ./.github/actions/ros-apt-source
- name: Set up ROS 2 Jazzy
uses: ros-tooling/setup-ros@v0.7
with:
required-ros-distributions: jazzy
- name: Install ccache
run: apt-get install -y ccache
- name: Cache ccache
uses: actions/cache@v4
with:
path: /root/.cache/ccache
key: ccache-jazzy-${{ github.sha }}
restore-keys: |
ccache-jazzy-
- name: Install dependencies
run: |
apt-get update
apt-get install -y ros-jazzy-test-msgs
source /opt/ros/jazzy/setup.bash
rosdep update
rosdep install --from-paths src --ignore-src -y
- name: Build packages
env:
CCACHE_DIR: /root/.cache/ccache
CCACHE_MAXSIZE: 500M
CCACHE_SLOPPINESS: pch_defines,time_macros
run: |
source /opt/ros/jazzy/setup.bash
colcon build --symlink-install \
--packages-skip ros2_medkit_opcua \
--cmake-args -DCMAKE_BUILD_TYPE=Release \
--event-handlers console_direct+
ccache -s
- name: Package build artifacts
run: tar cf /tmp/jazzy-build.tar build/ install/
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: jazzy-build
path: /tmp/jazzy-build.tar
retention-days: 1
jazzy-test:
needs: jazzy-build
runs-on: ubuntu-latest
container:
image: ubuntu:noble
timeout-minutes: 45
defaults:
run:
shell: bash
steps:
- name: Install Git
run: |
apt-get update
apt-get install -y git
- name: Checkout repository
uses: actions/checkout@v4
- name: Pre-install ROS 2 apt source
uses: ./.github/actions/ros-apt-source
- name: Set up ROS 2 Jazzy
uses: ros-tooling/setup-ros@v0.7
with:
required-ros-distributions: jazzy
- name: Install dependencies
run: |
apt-get update
apt-get install -y \
ros-jazzy-test-msgs \
ros-jazzy-rmw-cyclonedds-cpp
source /opt/ros/jazzy/setup.bash
rosdep update
rosdep install --from-paths src --ignore-src -y
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: jazzy-build
- name: Extract build artifacts
run: tar xf jazzy-build.tar && rm jazzy-build.tar
- name: Run unit and integration tests
env:
# FastRTPS has a known use-after-free in discovery-teardown that
# can segfault peer nodes when another node (typically the gateway)
# shuts down. CycloneDDS avoids it.
RMW_IMPLEMENTATION: rmw_cyclonedds_cpp
run: |
source /opt/ros/jazzy/setup.bash
colcon test --return-code-on-test-failure \
--packages-skip ros2_medkit_opcua \
--ctest-args -LE linter \
--event-handlers console_direct+
- name: Show test results
if: always()
run: colcon test-result --verbose
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-jazzy-test
path: |
log/
build/*/test_results/
coverage:
runs-on: ubuntu-latest
container:
image: ubuntu:noble
timeout-minutes: 45
defaults:
run:
shell: bash
steps:
- name: Install Git
run: |
apt-get update
apt-get install -y git
- name: Checkout repository
uses: actions/checkout@v4
- name: Pre-install ROS 2 apt source
uses: ./.github/actions/ros-apt-source
- name: Set up ROS 2 Jazzy
uses: ros-tooling/setup-ros@v0.7
with:
required-ros-distributions: jazzy
- name: Install ccache
run: apt-get install -y ccache
- name: Cache ccache
uses: actions/cache@v4
with:
path: /root/.cache/ccache
key: ccache-coverage-${{ github.sha }}
restore-keys: |
ccache-coverage-
- name: Install dependencies
run: |
apt-get update
# gpg is required by codecov/codecov-action@v5 dependency check
apt-get install -y lcov ros-jazzy-test-msgs gpg
source /opt/ros/jazzy/setup.bash
rosdep update
rosdep install --from-paths src --ignore-src -r -y
- name: Build packages with coverage
env:
CCACHE_DIR: /root/.cache/ccache
CCACHE_MAXSIZE: 500M
CCACHE_SLOPPINESS: pch_defines,time_macros
run: |
source /opt/ros/jazzy/setup.bash
colcon build --symlink-install \
--packages-skip ros2_medkit_opcua \
--cmake-args -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON \
--event-handlers console_direct+
ccache -s
- name: Run unit and integration tests for coverage
run: |
source /opt/ros/jazzy/setup.bash
colcon test \
--packages-skip ros2_medkit_opcua \
--ctest-args -LE linter \
--event-handlers console_direct+
- name: Generate coverage report
run: |
lcov --capture --directory build --output-file coverage.raw.info \
--ignore-errors mismatch,negative,empty,gcov
if [ ! -s coverage.raw.info ] || ! grep -q 'SF:' coverage.raw.info; then
echo "::error::No valid coverage data found in coverage.raw.info"
exit 1
fi
lcov --extract coverage.raw.info \
'*/ros2_medkit/src/*/src/*' \
'*/ros2_medkit/src/*/include/*' \
--output-file coverage.extracted.info \
--ignore-errors unused,empty
lcov --remove coverage.extracted.info \
'*/vendored/*' \
--output-file coverage.info \
--ignore-errors unused,empty
if [ ! -s coverage.info ]; then
echo "::error::Filtered coverage.info is empty - no source files matched"
exit 1
fi
lcov --list coverage.info
genhtml coverage.info --output-directory coverage_html --ignore-errors source
- name: Upload coverage HTML report as artifact
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage_html/
- name: Upload coverage to Codecov
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: codecov/codecov-action@v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.info
flags: unittests,integration
name: ros2_medkit-coverage
fail_ci_if_error: true
verbose: true
notify-demos:
needs: [jazzy-test]
if: >-
github.event_name == 'push' &&
github.ref == 'refs/heads/main' &&
needs.jazzy-test.result == 'success'
runs-on: ubuntu-latest
# Only Jazzy gates the dispatch. Humble failures do not block demos CI - intentional tradeoff.
permissions: {}
steps:
- name: Trigger selfpatch_demos CI
uses: peter-evans/repository-dispatch@v4
with:
token: ${{ secrets.DEMOS_DISPATCH_TOKEN }}
repository: selfpatch/selfpatch_demos
event-type: ros2_medkit_updated
client-payload: '{"sha":"${{ github.sha }}","run_url":"${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}'