blob: bbd6fc155196ead579fa0aab59265d6d5af84e6e [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:
85 name: 'MCUBOOT_REFSPEC'
Paul Sokolovskyeada3ab2023-09-13 23:28:59 +030086 default: ''
Paul Sokolovsky3ec4b362023-09-02 21:30:24 +030087 description: |
88 Specify which MCUboot version to use
89 refs/heads/<branch_name> : Pick up latest HEAD on branch
90 TAG_NAME : Pick up a tagged version
91 full commit hash : Pick up a specific commit
92 - string:
93 name: 'MCUBOOT_URL'
94 default: 'https://git.trustedfirmware.org/mirror/mcuboot.git'
95 - string:
96 name: 'TFM_TESTS_URL'
97 default: 'https://git.trustedfirmware.org/TF-M/tf-m-tests.git'
98 - string:
99 name: 'TFM_TESTS_REFSPEC'
Paul Sokolovskyeada3ab2023-09-13 23:28:59 +0300100 default: ''
Paul Sokolovsky3ec4b362023-09-02 21:30:24 +0300101 - string:
102 name: 'PSA_ARCH_TESTS_URL'
103 default: 'https://git.trustedfirmware.org/mirror/psa-arch-tests.git'
104 - string:
105 name: 'PSA_ARCH_TESTS_VERSION'
Paul Sokolovskyeada3ab2023-09-13 23:28:59 +0300106 default: ''
Paul Sokolovsky3ec4b362023-09-02 21:30:24 +0300107 - string:
108 name: SHARE_FOLDER
109 default: '/tmp'
110 description: 'Folder for initial cloning of repositories'
111 - string:
112 name: 'BUILD_TARGET'
113 default: ''
114 description: |
115 Override build target (for debugging)
116 - string:
117 name: 'BUILD_JOBS'
118 default: '16'
119 description: |
120 --jobs to pass to make, etc.
121 triggers:
122 - gerrit:
123 silent: true
124 server-name: 'review.trustedfirmware.org'
125 projects:
126 - branches:
127 - branch-compare-type: PLAIN
Xinyu Zhang15f8d752023-09-13 19:41:35 +0800128 branch-pattern: eclair
Paul Sokolovsky3ec4b362023-09-02 21:30:24 +0300129 project-compare-type: PLAIN
130 project-pattern: 'TF-M/trusted-firmware-m'
131 - branches:
132 - branch-compare-type: PLAIN
133 branch-pattern: master
134 project-compare-type: PLAIN
135 project-pattern: 'sandbox/pfalcon/trusted-firmware-m'
136 trigger-on:
137 - comment-added-event:
138 approval-category: "Allow-CI"
139 approval-value: 1
140 - comment-added-event:
141 approval-category: "Allow-CI"
142 approval-value: 2
143 wrappers:
144 - timestamps
145 - timeout:
146 timeout: 2400
147 fail: true
148 - credentials-binding:
149 - ssh-user-private-key:
150 credential-id: TFA_CI_BOT_USER_SSH_KEY
151 key-file-variable: CI_BOT_KEY
152 username-variable: CI_BOT_USERNAME
153 passphrase-variable: ''
154 builders:
155 - shell: |
156 #!/bin/bash -ex
157 git clone -b $CI_SCRIPTS_BRANCH $CI_SCRIPTS_REPO tf-m-ci-scripts
158 git clone -b master https://git.trustedfirmware.org/ci/tf-ci-scripts.git tf-ci-scripts
159 bash -x tf-m-ci-scripts/clone.sh
160
161 ls -l
162 if [ -n "${GERRIT_REFSPEC}" ]; then
163 (
164 cd $(basename ${GERRIT_PROJECT})
165 git fetch https://${GERRIT_HOST}/${GERRIT_PROJECT} ${GERRIT_REFSPEC} && git checkout FETCH_HEAD
166 )
167 fi
168
169 (cd trusted-firmware-m; git log --oneline -n5)
170
171 export ECLAIR_CONFIG_DIR=$PWD/tf-m-ci-scripts/eclair
172 . tf-ci-scripts/eclair/utils.sh
173 . tf-m-ci-scripts/eclair/utils_tfm.sh
174
175 export CROSS_COMPILE="arm-none-eabi-"
176 export CC_ALIASES="${CROSS_COMPILE}gcc"
177 export CXX_ALIASES="${CROSS_COMPILE}g++"
178 export LD_ALIASES="${CROSS_COMPILE}ld"
179 export AR_ALIASES="${CROSS_COMPILE}ar"
180 export AS_ALIASES="${CROSS_COMPILE}as"
181 export FILEMANIP_ALIASES="cp mv ${CROSS_COMPILE}objcopy"
182
183 # Detach license for initial eclair_env invocation. We then extend it on
184 # each config build iteration.
185 detachLicense 600
186 trap "returnLicense || true" EXIT
187
188 # Toolchain path must be already set before calling eclair_env, can't set it inside it.
189 # And to set toolchain path, we need a CONFIG_NAME
190 CONFIG_NAME=$(python3 tf-m-ci-scripts/configs.py -g $FILTER_GROUP | head -1)
191 eclair_tfm_set_toolchain_path
192
193 export ECLAIR_ANALYSIS=ECLAIR
194 eclair_prepare
195 eclair_analyze tf-m-ci-scripts/run-eclair-builds.sh
Paul Sokolovsky757b9452024-01-19 10:31:47 +0700196 echo "eclair_analyze target revision finished"
Paul Sokolovsky3ec4b362023-09-02 21:30:24 +0300197 eclair_make_ecd
198 eclair_make_reports
199
200 echo "========= Building base revision ========="
201
202 (
203 cd $(basename ${GERRIT_PROJECT})
204 git checkout HEAD^
205 git log --oneline -n5
206 )
207
208 export ECLAIR_ANALYSIS=ECLAIR_BASE
209 eclair_prepare
210 eclair_analyze tf-m-ci-scripts/run-eclair-builds.sh
Paul Sokolovsky757b9452024-01-19 10:31:47 +0700211 echo "eclair_analyze base revision finished"
Paul Sokolovsky3ec4b362023-09-02 21:30:24 +0300212 eclair_make_ecd
213 eclair_make_reports
214
215 eclair_make_delta_report ECLAIR_BASE ECLAIR
216 tf-ci-scripts/eclair/eclair_diff_report.py diff_output > misra_delta.txt
217
218 returnLicense
219 tf-ci-scripts/eclair/analyze_delta_index_html.sh
220 tf-ci-scripts/eclair/post_gerrit_comment.sh
221
222 publishers:
223 - archive:
224 artifacts: ECLAIR*/**, diff_output/**, misra_delta.txt, *issues_html/**, index.html
225 excludes: 'ECLAIR*/out/.data/**'
226 latest-only: false
227 allow-empty: true