-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
config.yml
519 lines (495 loc) · 16.3 KB
/
config.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
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
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
version: 2.1
_commands:
common_commands: &common_commands
ccache_stats:
description: "CCache Stats"
parameters:
workspace:
type: string
when:
type: string
default: on_success
steps:
- run:
name: CCache Stats
working_directory: << parameters.workspace >>
environment:
CCACHE_DIR: << parameters.workspace >>/.ccache
command: |
ccache -s # show stats
ccache -z # zero stats
ccache -V # show version
ccache -p # show config
when: << parameters.when >>
restore_from_cache:
description: "Restore From Cache"
parameters:
key:
type: string
workspace:
type: string
steps:
- restore_cache:
name: Restore Cache << parameters.key >>
keys:
- "<< parameters.key >>-v13\
-{{ arch }}\
-{{ .Branch }}\
-{{ .Environment.CIRCLE_PR_NUMBER }}\
-{{ checksum \"<< parameters.workspace >>/lockfile.txt\" }}"
- "<< parameters.key >>-v13\
-{{ arch }}\
-main\
-<no value>\
-{{ checksum \"<< parameters.workspace >>/lockfile.txt\" }}"
save_to_cache:
description: "Save To Cache"
parameters:
key:
type: string
workspace:
type: string
path:
type: string
when:
type: string
default: on_success
steps:
- save_cache:
name: Save Cache << parameters.key >>
key: "<< parameters.key >>-v13\
-{{ arch }}\
-{{ .Branch }}\
-{{ .Environment.CIRCLE_PR_NUMBER }}\
-{{ checksum \"<< parameters.workspace >>/lockfile.txt\" }}\
-{{ epoch }}"
paths:
- << parameters.path >>/.ccache
- << parameters.path >>/build
- << parameters.path >>/install
- << parameters.path >>/log
- << parameters.path >>/test_results
when: << parameters.when >>
install_dependencies:
description: "Install Dependencies"
parameters:
underlay:
type: string
workspace:
type: string
steps:
- run:
name: Install Dependencies | << parameters.workspace >>
working_directory: << parameters.workspace >>
command: |
. << parameters.underlay >>/install/setup.sh
AMENT_PREFIX_PATH=$(echo "$AMENT_PREFIX_PATH" | \
sed -e 's|:/opt/ros/'$ROS_DISTRO'$||')
if [ "$AMENT_PREFIX_PATH" == "/opt/ros/$ROS_DISTRO" ]
then
unset AMENT_PREFIX_PATH
fi
cat << parameters.underlay >>/lockfile.txt > lockfile.txt
vcs export --exact << parameters.underlay >>/src | \
(echo vcs_export && cat) >> lockfile.txt
sha256sum $PWD/lockfile.txt >> lockfile.txt
apt-get update
rosdep update --rosdistro $ROS_DISTRO
dependencies=$(
rosdep install -q -y \
--from-paths src \
--ignore-src \
--skip-keys " \
slam_toolbox \
" \
--verbose | \
awk '$1 ~ /^resolution\:/' | \
awk -F'[][]' '{print $2}' | \
tr -d \, | xargs -n1 | sort -u | xargs)
dpkg --list dpkg $dependencies | \
(echo workspace_dependencies && cat) >> lockfile.txt
sha256sum $PWD/lockfile.txt >> lockfile.txt
setup_workspace:
description: "Setup Workspace"
parameters:
underlay:
type: string
key:
type: string
workspace:
type: string
mixins:
type: string
build:
default: true
type: boolean
steps:
- store_artifacts:
path: << parameters.workspace >>/lockfile.txt
- restore_from_cache:
key: << parameters.key >>
workspace: << parameters.workspace >>
- when:
condition: << parameters.build >>
steps:
- ccache_stats:
workspace: << parameters.workspace >>
when: always
- run:
name: Build Workspace | << parameters.workspace >>
working_directory: << parameters.workspace >>
environment:
CCACHE_DIR: << parameters.workspace >>/.ccache
command: |
colcon cache lock
BUILD_UNFINISHED=$(
colcon list \
--names-only \
--packages-skip-build-finished \
| xargs)
echo BUILD_UNFINISHED: $BUILD_UNFINISHED
BUILD_FAILED=$(
colcon list \
--names-only \
--packages-select-build-failed \
| xargs)
echo BUILD_FAILED: $BUILD_FAILED
BUILD_INVALID=$(
colcon list \
--names-only \
--packages-select-cache-invalid \
--packages-select-cache-key build \
| xargs)
echo BUILD_INVALID: $BUILD_INVALID
BUILD_PACKAGES=""
if [ -n "$BUILD_UNFINISHED" ] || \
[ -n "$BUILD_FAILED" ] || \
[ -n "$BUILD_INVALID" ]
then
BUILD_PACKAGES=$(
colcon list \
--names-only \
--packages-above \
$BUILD_UNFINISHED \
$BUILD_FAILED \
$BUILD_INVALID \
| xargs)
fi
echo BUILD_PACKAGES: $BUILD_PACKAGES
colcon clean packages --yes \
--packages-select ${BUILD_PACKAGES} \
--base-select install
. << parameters.underlay >>/install/setup.sh
colcon build \
--packages-select ${BUILD_PACKAGES} \
--mixin << parameters.mixins >>
- ccache_stats:
workspace: << parameters.workspace >>
when: always
- save_to_cache:
key: << parameters.key >>
path: << parameters.workspace >>
workspace: << parameters.workspace >>
when: always
- run:
name: Copy Build Logs
working_directory: << parameters.workspace >>
command: cp -rH log/latest_build log/build
when: always
- store_artifacts:
path: << parameters.workspace >>/log/build
test_workspace:
description: "Test Workspace"
parameters:
key:
type: string
workspace:
type: string
cache_test:
type: boolean
steps:
- run:
name: Test Workspace | << parameters.workspace >>
working_directory: << parameters.workspace >>
command: |
TEST_UNPASSED=$(
colcon list \
--names-only \
--packages-skip-test-passed \
| xargs)
echo TEST_UNPASSED: $TEST_UNPASSED
TEST_FAILURES=$(
colcon list \
--names-only \
--packages-select-test-failures \
| xargs)
echo TEST_FAILURES: $TEST_FAILURES
TEST_INVALID=$(
colcon list \
--names-only \
--packages-select-cache-invalid \
--packages-select-cache-key test \
| xargs)
echo TEST_INVALID: $TEST_INVALID
TEST_PACKAGES=""
if [ -n "$TEST_UNPASSED" ] || \
[ -n "$TEST_FAILURES" ] || \
[ -n "$TEST_INVALID" ]
then
TEST_PACKAGES=$(
colcon list \
--names-only \
--packages-above \
$TEST_UNPASSED \
$TEST_FAILURES \
$TEST_INVALID)
fi
if ( ! << parameters.cache_test >> )
then
TEST_PACKAGES=$(
colcon list \
--names-only)
fi
TEST_PACKAGES=$(
echo $TEST_PACKAGES \
| circleci tests split \
--split-by=timings \
--timings-type=classname \
--show-counts \
| xargs)
echo TEST_PACKAGES: $TEST_PACKAGES
colcon clean packages --yes \
--packages-select ${TEST_PACKAGES} \
--base-select test_result
colcon clean packages --yes \
--packages-select ${TEST_PACKAGES} \
--base-select build \
--clean-match \
"*.gcda"
. install/setup.sh
set -o xtrace
colcon test \
--packages-select ${TEST_PACKAGES}
colcon test-result \
--verbose
- when:
condition: << parameters.cache_test >>
steps:
- save_to_cache:
key: << parameters.key >>
path: << parameters.workspace >>
workspace: << parameters.workspace >>
when: always
- run:
name: Copy Test Logs
working_directory: << parameters.workspace >>
command: cp -rH log/latest_test log/test
when: always
- store_artifacts:
path: << parameters.workspace >>/log/test
- store_test_results:
path: << parameters.workspace >>/test_results
- store_artifacts:
path: << parameters.workspace >>/test_results
_steps:
pre_checkout: &pre_checkout
run:
name: Pre Checkout
command: |
mkdir -p $ROS_WS/src && cd $ROS_WS
ln -s /opt/ros/$ROS_DISTRO install
echo $CACHE_NONCE | \
(echo cache_nonce && cat) >> lockfile.txt
sha256sum $PWD/lockfile.txt >> lockfile.txt
TZ=utc stat -c '%y' /ros_entrypoint.sh | \
(echo ros_entrypoint && cat) >> lockfile.txt
sha256sum $PWD/lockfile.txt >> lockfile.txt
rm -rf $OVERLAY_WS/*
on_checkout: &on_checkout
checkout:
path: src/navigation2
post_checkout: &post_checkout
run:
name: Post Checkout
command: |
cp $OVERLAY_WS/src/navigation2/.circleci/defaults.yaml $COLCON_DEFAULTS_FILE
if ! cmp \
$OVERLAY_WS/src/navigation2/tools/underlay.repos \
$UNDERLAY_WS/underlay.repos >/dev/null 2>&1
then
echo "Importing Underlay"
cp $OVERLAY_WS/src/navigation2/tools/underlay.repos \
$UNDERLAY_WS/underlay.repos
vcs import $UNDERLAY_WS/src \
< $UNDERLAY_WS/underlay.repos
fi
install_underlay_dependencies: &install_underlay_dependencies
install_dependencies:
underlay: /opt/ros_ws
workspace: /opt/underlay_ws
setup_underlay_workspace: &setup_underlay_workspace
setup_workspace: &setup_workspace_underlay
key: underlay_ws
underlay: /opt/ros_ws
workspace: /opt/underlay_ws
mixins: ${UNDERLAY_MIXINS}
restore_underlay_workspace: &restore_underlay_workspace
setup_workspace:
<<: *setup_workspace_underlay
build: false
install_overlay_dependencies: &install_overlay_dependencies
install_dependencies:
underlay: /opt/underlay_ws
workspace: /opt/overlay_ws
setup_overlay_workspace: &setup_overlay_workspace
setup_workspace: &setup_workspace_overlay
key: overlay_ws
underlay: /opt/underlay_ws
workspace: /opt/overlay_ws
mixins: ${OVERLAY_MIXINS}
restore_overlay_workspace: &restore_overlay_workspace
setup_workspace:
<<: *setup_workspace_overlay
build: false
test_overlay_workspace: &test_overlay_workspace
test_workspace:
key: overlay_ws
workspace: /opt/overlay_ws
cache_test: << parameters.cache_test >>
collect_overlay_coverage: &collect_overlay_coverage
run:
name: Collect Code Coverage
working_directory: /opt/overlay_ws
command: src/navigation2/tools/code_coverage_report.bash ci
when: always
upload_overlay_coverage: &upload_overlay_coverage
run:
name: Upload Code Coverage
working_directory: /opt/overlay_ws
command: |
curl -s https://codecov.io/bash > codecov
codecov_version=$(grep -o 'VERSION=\"[0-9\.]*\"' codecov | cut -d'"' -f2)
shasum -a 512 -c <(curl -s "https://raw.githubusercontent.com/codecov/codecov-bash/${codecov_version}/SHA512SUM" | grep -w "codecov")
bash codecov \
-f "lcov/total_coverage.info" \
-R "src/navigation2" \
-n "$RMW_IMPLEMENTATION" \
-Z || echo 'Codecov upload failed'
when: always
commands:
<<: *common_commands
checkout_source:
description: "Checkout Source"
steps:
- *pre_checkout
- *on_checkout
- *post_checkout
setup_dependencies:
description: "Setup Dependencies"
steps:
- *install_underlay_dependencies
- *setup_underlay_workspace
- *install_overlay_dependencies
build_source:
description: "Build Source"
steps:
- *setup_overlay_workspace
restore_build:
description: "Restore Build"
steps:
- checkout_source
- *install_underlay_dependencies
- *restore_underlay_workspace
- *install_overlay_dependencies
- *restore_overlay_workspace
test_build:
description: "Test Build"
parameters:
cache_test:
type: boolean
steps:
- *test_overlay_workspace
report_coverage:
description: "Report Coverage"
steps:
- *collect_overlay_coverage
- *upload_overlay_coverage
_environments:
common_environment: &common_environment
ROS_WS: "/opt/ros_ws"
UNDERLAY_WS: "/opt/underlay_ws"
OVERLAY_WS: "/opt/overlay_ws"
UNDERLAY_MIXINS: "release ccache lld"
CCACHE_LOGFILE: "/tmp/ccache.log"
CCACHE_MAXSIZE: "200M"
MAKEFLAGS: "-j 2 -l 2 "
COLCON_DEFAULTS_FILE: "/tmp/defaults.yaml"
RCUTILS_LOGGING_BUFFERED_STREAM: "0"
RCUTILS_LOGGING_USE_STDOUT: "0"
DEBIAN_FRONTEND: "noninteractive"
PYTHONUNBUFFERED: "1"
executors:
release_exec:
docker:
- image: ghcr.io/ros-planning/navigation2:main
resource_class: large
working_directory: /opt/overlay_ws
environment:
<<: *common_environment
CACHE_NONCE: "Release"
OVERLAY_MIXINS: "release ccache coverage-gcc lld"
_jobs:
job_test: &job_test
parameters:
cache_test:
type: boolean
default: false
rmw:
default: "rmw_cyclonedds_cpp"
type: string
parallelism: 1
environment:
RMW_IMPLEMENTATION: << parameters.rmw >>
jobs:
release_build: &release_build
executor: release_exec
steps:
- checkout_source
- setup_dependencies
- build_source
release_test: &release_test
<<: *job_test
executor: release_exec
steps:
- restore_build
- test_build:
cache_test: << parameters.cache_test >>
- report_coverage
workflows:
version: 2
build_and_test:
jobs:
- release_build
- release_test:
requires:
- release_build
cache_test: true
nightly:
jobs:
- release_build
- release_test:
requires:
- release_build
matrix:
parameters:
rmw:
- rmw_connextdds
- rmw_cyclonedds_cpp
- rmw_fastrtps_cpp
triggers:
- schedule:
cron: "0 13 * * *"
filters:
branches:
only:
- main