tf-m-eclair-daily: Daily ECLAIR job for MISRA testing

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Change-Id: I097f4e91cd541329016f0f314807d9067ee4c00f
diff --git a/tf-m-eclair-daily.yaml b/tf-m-eclair-daily.yaml
new file mode 100644
index 0000000..8ebba4c
--- /dev/null
+++ b/tf-m-eclair-daily.yaml
@@ -0,0 +1,154 @@
+- job:
+    name: tf-m-eclair-daily
+    node: docker-tf-m-eclair
+    project-type: freestyle
+    concurrent: true
+    disabled: false
+    defaults: global
+    Description: |
+      ECLAIR (MISRA) analysis for Trusted Firmware M
+    properties:
+        - build-discarder:
+            days-to-keep: 60
+            artifact-num-to-keep: 40
+    parameters:
+      - string:
+          name: 'FILTER_GROUP'
+          default: "misra"
+          description: |
+            Filter to a group of configurations as recognised by configs.py
+      - string:
+          name: 'CODE_REPO'
+          default: 'https://git.trustedfirmware.org/TF-M/trusted-firmware-m'
+      - string:
+          name: 'CI_SCRIPTS_REPO'
+          default: 'https://git.trustedfirmware.org/ci/tf-m-ci-scripts'
+      - string:
+          name: 'CI_SCRIPTS_BRANCH'
+          default: 'master'
+      - string:
+          name: 'GERRIT_REFSPEC'
+          default: 'refs/heads/master'
+          description: |
+            For use when triggering with specified tag or master 'refs/heads/master' or 'refs/tags/TF-Mv1.0'.
+      - string:
+          name: 'GERRIT_BRANCH'
+          default: 'master'
+          description: |
+            TF-M branch.
+      - string:
+          name: 'GERRIT_HOST'
+          description: |
+            No need to change.
+      - string:
+          name: 'GERRIT_CHANGE_NUMBER'
+          description: |
+            No need to change.
+      - string:
+          name: 'GERRIT_PATCHSET_REVISION'
+          description: |
+            No need to change.
+      - string:
+          name: 'MBEDTLS_VERSION'
+          default: 'mbedtls-3.4.0'
+          description: |
+            Specify which MBEDTLS version to use
+            refs/heads/<branch_name> : Pick up latest HEAD on branch
+            TAG_NAME                 : Pick up a tagged version
+            full commit hash         : Pick up a specific commit
+      - string:
+          name: 'MBEDTLS_URL'
+          default: 'https://git.trustedfirmware.org/mirror/mbed-tls.git'
+      - string:
+          name: 'QCBOR_URL'
+          default: 'https://github.com/laurencelundblade/QCBOR.git'
+      - string:
+          name: 'QCBOR_VERSION'
+          default: '92d3f89030baff4af7be8396c563e6c8ef263622'
+          description: |
+            Specify which QCBOR version to use
+            refs/heads/<branch_name> : Pick up latest HEAD on branch
+            TAG_NAME                 : Pick up a tagged version
+            full commit hash         : Pick up a specific commit
+      - string:
+          name: 'MCUBOOT_REFSPEC'
+          default: 'v1.10.0'
+          description: |
+            Specify which MCUboot version to use
+            refs/heads/<branch_name> : Pick up latest HEAD on branch
+            TAG_NAME                 : Pick up a tagged version
+            full commit hash         : Pick up a specific commit
+      - string:
+          name: 'MCUBOOT_URL'
+          default: 'https://git.trustedfirmware.org/mirror/mcuboot.git'
+      - string:
+          name: 'TFM_TESTS_URL'
+          default: 'https://git.trustedfirmware.org/TF-M/tf-m-tests.git'
+      - string:
+          name: 'TFM_TESTS_REFSPEC'
+          default: 'refs/heads/master'
+      - string:
+          name: 'PSA_ARCH_TESTS_URL'
+          default: 'https://git.trustedfirmware.org/mirror/psa-arch-tests.git'
+      - string:
+          name: 'PSA_ARCH_TESTS_VERSION'
+          default: '5c5792080f0975775bbdddcd9722da446dce550b'
+      - string:
+          name: SHARE_FOLDER
+          default: '/srv/shared/${JOB_NAME}/${BUILD_NUMBER}'
+          description: 'Folder containing shared repositories for downstream pipeline jobs'
+      - string:
+          name: 'BUILD_TARGET'
+          default: ''
+          description: |
+            Override build target (for debugging)
+      - string:
+          name: 'BUILD_JOBS'
+          default: '16'
+          description: |
+            --jobs to pass to make, etc.
+    wrappers:
+        - timestamps
+        - timeout:
+            timeout: 2400
+            fail: true
+    builders:
+        - shell: |
+            #!/bin/bash -ex
+            git clone -b $CI_SCRIPTS_BRANCH $CI_SCRIPTS_REPO tf-m-ci-scripts
+            git clone -b master https://git.trustedfirmware.org/ci/tf-ci-scripts.git tf-ci-scripts
+            tf-m-ci-scripts/clone.sh
+
+            export ECLAIR_CONFIG_DIR=$PWD/tf-m-ci-scripts/eclair
+            . tf-ci-scripts/eclair/utils.sh
+            . tf-m-ci-scripts/eclair/utils_tfm.sh
+
+            export CROSS_COMPILE="arm-none-eabi-"
+            export CC_ALIASES="${CROSS_COMPILE}gcc"
+            export CXX_ALIASES="${CROSS_COMPILE}g++"
+            export LD_ALIASES="${CROSS_COMPILE}ld"
+            export AR_ALIASES="${CROSS_COMPILE}ar"
+            export AS_ALIASES="${CROSS_COMPILE}as"
+            export FILEMANIP_ALIASES="cp mv ${CROSS_COMPILE}objcopy"
+
+            # Detach license for initial eclair_env invocation. We then extend it on
+            # each config build iteration.
+            detachLicense 600
+
+            # Toolchain path must be already set before calling eclair_env, can't set it inside it.
+            # And to set toolchain path, we need a CONFIG_NAME
+            CONFIG_NAME=$(python3 tf-m-ci-scripts/configs.py -g $FILTER_GROUP | head -1)
+            eclair_tfm_set_toolchain_path
+
+            export ECLAIR_ANALYSIS=ECLAIR
+            eclair_prepare
+            eclair_analyze tf-m-ci-scripts/run-eclair-builds.sh
+            eclair_make_ecd
+            eclair_make_reports
+            tf-ci-scripts/eclair/analyze_index_html.sh
+
+    publishers:
+        - archive:
+            artifacts: ECLAIR/**, index.html
+            latest-only: false
+            allow-empty: true