forked from FreeRTOS/iot-reference-arm-corstone3xx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
126 lines (115 loc) · 3.77 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
# Copyright 2023 Arm Limited and/or its affiliates
# 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}
variables:
OPEN_IOT_SDK_DOCKER_VERSION: v1
KUBERNETES_CPU_REQUEST: 1
KUBERNETES_MEMORY_REQUEST: 1Gi
GIT_SUBMODULE_STRATEGY: recursive
RETRY_LIMIT: 100
# Normally, workflow rules are enabled for all the below and "main" branch
# Since, main branch is already tested and quite heavy, we do not need to run
# most jobs already run. The below rule skips the job on main branch.
.base_job_rules:
rules:
- if: $CI_MERGE_REQUEST_ID
- if: $CI_COMMIT_REF_NAME =~ /^release-.*/
- if: $CI_PIPELINE_SOURCE == "web"
- if: $GITLAB_CI_LOCAL == "true"
stages:
- 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:
- |
if [ $TARGET == "Corstone-300" ];then
AVH=/opt/VHT/VHT_Corstone_SSE-300_Ethos-U55
fi
- |
if [ $TARGET == "Corstone-310" ];then
AVH=/opt/VHT/VHT_Corstone_SSE-310
fi
parallel:
matrix:
- TARGET: [Corstone-300]
TOOLCHAIN: [GNU, ARMCLANG]
variables:
PYTHONUNBUFFERED: 1
# The test job extends .basejob. It add rules to map targets to AVH 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 of the various binaries
# is described in ./ci/build_examples.sh
build-applications:
stage: build
extends: .base_job
script:
- ./ci/generate_credentials.sh -f -p Config/aws_configs
- git config --global user.email "[email protected]"
- git config --global user.name "ci"
- ./Tools/scripts/build.sh aws-iot-example --toolchain $TOOLCHAIN
- |
tar -czf ${TOOLCHAIN}_build.tar.gz \
build/bootloader/bl2.axf \
build/secure_partition/tfm_s_signed.bin \
build/Projects/aws-iot-example/aws-iot-example.axf \
build/Projects/aws-iot-example/aws-iot-example_signed.bin \
build/Projects/aws-iot-example/aws-iot-example-update_signed.bin \
build/Projects/aws-iot-example/update-signature.txt \
Config/aws_configs
artifacts:
paths:
- ${TOOLCHAIN}_build.tar.gz
expire_in: 1 week
# Test connection to the AWS cloud
test-ota-aws:
extends: .test_job
script:
- tar xf ${TOOLCHAIN}_build.tar.gz
- pytest -s Tools/tests/test_ota.py --build-path "build" --avh $AVH --credentials-path "Config/aws_configs"
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 "[email protected]"
- git config --global user.name "ci"
- ./Tools/scripts/build.sh -q aws-iot-example
- apt update
- apt install golang-go -y
- 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-path "build" --avh $AVH --credentials-path "Config/aws_configs"
aws-cleanup:
stage: cleanup
tags:
- iotmsw-amd64
rules:
- if: $SCHEDULED_JOB_TO_RUN == "cleanup"
script:
- python -u ./ci/aws_cleanup.py