1#!/bin/sh -eu 2 3ECLAIR_ANALYSIS_DIR=automation/eclair_analysis 4ECLAIR_DIR="${ECLAIR_ANALYSIS_DIR}/ECLAIR" 5ECLAIR_OUTPUT_DIR=$(realpath "${ECLAIR_OUTPUT_DIR}") 6# All paths mentioned in ECLAIR reports that are below this directory 7# will be presented as relative to ECLAIR_PROJECT_ROOT. 8export ECLAIR_PROJECT_ROOT="${PWD}" 9 10"${ECLAIR_ANALYSIS_DIR}/prepare.sh" "${VARIANT}" 11 12ex=0 13"${ECLAIR_DIR}/analyze.sh" "${VARIANT}" "${RULESET}" || ex=$? 14"${ECLAIR_DIR}/action_log.sh" ANALYSIS_LOG \ 15 "ECLAIR analysis log" \ 16 "${ECLAIR_OUTPUT_DIR}/ANALYSIS.log" \ 17 "${ex}" 18"${ECLAIR_DIR}/action_log.sh" REPORT_LOG \ 19 "ECLAIR report log" \ 20 "${ECLAIR_OUTPUT_DIR}/REPORT.log" \ 21 "${ex}" 22[ "${ex}" = 0 ] || exit "${ex}" 23 24# Fail in case of new reports for clean guidelines 25"${ECLAIR_DIR}/action_check_clean_regressions.sh" "${ECLAIR_OUTPUT_DIR}" || ex=$? 26 27case "${CI_PIPELINE_SOURCE}" in 28merge_request_event) 29 "${ECLAIR_DIR}/action_pull_request.sh" "${WTOKEN}" "${ECLAIR_OUTPUT_DIR}" 30 ;; 31push | pipeline | web | schedule) 32 "${ECLAIR_DIR}/action_push.sh" "${WTOKEN}" "${ECLAIR_OUTPUT_DIR}" 33 ;; 34*) 35 echo "Unexpected event ${CI_PIPELINE_SOURCE}" >&2 36 ex=1 37 ;; 38esac 39[ "${ex}" = 0 ] || exit "${ex}" 40