forked from stereolabs/zed-ros2-wrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
400 lines (354 loc) · 11.5 KB
/
.gitlab-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
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
##############################
# Artifacts default values #
##############################
#Folders to be saved after the build
.artifacts_files:
paths: &artifacts_files_definition
- ros2_ws/install
#Folders to be saved after the tests
.test_artifacts_files:
paths: &test_artifacts_files_definition
#- lib/test/bin/data/current/*
- ros2/test/bin/data/current/*
#XML files to be used for Gitlab test report interface
.test_artifacts_report_files:
reports: &test_artifacts_report_files_definition
#junit: lib/test/bin/output/*/*_test_*.xml
junit: ros2/test/bin/output/*/*_test_*.xml
.linux_artifacts:
name: &linux_artifacts_naming_definition "${CI_PROJECT_NAMESPACE}_${CI_PROJECT_NAME}_${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
#Artifacts configuration
.artifacts_config:
expire_in: &artifacts_expire_in_definition 2 weeks
############
# Stages #
############
stages:
- build
- unit_test
- deploy_docker_dev
- deploy
- deploy_docker
variables:
#GIT_SUBMODULE_STRATEGY: normal
GIT_SUBMODULE_STRATEGY: recursive
#GIT_CLONE_PATH: $CI_BUILDS_DIR/ros2_ws/src/$CI_PROJECT_NAME # must be enabled in the configuration of the runners!
######################
# BUILDER selection #
######################
.linux_docker_builder_target:
tags: &linux_docker_builder_target_definition
- docker-builder
- linux
# deploy-support is actually linux + docker (but for weaker builder)
.deploy_target:
tags: &deploy_target_definition
- deploy-support
.linux_docker_builder_qemu_target:
tags: &linux_docker_builder_qemu_target_definition
- docker-builder
- linux
- qemu-support
.linux_docker_builder_native_target:
tags: &linux_docker_builder_native_target_definition
- jetson
- L4T35.1
######################
# Runner selection #
######################
# generic
.runner_linux_jetson_l4t35_1_target:
tags: &runner_linux_jetson_l4t35_1_target_definition
- linux
- jetson
- L4T35.1
.runner_linux_jetson_l4t32_7_target:
tags: &runner_linux_jetson_l4t32_7_target_definition
- linux
- jetson
- L4T32.7
.runner_linux_jetson_nano_l4t32_7_target:
tags: &runner_linux_jetson_nano_l4t32_7_target_definition
- linux
- jetson
- nano
- perfTest
- L4T32.7
.runner_linux_jetson_tx2_nx_l4t32_7_target:
tags: &runner_linux_jetson_tx2_nx_l4t32_7_target_definition
- linux
- jetson
- tx2_nx
- perfTest
- L4T32.7
.runner_linux_jetson_xavier_nx_l4t35_1_target:
tags: &runner_linux_jetson_xavier_nx_l4t35_1_target_definition
- linux
- jetson
- xavier_nx
- perfTest
- L4T35.1
.runner_linux_jetson_xavier_agx_l4t35_1_target:
tags: &runner_linux_jetson_xavier_agx_l4t35_1_target_definition
- linux
- jetson
- xavier
- perfTest
- L4T35.1
.runner_linux_jetson_orin_agx_l4t35_1_target:
tags: &runner_linux_jetson_orin_agx_l4t35_1_target_definition
- linux
- jetson
- orin
- perfTest
- L4T35.1
.runner_linux_jetson_live_l4t32_7_target:
tags: &runner_linux_jetson_live_l4t32_7_target_definition
- linux
- jetson
- live-runner
- L4T32.7
.runner_ubuntu18_desktop_live_cuda11_0_target:
tags: &runner_ubuntu18_desktop_live_cuda11_0_target_definition
- ubuntu18
- x86_64
- perfTest
- CUDA11
- live-runner
.runner_ubuntu18_desktop_cuda11_0_target:
tags: &runner_ubuntu18_desktop_cuda11_0_target_definition
- ubuntu18
- x86_64
- perfTest
- CUDA11
.runner_ubuntu_docker_desktop_target:
tags: &runner_ubuntu_docker_desktop_target_definition
- x86_64
- docker-runner
- linux
.runner_ubuntu_docker_live_desktop_target:
tags: &runner_ubuntu_docker_live_desktop_target_definition
- x86_64
- docker-runner
- linux
- live-runner
- deploy-support
## Memory target
.memory_ubuntu18_desktop_cuda11_0_target:
tags: &memory_ubuntu18_desktop_cuda11_0_target_definition
- ubuntu18
- x86_64
- memTest
- CUDA11
######################
# Build script #
######################
.build_script_linux_humble:
script: &humble_linux_build_script_definition
- sudo chmod +x .ci/run_build_in_humble.sh
- ./.ci/run_build_in_humble.sh
#################
# Build Tasks #
#################
humble_u22_cu117_build:
stage: build
#image: stereolabs/ci-compiler:ubuntu22.04-cuda11.7-tensorrt8.4.2-ros2-humble
image: myzhar/test:ubuntu22.04-cuda11.7-tensorrt8.4.2-ros2-humble
tags: *linux_docker_builder_target_definition
script: *humble_linux_build_script_definition
artifacts:
name: *linux_artifacts_naming_definition
paths: *artifacts_files_definition
expire_in: *artifacts_expire_in_definition
when: on_success
humble_l4t35_1_build:
stage: build
image: dustynv/ros:humble-ros-base-l4t-r35.1.0
# Consider using qemu in the future
tags: *linux_docker_builder_qemu_target_definition
#tags: *linux_docker_builder_native_target_definition
script: *humble_linux_build_script_definition
artifacts:
name: *linux_artifacts_naming_definition
paths: *artifacts_files_definition
expire_in: *artifacts_expire_in_definition
when: on_success
######################
# Test script #
######################
.setup_docker_sdk_before_script_linux:
before_script: &linux_docker_install_sdk_before_script_definition
- echo "Europe/Paris" > /etc/localtime
- mv ZED_SDK_*.run ZED_SDK_Linux.run
- apt update || true ; apt install -y lsb-release wget less udev sudo build-essential cmake python3 python3-dev zstd python3-pip python3-wheel git binutils-dev jq libusb-1* libopencv-dev
- chmod +x ZED_SDK_Linux.run ; ./ZED_SDK_Linux.run -- silent
- ln -sf /usr/bin/python3 /usr/bin/python
- python -m pip install wheel setuptools #scikit-build
#- python -m pip install opencv-python-headless
# Replace libs by debug info ones
#- mv lib/build/libsl_ai_dbginfo.so /usr/local/zed/lib/libsl_ai.so
#- mv lib/build/libsl_zed_dbginfo.so /usr/local/zed/lib/libsl_zed.so
.setup_sdk_before_script_linux:
before_script: &linux_install_sdk_before_script_definition
- ls lib/build/*
- mv ZED_SDK_*.run ZED_SDK_Linux.run
- sudo apt update || true ; sudo apt install -y binutils-dev zstd jq git cmake
- chmod +x ZED_SDK_Linux.run ; ./ZED_SDK_Linux.run -- silent
# Replace libs by debug info ones
#- mv lib/build/libsl_ai_dbginfo.so /usr/local/zed/lib/libsl_ai.so
#- mv lib/build/libsl_zed_dbginfo.so /usr/local/zed/lib/libsl_zed.so
.setup_sdk_u22_cu117_web_before_script:
before_script: &setup_sdk_u22_cu117_web_before_script_definition
- sudo chmod +x .ci/download_and_install_sdk.sh
- ./.ci/download_and_install_sdk.sh 22 11 7 3 8
# clean previous artifacts
- rm -rf ../ros2_ws
# create new ROS2 workspace folders
- mkdir -p ../ros2_ws/install
# move new artifacts in the workspace folder
- cp -a ./ros2_ws/install ../ros2_ws/
- rm -rf ./ros2_ws/
.test_script_linux:
script: &linux_test_script_definition
- sudo chmod +x .ci/run_tests.sh
- ./.ci/run_tests.sh
###################
# Unit Test tasks #
###################
unit_test_ros2_humble_u22_cu117:
stage: unit_test
#image: stereolabs/ci-runner:ubuntu22.04-cuda11.7-ros2-humble
image: myzhar/test:ubuntu22.04-cuda11.7-ros2-humble-v1.1
tags: *runner_ubuntu_docker_live_desktop_target_definition
before_script: *setup_sdk_u22_cu117_web_before_script_definition
script: *linux_test_script_definition
#artifacts:
# when: always
# name: *linux_artifacts_naming_definition
# paths: *test_artifacts_files_definition
# expire_in: *artifacts_expire_in_definition
# reports: *test_artifacts_report_files_definition
needs:
- job: humble_u22_cu117_build
artifacts: true
when: manual
#####################
# Docker Dev Deploy #
#####################
# ROS2 Humble U22 Docker Image DEVEL - use the current branch source to build the wrapper
ros2_humble_u22_docker_image_dev:
needs:
- job: humble_u22_cu117_build
stage: deploy_docker_dev
image: docker
services:
- docker:dind
script:
- docker login -u $CI_REGISTRY_USER_WALT -p $CI_REGISTRY_PASSWORD_WALT
- cd docker
- mkdir -p ./tmp_sources
- cp -r ../zed* ./tmp_sources
- IMG_TAG=${CI_PROJECT_NAME}_u22_cuda117_humble_${CI_COMMIT_BRANCH}
- docker build -t "myzhar/zed-ros2-devel:${IMG_TAG}" -f ./Dockerfile.u22-cu117-humble-devel .
- docker push myzhar/zed-ros2-devel:${IMG_TAG}
- rm -r ./tmp_sources
when: on_success
tags: *linux_docker_builder_target_definition
except:
- master
allow_failure: true
# ROS2 Humble L4T Docker Image DEVEL - use the current branch source to build the wrapper
ros2_humble_l4t_docker_image_dev:
needs:
- job: humble_l4t35_1_build
stage: deploy_docker_dev
image: docker
services:
- docker:dind
script:
- docker login -u $CI_REGISTRY_USER_WALT -p $CI_REGISTRY_PASSWORD_WALT
- cd docker
- mkdir -p ./tmp_sources
- cp -r ../zed* ./tmp_sources
- IMG_TAG=${CI_PROJECT_NAME}_l4t35_1_humble_${CI_COMMIT_BRANCH}
- docker build -t "myzhar/zed-ros2-devel:${IMG_TAG}" -f ./Dockerfile.l4t35_1-humble-devel .
- docker push myzhar/zed-ros2-devel:${IMG_TAG}
- rm -r ./tmp_sources
when: on_success
tags: *linux_docker_builder_qemu_target_definition
except:
- master
allow_failure: true
#########################
# Docker Release Deploy #
#########################
# ROS2 Humble U22 Docker Image RELEASE - clone the Github master branch to build the wrapper
ros2_humble_u22_docker_image_rel:
needs:
- job: github_push
#- job: ros2_humble_u22_docker_image_dev
stage: deploy_docker
image: docker
services:
- docker:dind
script:
- docker login -u $DOCKER_ZEDBOT_PUSH_USER -p $DOCKER_ZEDBOT_PUSH_PWD
- cd docker
- IMG_TAG=${CI_PROJECT_NAME}_u22_cuda117_humble_${CI_COMMIT_TAG}
- docker build -t "stereolabs/zedbot:${IMG_TAG}" -f ./Dockerfile.u22-cu117-humble-release .
- docker push stereolabs/zedbot:${IMG_TAG}
when: on_success
tags: *linux_docker_builder_target_definition
only:
- master
allow_failure: true
# ROS2 Humble L4T Docker Image RELEASE - clone the Github master branch to build the wrapper
ros2_humble_l4t_docker_image_rel:
needs:
- job: github_push
#- job: ros2_humble_l4t_docker_image_dev
stage: deploy_docker
image: docker
services:
- docker:dind
script:
- docker login -u $DOCKER_ZEDBOT_PUSH_USER -p $DOCKER_ZEDBOT_PUSH_PWD
- cd docker
- IMG_TAG=${CI_PROJECT_NAME}_l4t35_1_humble_${CI_COMMIT_TAG}
- docker build -t "stereolabs/zedbot:${IMG_TAG}" -f ./Dockerfile.l4t35_1-humble-release .
- docker push stereolabs/zedbot:${IMG_TAG}
when: on_success
tags: *linux_docker_builder_qemu_target_definition
only:
- master
allow_failure: true
#################
# GitHub Deploy #
#################
# Update Github master branch
github_push:
needs:
- job: humble_u22_cu117_build
artifacts: false
- job: humble_l4t35_1_build
artifacts: false
stage: deploy
image: alpine
script:
- apk add --no-cache bash git
- git config --global user.email "[email protected]"
- git config --global user.name "Stereolabs"
- git clone --recurse-submodules http://wlucetti:${GITLAB_PULL_TOKEN}@192.168.1.93/sl/zed-ros2-wrapper.git
- cd zed-ros2-wrapper
- git remote set-url origin https://${GITHUB_PUSH_TOKEN}@github.com/stereolabs/zed-ros2-wrapper.git
- git remote -v
- git config pull.rebase false
- git pull origin master --allow-unrelated-histories
- git push https://${GITHUB_PUSH_TOKEN}@github.com/stereolabs/zed-ros2-wrapper.git
when: on_success
tags:
- docker-builder
- linux
only:
- master
allow_failure: true