forked from FreeRTOS/iot-reference-arm-corstone3xx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
175 lines (161 loc) · 5.21 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
# Copyright 2023 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/ci/pipeline-baseline-fri.yml'
variables:
OPEN_IOT_SDK_DOCKER_VERSION: v1
KUBERNETES_CPU_REQUEST: 1
KUBERNETES_MEMORY_REQUEST: 1Gi
GIT_SUBMODULE_STRATEGY: recursive
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_applications: &pipeline_config_applications
TARGET: [corstone300, corstone310]
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 base job load the right docker image and sets some default variables
.base_job:
extends: .base-job-rules
tags:
- iotmsw-amd64
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
parallel:
matrix:
- *pipeline_config_applications
variables:
PYTHONUNBUFFERED: 1
# 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:
stage: test
extends: .base_job
needs:
- job: build-applications
artifacts: true
# Build all the applications which later are tested.
build-applications:
stage: build
extends: .base_job
script:
- ./ci/generate_credentials.sh -f -p Config/aws_configs
- git config --global user.email "ci@example.com"
- git config --global user.name "ci"
- ./Tools/scripts/build.sh ${APP} --target $TARGET --toolchain $TOOLCHAIN --certificate_path $PWD/certificate.pem --private_key_path $PWD/private_key.pem
- |
if [ $APP == "aws-iot-example" ];then
tar -czf ${TARGET}_${APP}_${TOOLCHAIN}_build.tar.gz \
build/Projects/${APP}/${APP}_merged.elf \
build/Projects/${APP}/${APP}-update_signed.bin \
build/Projects/${APP}/update-signature.txt \
Config/aws_configs
else
tar -czf ${TARGET}_${APP}_${TOOLCHAIN}_build.tar.gz \
build/Projects/${APP}/${APP}_merged.elf
fi
parallel:
matrix:
-
<< : *pipeline_config_applications
APP: [blinky, aws-iot-example]
artifacts:
paths:
- ${TARGET}_${APP}_${TOOLCHAIN}_build.tar.gz
expire_in: 1 week
test-applications-output:
extends: .test_job
script:
- tar xf ${TARGET}_${APP}_${TOOLCHAIN}_build.tar.gz
- |
pytest -s Tools/tests/test_application_output.py \
--build-artefacts-path "build/Projects/${APP}" \
--fvp $FVP_BIN \
--merged-elf-name "${APP}_merged.elf" \
--timeout-seconds 600 \
--pass-output-file "Projects/${APP}/tests/pass_output.log" \
--fail-output-file "Projects/${APP}/tests/fail_output.log"
parallel:
matrix:
-
<< : *pipeline_config_applications
APP: [blinky]
test-ota:
extends: .test_job
script:
- tar xf ${TARGET}_${APP}_${TOOLCHAIN}_build.tar.gz
- |
pytest -s Tools/tests/test_ota.py \
--build-artefacts-path "build/Projects/${APP}" \
--fvp $FVP_BIN \
--credentials-path "Config/aws_configs" \
--merged-elf-name "${APP}_merged.elf" \
--signed-update-bin-name "${APP}-update_signed.bin" \
--timeout-seconds 900 \
--pass-output-file "Projects/${APP}/tests/pass_output.log" \
--fail-output-file "Projects/${APP}/tests/fail_output.log"
parallel:
matrix:
-
<< : *pipeline_config_applications
APP: [aws-iot-example]
integration-tests:
stage: test
extends: .base_job
rules:
- if: ( $SCHEDULED_JOB_TO_RUN == "integration-tests" )
script:
- ./ci/generate_credentials.sh -f -p Config/aws_configs
- git config --global user.email "ci@example.com"
- git config --global user.name "ci"
- ./Tools/scripts/build.sh -q ${APP}
- pushd Middleware/FreeRTOS/FreeRTOS-Libraries-Integration-Tests/tools/echo_server
- go run echo_server.go&
- popd
- sleep 1
- |
pytest -s Tools/tests/test_integration.py \
--build-artefacts-path "build/Projects/${APP}" \
--fvp $FVP_BIN \
--credentials-path "Config/aws_configs" \
--merged-elf-name "${APP}-tests_merged.elf" \
--signed-update-bin-name "${APP}-tests-update_signed.bin"
parallel:
matrix:
-
<< : *pipeline_config_applications
APP: [aws-iot-example]
# 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 ./ci/aws_cleanup.py