-
Notifications
You must be signed in to change notification settings - Fork 9
408 lines (408 loc) · 15.7 KB
/
test_build.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
---
name: test-build
on:
pull_request:
branches: [main]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
#TODO model dependency to image-workflow. Workaround: retrigger run after image-workflow finished.
runs-on: intellabs-01
container:
image: ghcr.io/intellabs/scenario-execution:humble
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
with:
submodules: true
- name: Build
shell: bash
run: |
source /opt/ros/humble/setup.bash
colcon build --continue-on-error
source install/setup.bash
- name: Cache Build
id: cache-test-id
uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: .
key: ${{ runner.os }}-build-${{ github.run_number }}
test-scenario-execution:
needs: [build]
runs-on: intellabs-01
container:
image: ghcr.io/intellabs/scenario-execution:humble
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Restore cache
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
key: ${{ runner.os }}-build-${{ github.run_number }}
path: .
- name: Test
shell: bash
run: |
source /opt/ros/humble/setup.bash
source install/setup.bash
export -n CYCLONEDDS_URI
export ROS_DOMAIN_ID=2
colcon test --packages-select \
scenario_execution \
scenario_execution_gazebo \
scenario_coverage \
--event-handlers console_direct+ \
--return-code-on-test-failure \
--pytest-args \
--junit-xml=TEST.xml
# Add "--capture=no" to see output of tests
- name: Upload result
uses: actions/upload-artifact@ef09cdac3e2d3e60d8ccadda691f4f1cec5035cb
if: always()
with:
name: test-scenario-execution
path: ./**/TEST.xml
test-scenario-execution-ros:
needs: [build]
runs-on: intellabs-01
container:
image: ghcr.io/intellabs/scenario-execution:humble
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Restore cache
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
key: ${{ runner.os }}-build-${{ github.run_number }}
path: .
- name: Test
shell: bash
run: |
source /opt/ros/humble/setup.bash
source install/setup.bash
export -n CYCLONEDDS_URI
export ROS_DOMAIN_ID=2
colcon test --packages-select \
scenario_execution_ros \
--event-handlers console_direct+ \
--return-code-on-test-failure \
--pytest-args \
--junit-xml=TEST.xml
# Add "--capture=no" to see output of tests
- name: Upload result
uses: actions/upload-artifact@ef09cdac3e2d3e60d8ccadda691f4f1cec5035cb
if: always()
with:
name: test-scenario-execution-ros
path: ./**/TEST.xml
scenario-files-validation:
needs: [build]
runs-on: intellabs-01
container:
image: ghcr.io/intellabs/scenario-execution:humble
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Restore cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
key: ${{ runner.os }}-build-${{ github.run_number }}
path: .
- name: Test Scenario Files
shell: bash
run: |
source /opt/ros/humble/setup.bash
source install/setup.bash
find . -name "*.osc" | grep -Ev "lib_osc/*|examples/example_scenario_variation|scenario_coverage|fail*|install|build" | while read -r file; do
echo "$file";
ros2 run scenario_execution scenario_execution "$file" -n;
done
test-example-scenario:
needs: [build]
runs-on: intellabs-01
container:
image: ghcr.io/intellabs/scenario-execution:humble
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Restore cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
key: ${{ runner.os }}-build-${{ github.run_number }}
path: .
- name: Test Example Scenario
shell: bash
run: |
source /opt/ros/humble/setup.bash
source install/setup.bash
#shellcheck disable=SC1083
scenario_batch_execution -i examples/example_scenario/ -o test_example_scenario -- ros2 launch scenario_execution_ros scenario_launch.py scenario:={SCENARIO} output_dir:={OUTPUT_DIR}
- name: Upload result
uses: actions/upload-artifact@ef09cdac3e2d3e60d8ccadda691f4f1cec5035cb
if: always()
with:
name: test-example-scenario-result
path: test_example_scenario/test.xml
test-example-library:
needs: [build]
runs-on: intellabs-01
container:
image: ghcr.io/intellabs/scenario-execution:humble
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Restore cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
key: ${{ runner.os }}-build-${{ github.run_number }}
path: .
- name: Test Example Library
shell: bash
run: |
source /opt/ros/humble/setup.bash
source install/setup.bash
# shellcheck disable=SC1083
scenario_batch_execution -i examples/example_library/scenarios -o test_example_library -- ros2 launch scenario_execution_ros scenario_launch.py scenario:={SCENARIO} output_dir:={OUTPUT_DIR}
- name: Upload result
uses: actions/upload-artifact@ef09cdac3e2d3e60d8ccadda691f4f1cec5035cb
if: always()
with:
name: test-example-library-result
path: test_example_library/test.xml
test-example-variation:
needs: [build]
runs-on: intellabs-01
container:
image: ghcr.io/intellabs/scenario-execution:humble
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Restore cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
key: ${{ runner.os }}-build-${{ github.run_number }}
path: .
- name: Test Example Variation
shell: bash
run: |
source /opt/ros/humble/setup.bash
source install/setup.bash
scenario_variation -o scenario_variation_out examples/example_scenario_variation/example_scenario_variation.osc
# shellcheck disable=SC1083
scenario_batch_execution -i scenario_variation_out -o test_example_variation -- ros2 launch scenario_execution_ros scenario_launch.py scenario:={SCENARIO} output_dir:={OUTPUT_DIR}
- name: Upload result
uses: actions/upload-artifact@ef09cdac3e2d3e60d8ccadda691f4f1cec5035cb
if: always()
with:
name: test-example-variation-result
path: test_example_variation/test.xml
test-example-nav2:
needs: [build]
runs-on: intellabs-01
container:
image: ghcr.io/intellabs/scenario-execution:humble
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Restore cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
key: ${{ runner.os }}-build-${{ github.run_number }}
path: .
- name: Test Example Nav2
shell: bash
run: |
source /opt/ros/humble/setup.bash
source install/setup.bash
Xvfb :1 -screen 0 800x600x16 &
export DISPLAY=:1.0
export -n CYCLONEDDS_URI
export ROS_DOMAIN_ID=2
export IGN_PARTITION=${HOSTNAME}:${GITHUB_RUN_ID}
sed -i 's/60s/600s/g' examples/example_nav2/example_nav2.osc
# shellcheck disable=SC1083
scenario_batch_execution -i examples/example_nav2/ -o test_example_nav2 -- ros2 launch tb4_sim_scenario sim_nav_scenario_launch.py scenario:={SCENARIO} output_dir:={OUTPUT_DIR}
- name: Upload result
uses: actions/upload-artifact@ef09cdac3e2d3e60d8ccadda691f4f1cec5035cb
if: always()
with:
name: test-example-nav2-result
path: test_example_nav2/test.xml
test-example-simulation:
needs: [build]
runs-on: intellabs-01
container:
image: ghcr.io/intellabs/scenario-execution:humble
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Restore cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
key: ${{ runner.os }}-build-${{ github.run_number }}
path: .
- name: Test Example Simulation
shell: bash
run: |
source /opt/ros/humble/setup.bash
source install/setup.bash
Xvfb :1 -screen 0 800x600x16 &
export DISPLAY=:1.0
export -n CYCLONEDDS_URI
export ROS_DOMAIN_ID=2
export IGN_PARTITION=${HOSTNAME}:${GITHUB_RUN_ID}
sed -i 's/120s/600s/g' examples/example_simulation/scenarios/example_simulation.osc
# shellcheck disable=SC1083
scenario_batch_execution -i examples/example_simulation/scenarios/ -o test_example_simulation -- ros2 launch tb4_sim_scenario sim_nav_scenario_launch.py scenario:={SCENARIO} output_dir:={OUTPUT_DIR}
- name: Upload result
uses: actions/upload-artifact@ef09cdac3e2d3e60d8ccadda691f4f1cec5035cb
if: always()
with:
name: test-example-simulation-result
path: test_example_simulation/test.xml
test-example-multirobot:
needs: [build]
runs-on: intellabs-01
container:
image: ghcr.io/intellabs/scenario-execution:humble
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Restore cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
key: ${{ runner.os }}-build-${{ github.run_number }}
path: .
- name: Test Example Multirobot
shell: bash
run: |
source /opt/ros/humble/setup.bash
source install/setup.bash
Xvfb :1 -screen 0 800x600x16 &
export DISPLAY=:1.0
export -n CYCLONEDDS_URI
export ROS_DOMAIN_ID=2
export IGN_PARTITION=${HOSTNAME}:${GITHUB_RUN_ID}
sed -i 's/240s/900s/g' examples/example_multi_robot/example_multi_robot.osc
# shellcheck disable=SC1083
scenario_batch_execution -i examples/example_multi_robot/ -o test_example_multirobot -- ros2 launch tb4_sim_scenario sim_nav_scenario_launch.py scenario:={SCENARIO} yaw:=3.14 output_dir:={OUTPUT_DIR}
- name: Upload result
uses: actions/upload-artifact@ef09cdac3e2d3e60d8ccadda691f4f1cec5035cb
if: always()
with:
name: test-example-multirobot-result
path: test_example_multirobot/test.xml
test-example-external-method:
needs: [build]
runs-on: intellabs-01
container:
image: ghcr.io/intellabs/scenario-execution:humble
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Restore cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
key: ${{ runner.os }}-build-${{ github.run_number }}
path: .
- name: Test Example External Method
shell: bash
run: |
source /opt/ros/humble/setup.bash
source install/setup.bash
export -n CYCLONEDDS_URI
export ROS_DOMAIN_ID=2
# shellcheck disable=SC1083
scenario_batch_execution -i examples/example_external_method/scenarios -o test_example_external_method -- ros2 launch scenario_execution_ros scenario_launch.py scenario:={SCENARIO} output_dir:={OUTPUT_DIR}
- name: Upload result
uses: actions/upload-artifact@ef09cdac3e2d3e60d8ccadda691f4f1cec5035cb
if: always()
with:
name: test-example-external-method-result
path: test_example_external_method/test.xml
test-scenario-execution-gazebo:
needs: [build]
runs-on: intellabs-01
container:
image: ghcr.io/intellabs/scenario-execution:humble
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Restore cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
key: ${{ runner.os }}-build-${{ github.run_number }}
path: .
- name: Test Scenario Execution Gazebo
shell: bash
run: |
source /opt/ros/humble/setup.bash
source install/setup.bash
Xvfb :1 -screen 0 800x600x16 &
export DISPLAY=:1.0
export -n CYCLONEDDS_URI
export ROS_DOMAIN_ID=2
export IGN_PARTITION=${HOSTNAME}:${GITHUB_RUN_ID}
# shellcheck disable=SC1083
scenario_batch_execution -i simulation/gazebo/test_scenario_execution_gazebo/scenarios/ -o test_scenario_execution_gazebo -- ros2 launch tb4_sim_scenario sim_nav_scenario_launch.py scenario:={SCENARIO} output_dir:={OUTPUT_DIR}
- name: Upload result
uses: actions/upload-artifact@ef09cdac3e2d3e60d8ccadda691f4f1cec5035cb
if: always()
with:
name: test-example-simulation-result
path: test_example_simulation/test.xml
tests:
needs:
- test-scenario-execution
- test-scenario-execution-ros
- scenario-files-validation
- test-example-scenario
- test-example-library
- test-example-variation
- test-example-nav2
- test-example-simulation
- test-example-multirobot
- test-example-external-method
- test-scenario-execution-gazebo
runs-on: intellabs-01
if: ${{ always() }}
steps:
- name: Download all artifacts
uses: actions/download-artifact@7a1cd3216ca9260cd8022db641d960b1db4d1be4 #v4.0
with:
path: downloaded-artifacts
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@f355d34d53ad4e7f506f699478db2dd71da9de5f #v2.15.1
with:
check_name: Test Results
check_run: false
action_fail: true
comment_mode: always
files: |
downloaded-artifacts/test-scenario-execution/scenario_execution/TEST.xml
downloaded-artifacts/test-scenario-execution-ros/scenario_execution_ros/TEST.xml
downloaded-artifacts/test-scenario-execution/scenario_coverage/TEST.xml
downloaded-artifacts/test-example-scenario-result/test.xml
downloaded-artifacts/test-example-library-result/test.xml
downloaded-artifacts/test-example-variation-result/test.xml
downloaded-artifacts/test-example-nav2-result/test.xml
downloaded-artifacts/test-example-simulation-result/test.xml
downloaded-artifacts/test-example-multirobot-result/test.xml
downloaded-artifacts/test-example-external-method-result/test.xml