blob: 710555669b47c44e70cb72c076fd3d8b86f56a71 [file] [log] [blame]
Xinyu Zhang15f8d752023-09-13 19:41:35 +08001#-------------------------------------------------------------------------------
2# Copyright (c) 2023, Arm Limited. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
Paul Sokolovsky3ec4b362023-09-02 21:30:24 +03008- job:
9 name: tf-m-eclair-delta
Paul Sokolovskydb05ab52024-01-21 10:23:00 +070010 node: docker-tf-m-eclair-3.13
Paul Sokolovsky3ec4b362023-09-02 21:30:24 +030011 project-type: freestyle
12 concurrent: true
13 disabled: false
14 defaults: global
15 Description: |
16 ECLAIR (MISRA) analysis for Trusted Firmware M patches
17 properties:
18 - build-discarder:
19 days-to-keep: 90
20 artifact-num-to-keep: 40
21 parameters:
22 - string:
23 name: 'FILTER_GROUP'
24 default: "misra"
25 description: |
26 Filter to a group of configurations as recognised by configs.py
27 - string:
28 name: 'CODE_REPO'
29 default: 'https://git.trustedfirmware.org/TF-M/trusted-firmware-m'
30 - string:
31 name: 'CI_SCRIPTS_REPO'
32 default: 'https://git.trustedfirmware.org/ci/tf-m-ci-scripts'
33 - string:
34 name: 'CI_SCRIPTS_BRANCH'
35 default: 'master'
36 - string:
37 name: 'GERRIT_REFSPEC'
Xinyu Zhang8450cc92023-09-21 16:46:13 +080038 default: 'refs/heads/main'
Paul Sokolovsky3ec4b362023-09-02 21:30:24 +030039 description: |
Xinyu Zhang8450cc92023-09-21 16:46:13 +080040 For use when triggering with specified tag or master 'refs/heads/main' or 'refs/tags/TF-Mv1.0'.
Paul Sokolovsky3ec4b362023-09-02 21:30:24 +030041 - string:
42 name: 'GERRIT_BRANCH'
Xinyu Zhang8450cc92023-09-21 16:46:13 +080043 default: 'main'
Paul Sokolovsky3ec4b362023-09-02 21:30:24 +030044 description: |
45 TF-M branch.
46 - string:
47 name: GERRIT_PROJECT
48 default: 'TF-M/trusted-firmware-m'
49 description: |
50 Git project to build (also set by Gerrit trigger)
51 - string:
52 name: 'GERRIT_HOST'
53 default: 'review.trustedfirmware.org'
54 - string:
55 name: 'GERRIT_CHANGE_NUMBER'
56 description: |
57 No need to change.
58 - string:
59 name: 'GERRIT_PATCHSET_REVISION'
60 description: |
61 No need to change.
62 - string:
63 name: 'MBEDTLS_VERSION'
Paul Sokolovsky7923a482023-09-13 22:54:10 +030064 default: ''
Paul Sokolovsky3ec4b362023-09-02 21:30:24 +030065 description: |
66 Specify which MBEDTLS version to use
67 refs/heads/<branch_name> : Pick up latest HEAD on branch
68 TAG_NAME : Pick up a tagged version
69 full commit hash : Pick up a specific commit
70 - string:
71 name: 'MBEDTLS_URL'
72 default: 'https://git.trustedfirmware.org/mirror/mbed-tls.git'
73 - string:
74 name: 'QCBOR_URL'
75 default: 'https://github.com/laurencelundblade/QCBOR.git'
76 - string:
77 name: 'QCBOR_VERSION'
Paul Sokolovskyeada3ab2023-09-13 23:28:59 +030078 default: ''
Paul Sokolovsky3ec4b362023-09-02 21:30:24 +030079 description: |
80 Specify which QCBOR version to use
81 refs/heads/<branch_name> : Pick up latest HEAD on branch
82 TAG_NAME : Pick up a tagged version
83 full commit hash : Pick up a specific commit
84 - string:
Matthew Dalzell21057ce2025-02-28 17:20:19 +000085 name: 'T_COSE_URL'
86 default: 'https://github.com/laurencelundblade/t_cose.git'
87 - string:
88 name: 'T_COSE_VERSION'
89 default: ''
90 description: |
91 Specify which t_cose version to use
92 refs/heads/<branch_name> : Pick up latest HEAD on branch
93 TAG_NAME : Pick up a tagged version
94 full commit hash : Pick up a specific commit
95 - string:
Paul Sokolovsky3ec4b362023-09-02 21:30:24 +030096 name: 'MCUBOOT_REFSPEC'
Paul Sokolovskyeada3ab2023-09-13 23:28:59 +030097 default: ''
Paul Sokolovsky3ec4b362023-09-02 21:30:24 +030098 description: |
99 Specify which MCUboot version to use
100 refs/heads/<branch_name> : Pick up latest HEAD on branch
101 TAG_NAME : Pick up a tagged version
102 full commit hash : Pick up a specific commit
103 - string:
104 name: 'MCUBOOT_URL'
105 default: 'https://git.trustedfirmware.org/mirror/mcuboot.git'
106 - string:
107 name: 'TFM_TESTS_URL'
108 default: 'https://git.trustedfirmware.org/TF-M/tf-m-tests.git'
109 - string:
110 name: 'TFM_TESTS_REFSPEC'
Paul Sokolovskyeada3ab2023-09-13 23:28:59 +0300111 default: ''
Paul Sokolovsky3ec4b362023-09-02 21:30:24 +0300112 - string:
Matthew Dalzelldca58c72025-05-16 17:39:01 +0100113 name: 'TFM_EXTRAS_URL'
114 default: 'https://git.trustedfirmware.org/TF-M/tf-m-extras.git'
115 - string:
116 name: 'TFM_EXTRAS_REFSPEC'
117 default: ''
118 description: |
119 Specify which tf-m-extras version to use
120 refs/heads/<branch_name> : Pick up latest HEAD on branch
121 TAG_NAME : Pick up a tagged version
122 full commit hash : Pick up a specific commit
123 - string:
Paul Sokolovsky3ec4b362023-09-02 21:30:24 +0300124 name: 'PSA_ARCH_TESTS_URL'
125 default: 'https://git.trustedfirmware.org/mirror/psa-arch-tests.git'
126 - string:
127 name: 'PSA_ARCH_TESTS_VERSION'
Paul Sokolovskyeada3ab2023-09-13 23:28:59 +0300128 default: ''
Paul Sokolovsky3ec4b362023-09-02 21:30:24 +0300129 - string:
130 name: SHARE_FOLDER
131 default: '/tmp'
132 description: 'Folder for initial cloning of repositories'
133 - string:
134 name: 'BUILD_TARGET'
135 default: ''
136 description: |
137 Override build target (for debugging)
138 - string:
139 name: 'BUILD_JOBS'
140 default: '16'
141 description: |
142 --jobs to pass to make, etc.
143 triggers:
144 - gerrit:
145 silent: true
146 server-name: 'review.trustedfirmware.org'
147 projects:
148 - branches:
149 - branch-compare-type: PLAIN
Xinyu Zhang15f8d752023-09-13 19:41:35 +0800150 branch-pattern: eclair
Paul Sokolovsky3ec4b362023-09-02 21:30:24 +0300151 project-compare-type: PLAIN
152 project-pattern: 'TF-M/trusted-firmware-m'
153 - branches:
154 - branch-compare-type: PLAIN
155 branch-pattern: master
156 project-compare-type: PLAIN
157 project-pattern: 'sandbox/pfalcon/trusted-firmware-m'
158 trigger-on:
159 - comment-added-event:
160 approval-category: "Allow-CI"
161 approval-value: 1
162 - comment-added-event:
163 approval-category: "Allow-CI"
164 approval-value: 2
165 wrappers:
166 - timestamps
167 - timeout:
168 timeout: 2400
169 fail: true
170 - credentials-binding:
171 - ssh-user-private-key:
172 credential-id: TFA_CI_BOT_USER_SSH_KEY
173 key-file-variable: CI_BOT_KEY
174 username-variable: CI_BOT_USERNAME
175 passphrase-variable: ''
176 builders:
177 - shell: |
178 #!/bin/bash -ex
179 git clone -b $CI_SCRIPTS_BRANCH $CI_SCRIPTS_REPO tf-m-ci-scripts
180 git clone -b master https://git.trustedfirmware.org/ci/tf-ci-scripts.git tf-ci-scripts
181 bash -x tf-m-ci-scripts/clone.sh
182
183 ls -l
184 if [ -n "${GERRIT_REFSPEC}" ]; then
185 (
186 cd $(basename ${GERRIT_PROJECT})
187 git fetch https://${GERRIT_HOST}/${GERRIT_PROJECT} ${GERRIT_REFSPEC} && git checkout FETCH_HEAD
188 )
189 fi
190
191 (cd trusted-firmware-m; git log --oneline -n5)
192
193 export ECLAIR_CONFIG_DIR=$PWD/tf-m-ci-scripts/eclair
194 . tf-ci-scripts/eclair/utils.sh
195 . tf-m-ci-scripts/eclair/utils_tfm.sh
196
197 export CROSS_COMPILE="arm-none-eabi-"
198 export CC_ALIASES="${CROSS_COMPILE}gcc"
199 export CXX_ALIASES="${CROSS_COMPILE}g++"
200 export LD_ALIASES="${CROSS_COMPILE}ld"
201 export AR_ALIASES="${CROSS_COMPILE}ar"
202 export AS_ALIASES="${CROSS_COMPILE}as"
203 export FILEMANIP_ALIASES="cp mv ${CROSS_COMPILE}objcopy"
204
205 # Detach license for initial eclair_env invocation. We then extend it on
206 # each config build iteration.
207 detachLicense 600
208 trap "returnLicense || true" EXIT
209
210 # Toolchain path must be already set before calling eclair_env, can't set it inside it.
211 # And to set toolchain path, we need a CONFIG_NAME
212 CONFIG_NAME=$(python3 tf-m-ci-scripts/configs.py -g $FILTER_GROUP | head -1)
213 eclair_tfm_set_toolchain_path
214
215 export ECLAIR_ANALYSIS=ECLAIR
216 eclair_prepare
217 eclair_analyze tf-m-ci-scripts/run-eclair-builds.sh
Paul Sokolovsky757b9452024-01-19 10:31:47 +0700218 echo "eclair_analyze target revision finished"
Paul Sokolovsky3ec4b362023-09-02 21:30:24 +0300219 eclair_make_ecd
220 eclair_make_reports
221
222 echo "========= Building base revision ========="
223
224 (
225 cd $(basename ${GERRIT_PROJECT})
226 git checkout HEAD^
227 git log --oneline -n5
228 )
229
230 export ECLAIR_ANALYSIS=ECLAIR_BASE
231 eclair_prepare
232 eclair_analyze tf-m-ci-scripts/run-eclair-builds.sh
Paul Sokolovsky757b9452024-01-19 10:31:47 +0700233 echo "eclair_analyze base revision finished"
Paul Sokolovsky3ec4b362023-09-02 21:30:24 +0300234 eclair_make_ecd
235 eclair_make_reports
236
237 eclair_make_delta_report ECLAIR_BASE ECLAIR
238 tf-ci-scripts/eclair/eclair_diff_report.py diff_output > misra_delta.txt
239
240 returnLicense
241 tf-ci-scripts/eclair/analyze_delta_index_html.sh
242 tf-ci-scripts/eclair/post_gerrit_comment.sh
243
244 publishers:
245 - archive:
246 artifacts: ECLAIR*/**, diff_output/**, misra_delta.txt, *issues_html/**, index.html
247 excludes: 'ECLAIR*/out/.data/**'
248 latest-only: false
249 allow-empty: true