/
.gitlab-ci.yml
450 lines (432 loc) · 15.4 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
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
# Copyright 2023-2024 Arm Limited and/or its affiliates
# <open-source-office@arm.com>
# SPDX-License-Identifier: MIT
default:
# cancel the job if a new pipeline is triggered on the same branch
interruptible: true
image: ${OPEN_IOT_SDK_DOCKER_REGISTRY}/open-iot-sdk:${OPEN_IOT_SDK_DOCKER_VERSION}
include:
local: '$PWD/tools/ci/pipeline-baseline-fri.yml'
variables:
OPEN_IOT_SDK_DOCKER_VERSION: v2
KUBERNETES_CPU_REQUEST: 1
KUBERNETES_MEMORY_REQUEST: 1Gi
GIT_SUBMODULE_STRATEGY: none
RETRY_LIMIT: 100
# Those fragments contain base variables required by pipelines for applications.
# They can be used to set matrix parameters and extended using << : .anchor syntax
.pipeline_config_corstone315: &pipeline_config_corstone315
TARGET: [corstone315]
.pipeline_config_corstone310: &pipeline_config_corstone310
TARGET: [corstone310]
.pipeline_config_corstone300: &pipeline_config_corstone300
TARGET: [corstone300]
.pipeline_config_toolchain: &pipeline_config_toolchain
TOOLCHAIN: [ARMCLANG, GNU]
stages:
- quality-check
- build
- test
- cleanup
workflow:
rules:
- if: $CI_MERGE_REQUEST_ID
- if: $CI_COMMIT_REF_NAME =~ /^release-.*/
- if: $CI_PIPELINE_SOURCE == "web"
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
# This build job is used as a template for building the available platforms' applications
.build_job:
tags:
- iotmsw-amd64
extends: .base-job-rules
before_script:
- python -m pip install pyelftools
script:
- export APP_UNDERSCORED=$(echo ${APP} | tr '-' '_')
- ./tools/ci/generate_credentials.sh -f -p applications/${APP_UNDERSCORED}/configs/aws_configs
- git config --global user.email "ci@example.com"
- git config --global user.name "ci"
- |
./tools/scripts/build.sh ${APP} \
--target $TARGET \
--inference $INFERENCE \
--audio $AUDIO \
--toolchain $TOOLCHAIN \
--certificate_path $PWD/certificate.pem \
--private_key_path $PWD/private_key.pem
- |
if [ $APP == "blinky" ];then
tar -czf ${TARGET}_${APP}_${TOOLCHAIN}_${INFERENCE}_${AUDIO}_build.tar.gz \
build/${APP}_merged.elf
else
tar -czf ${TARGET}_${APP}_${TOOLCHAIN}_${INFERENCE}_${AUDIO}_build.tar.gz \
build/${APP}_merged.elf \
build/${APP}-update_signed.bin \
build/update-signature.txt \
applications/${APP_UNDERSCORED}/configs/aws_configs
fi
# Build Corstone315 applications which later are tested.
build-applications-corstone315:
stage: build
extends: .build_job
parallel:
matrix:
-
<< : [*pipeline_config_corstone315, *pipeline_config_toolchain]
APP: [blinky, keyword-detection, speech-recognition, object-detection]
INFERENCE: [ETHOS]
AUDIO: [ROM]
artifacts:
paths:
- ${TARGET}_${APP}_${TOOLCHAIN}_${INFERENCE}_${AUDIO}_build.tar.gz
expire_in: 1 week
variables:
GIT_SUBMODULE_STRATEGY: recursive
# Build Corstone310 applications which later are tested.
build-applications-corstone310:
stage: build
extends: .build_job
parallel:
matrix:
-
<< : [*pipeline_config_corstone310, *pipeline_config_toolchain]
APP: [blinky, keyword-detection, speech-recognition]
INFERENCE: [ETHOS]
AUDIO: [ROM]
artifacts:
paths:
- ${TARGET}_${APP}_${TOOLCHAIN}_${INFERENCE}_${AUDIO}_build.tar.gz
expire_in: 1 week
variables:
GIT_SUBMODULE_STRATEGY: recursive
# Build Corstone300 applications which later are tested.
build-applications-corstone300:
stage: build
extends: .build_job
parallel:
matrix:
-
<< : [*pipeline_config_corstone300, *pipeline_config_toolchain]
APP: [blinky, keyword-detection, speech-recognition]
INFERENCE: [ETHOS]
AUDIO: [ROM]
artifacts:
paths:
- ${TARGET}_${APP}_${TOOLCHAIN}_${INFERENCE}_${AUDIO}_build.tar.gz
expire_in: 1 week
variables:
GIT_SUBMODULE_STRATEGY: recursive
# The test job extends .basejob. It add rules to map targets to FVP binaries,
# require the application to be built and retrieve the artifacts.
.test_job:
tags:
- iotmsw-amd64
extends: .base-job-rules
before_script:
- python -m pip install pyelftools
- |
if [ $TARGET == "corstone300" ];then
FVP_BIN=FVP_Corstone_SSE-300_Ethos-U55
fi
- |
if [ $TARGET == "corstone310" ];then
FVP_BIN=FVP_Corstone_SSE-310
fi
- |
if [ $TARGET == "corstone315" ];then
FVP_BIN=FVP_Corstone_SSE-315
fi
parallel:
matrix:
- *pipeline_config_corstone315
- *pipeline_config_corstone310
- *pipeline_config_corstone300
variables:
PYTHONUNBUFFERED: 1
test-blinky-output:
extends: .test_job
needs:
- job: build-applications-corstone315
artifacts: true
- job: build-applications-corstone310
artifacts: true
- job: build-applications-corstone300
artifacts: true
script:
- tar xf ${TARGET}_${APP}_${TOOLCHAIN}_${INFERENCE}_${AUDIO}_build.tar.gz
- |
pytest -s tools/tests/test_blinky_output.py \
--build-artefacts-path "build" \
--fvp $FVP_BIN \
--merged-elf-name "${APP}_merged.elf" \
--timeout-seconds 900 \
--pass-output-file "applications/${APP}/tests/pass_output.log" \
--fail-output-file "applications/${APP}/tests/fail_output.log"
parallel:
matrix:
-
<< : [*pipeline_config_corstone315, *pipeline_config_toolchain]
APP: [blinky]
INFERENCE: [ETHOS]
AUDIO: [ROM]
-
<< : [*pipeline_config_corstone310, *pipeline_config_toolchain]
APP: [blinky]
INFERENCE: [ETHOS]
AUDIO: [ROM]
-
<< : [*pipeline_config_corstone300, *pipeline_config_toolchain]
APP: [blinky]
INFERENCE: [ETHOS]
AUDIO: [ROM]
.test-applications_base:
extends: .test_job
script:
- |
if [[ -f "${TARGET}_${APP}_${TOOLCHAIN}_${INFERENCE}_${AUDIO}_build.tar.gz" ]]; then
tar xf ${TARGET}_${APP}_${TOOLCHAIN}_${INFERENCE}_${AUDIO}_build.tar.gz
fi
- export APP_UNDERSCORED=$(echo ${APP} | tr '-' '_')
- |
if [[ $AUDIO == "VSI" ]]; then
pytest -s tools/tests/test_applications.py \
--audio-file-path "applications/${APP_UNDERSCORED}/resources/test.wav" \
--build-artefacts-path "build" \
--fvp $FVP_BIN \
--credentials-path "applications/${APP_UNDERSCORED}/configs/aws_configs" \
--merged-elf-name "${APP}_merged.elf" \
--signed-update-bin-name "${APP}-update_signed.bin" \
--timeout-seconds 2700 \
--pass-output-file "applications/${APP_UNDERSCORED}/tests/pass_output.log" \
--fail-output-file "applications/${APP_UNDERSCORED}/tests/fail_output.log" \
--pythonhome-path "/opt/python/3.9.18"
elif [[ $APP == "object-detection" ]]; then
pytest -s tools/tests/test_applications.py \
--frm-file-path "applications/${APP_UNDERSCORED}/resources/test.frm" \
--build-artefacts-path "build" \
--fvp $FVP_BIN \
--credentials-path "applications/${APP_UNDERSCORED}/configs/aws_configs" \
--merged-elf-name "${APP}_merged.elf" \
--signed-update-bin-name "${APP}-update_signed.bin" \
--timeout-seconds 1800 \
--pass-output-file "applications/${APP_UNDERSCORED}/tests/pass_output.log" \
--fail-output-file "applications/${APP_UNDERSCORED}/tests/fail_output.log"
else
pytest -s tools/tests/test_applications.py \
--build-artefacts-path "build" \
--fvp $FVP_BIN \
--credentials-path "applications/${APP_UNDERSCORED}/configs/aws_configs" \
--merged-elf-name "${APP}_merged.elf" \
--signed-update-bin-name "${APP}-update_signed.bin" \
--timeout-seconds 2700 \
--pass-output-file "applications/${APP_UNDERSCORED}/tests/pass_output.log" \
--fail-output-file "applications/${APP_UNDERSCORED}/tests/fail_output.log"
fi
# The test-ml-applications-output job should wait for build-applications-corstone3xx jobs to finish as
# this test job uses the output build artifacts from build-applications-corstone3xx jobs.
test-ml-applications-output:
extends: .test-applications_base
needs:
- job: build-applications-corstone315
artifacts: true
- job: build-applications-corstone310
artifacts: true
- job: build-applications-corstone300
artifacts: true
parallel:
matrix:
-
<< : *pipeline_config_corstone315
APP: [keyword-detection, speech-recognition, object-detection]
INFERENCE: [ETHOS]
AUDIO: [ROM]
TOOLCHAIN: [ARMCLANG]
-
<< : *pipeline_config_corstone310
APP: [keyword-detection, speech-recognition]
INFERENCE: [ETHOS]
AUDIO: [ROM]
TOOLCHAIN: [ARMCLANG]
-
<< : *pipeline_config_corstone300
APP: [keyword-detection, speech-recognition]
INFERENCE: [ETHOS]
AUDIO: [ROM]
TOOLCHAIN: [ARMCLANG]
integration-tests:
extends: .test_job
stage: test
rules:
- if: ( $SCHEDULED_JOB_TO_RUN == "integration-tests" )
script:
- export APP_UNDERSCORED=$(echo ${APP} | tr '-' '_')
- ./tools/ci/generate_credentials.sh -f -p applications/${APP_UNDERSCORED}/configs/aws_configs
- git config --global user.email "ci@example.com"
- git config --global user.name "ci"
- git config --global core.autocrlf input
# With https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/commit/4471af64de1d481374881917bbba8736b1217530,
# a validation logic has been introduced which checks, if one of the
# address in an IP packet is loopback then both source and destination
# addresses must be loopback. For network interface tests, we run the
# server on the local machine and use loopback interface address in
# integration tests to communicate with the server. This causes
# validation logic to fail, as the destination address in the IP in the
# packet returned by the server is not a loopback address, but instead
# address assigned to the device. As a workaround, we use the ethernet
# interface address of the host machine instead of loopback to
# communicate with the server.
- host_ip_address=`ifconfig eth0 | grep -w 'inet' | awk '{print $2}'`
- sed -i "s/#define ECHO_SERVER_ENDPOINT .*$/#define ECHO_SERVER_ENDPOINT \"$host_ip_address\"/g" applications/freertos_iot_libraries_tests/test_param_config.h
- ./tools/scripts/build.sh ${APP} --target $TARGET --toolchain $TOOLCHAIN --certificate_path $PWD/certificate.pem --private_key_path $PWD/private_key.pem
- pushd components/tools/freertos_libraries_integration_tests/library/tools/echo_server
- go run echo_server.go&
- popd
- sleep 5
- |
pytest -s tools/tests/test_integration.py \
--build-artefacts-path "build" \
--fvp $FVP_BIN \
--credentials-path "applications/${APP_UNDERSCORED}/configs/aws_configs" \
--merged-elf-name "${APP}_merged.elf" \
--signed-update-bin-name "${APP}-update_signed.bin" \
--timeout-seconds 14400
parallel:
matrix:
-
<< : [*pipeline_config_corstone315, *pipeline_config_toolchain]
APP: [freertos-iot-libraries-tests]
-
<< : [*pipeline_config_corstone310, *pipeline_config_toolchain]
APP: [freertos-iot-libraries-tests]
-
<< : [*pipeline_config_corstone300, *pipeline_config_toolchain]
APP: [freertos-iot-libraries-tests]
retry:
max: 2
when:
- script_failure
- stuck_or_timeout_failure
- runner_system_failure
variables:
GIT_SUBMODULE_STRATEGY: recursive
sw-vsi-configs-test:
extends:
- .build_job
rules:
- if: ( $SCHEDULED_JOB_TO_RUN == "sw-vsi-configs-test" )
after_script:
# test_job's `before_script` section is referenced in the `after_script` section to set the correct value for FVP_BIN variable used in testing.
# test-applications_base job's `script` section is referenced in the `after_script` section of
# this job to do the testing part after the build stage is done where the build stage is inherited
# from `.build_job`
- !reference [.test_job, before_script]
- !reference [.test-applications_base, script]
parallel:
matrix:
-
<< : *pipeline_config_corstone315
APP: [keyword-detection, speech-recognition]
INFERENCE: [ETHOS]
AUDIO: [VSI]
TOOLCHAIN: [ARMCLANG]
-
<< : *pipeline_config_corstone315
APP: [keyword-detection, speech-recognition]
INFERENCE: [SOFTWARE]
AUDIO: [ROM, VSI]
TOOLCHAIN: [ARMCLANG]
-
<< : *pipeline_config_corstone315
APP: [object-detection]
INFERENCE: [SOFTWARE]
AUDIO: [ROM]
TOOLCHAIN: [ARMCLANG]
-
<< : *pipeline_config_corstone310
APP: [keyword-detection, speech-recognition]
INFERENCE: [ETHOS]
AUDIO: [VSI]
TOOLCHAIN: [ARMCLANG]
-
<< : *pipeline_config_corstone310
APP: [keyword-detection, speech-recognition]
INFERENCE: [SOFTWARE]
AUDIO: [ROM, VSI]
TOOLCHAIN: [ARMCLANG]
-
<< : *pipeline_config_corstone300
APP: [keyword-detection, speech-recognition]
INFERENCE: [ETHOS]
AUDIO: [VSI]
TOOLCHAIN: [ARMCLANG]
-
<< : *pipeline_config_corstone300
APP: [keyword-detection, speech-recognition]
INFERENCE: [SOFTWARE]
AUDIO: [ROM, VSI]
TOOLCHAIN: [ARMCLANG]
retry:
max: 2
when:
- script_failure
- stuck_or_timeout_failure
- runner_system_failure
variables:
GIT_SUBMODULE_STRATEGY: recursive
gnu-toolchain-test:
extends:
- .build_job
rules:
- if: ( $SCHEDULED_JOB_TO_RUN == "gnu-toolchain-test" )
after_script:
# test_job's `before_script` section is referenced in the `after_script` section to set the correct value for FVP_BIN variable used in testing.
# test-applications_base job's `script` section is referenced in the `after_script` section of
# this job to do the testing part after the build stage is done where the build stage is inherited
# from `.build_job`
- !reference [.test_job, before_script]
- !reference [.test-applications_base, script]
parallel:
matrix:
-
<< : *pipeline_config_corstone315
APP: [keyword-detection, speech-recognition]
INFERENCE: [ETHOS, SOFTWARE]
AUDIO: [ROM,VSI]
TOOLCHAIN: [GNU]
-
<< : *pipeline_config_corstone315
APP: [object-detection]
INFERENCE: [ETHOS, SOFTWARE]
AUDIO: [ROM]
TOOLCHAIN: [GNU]
-
<< : *pipeline_config_corstone310
APP: [keyword-detection, speech-recognition]
INFERENCE: [ETHOS, SOFTWARE]
AUDIO: [ROM,VSI]
TOOLCHAIN: [GNU]
-
<< : *pipeline_config_corstone300
APP: [keyword-detection, speech-recognition]
INFERENCE: [ETHOS, SOFTWARE]
AUDIO: [ROM,VSI]
TOOLCHAIN: [GNU]
retry:
max: 2
when:
- script_failure
- stuck_or_timeout_failure
- runner_system_failure
variables:
GIT_SUBMODULE_STRATEGY: recursive
# The clean up only happens once daily when the `Daily OTA cleanup`
# scheduled pipeline sets the `SCHEDULED_JOB_TO_RUN` variable to `cleanup`.
aws-cleanup:
stage: cleanup
tags:
- iotmsw-amd64
rules:
- if: $SCHEDULED_JOB_TO_RUN == "cleanup"
script:
- python -u ./tools/ci/aws_cleanup.py