Xinyu Zhang | 15f8d75 | 2023-09-13 19:41:35 +0800 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
| 2 | # Copyright (c) 2023, Arm Limited. All rights reserved. |
| 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | |
Paul Sokolovsky | 3ec4b36 | 2023-09-02 21:30:24 +0300 | [diff] [blame] | 8 | - job: |
| 9 | name: tf-m-eclair-delta |
Paul Sokolovsky | db05ab5 | 2024-01-21 10:23:00 +0700 | [diff] [blame] | 10 | node: docker-tf-m-eclair-3.13 |
Paul Sokolovsky | 3ec4b36 | 2023-09-02 21:30:24 +0300 | [diff] [blame] | 11 | 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 Zhang | 8450cc9 | 2023-09-21 16:46:13 +0800 | [diff] [blame] | 38 | default: 'refs/heads/main' |
Paul Sokolovsky | 3ec4b36 | 2023-09-02 21:30:24 +0300 | [diff] [blame] | 39 | description: | |
Xinyu Zhang | 8450cc9 | 2023-09-21 16:46:13 +0800 | [diff] [blame] | 40 | For use when triggering with specified tag or master 'refs/heads/main' or 'refs/tags/TF-Mv1.0'. |
Paul Sokolovsky | 3ec4b36 | 2023-09-02 21:30:24 +0300 | [diff] [blame] | 41 | - string: |
| 42 | name: 'GERRIT_BRANCH' |
Xinyu Zhang | 8450cc9 | 2023-09-21 16:46:13 +0800 | [diff] [blame] | 43 | default: 'main' |
Paul Sokolovsky | 3ec4b36 | 2023-09-02 21:30:24 +0300 | [diff] [blame] | 44 | 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 Sokolovsky | 7923a48 | 2023-09-13 22:54:10 +0300 | [diff] [blame] | 64 | default: '' |
Paul Sokolovsky | 3ec4b36 | 2023-09-02 21:30:24 +0300 | [diff] [blame] | 65 | 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 Sokolovsky | eada3ab | 2023-09-13 23:28:59 +0300 | [diff] [blame] | 78 | default: '' |
Paul Sokolovsky | 3ec4b36 | 2023-09-02 21:30:24 +0300 | [diff] [blame] | 79 | 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 Sokolovsky | eada3ab | 2023-09-13 23:28:59 +0300 | [diff] [blame] | 86 | default: '' |
Paul Sokolovsky | 3ec4b36 | 2023-09-02 21:30:24 +0300 | [diff] [blame] | 87 | 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 Sokolovsky | eada3ab | 2023-09-13 23:28:59 +0300 | [diff] [blame] | 100 | default: '' |
Paul Sokolovsky | 3ec4b36 | 2023-09-02 21:30:24 +0300 | [diff] [blame] | 101 | - 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 Sokolovsky | eada3ab | 2023-09-13 23:28:59 +0300 | [diff] [blame] | 106 | default: '' |
Paul Sokolovsky | 3ec4b36 | 2023-09-02 21:30:24 +0300 | [diff] [blame] | 107 | - 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 Zhang | 15f8d75 | 2023-09-13 19:41:35 +0800 | [diff] [blame] | 128 | branch-pattern: eclair |
Paul Sokolovsky | 3ec4b36 | 2023-09-02 21:30:24 +0300 | [diff] [blame] | 129 | 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 Sokolovsky | 757b945 | 2024-01-19 10:31:47 +0700 | [diff] [blame] | 196 | echo "eclair_analyze target revision finished" |
Paul Sokolovsky | 3ec4b36 | 2023-09-02 21:30:24 +0300 | [diff] [blame] | 197 | 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 Sokolovsky | 757b945 | 2024-01-19 10:31:47 +0700 | [diff] [blame] | 211 | echo "eclair_analyze base revision finished" |
Paul Sokolovsky | 3ec4b36 | 2023-09-02 21:30:24 +0300 | [diff] [blame] | 212 | 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 |