https://gitlab.com/tezos/tezos
Raw File
Tip revision: 13ed79eca064a1c4f7189b24a7b51b50008f1973 authored by Marina Polubelova on 17 October 2023, 09:22:05 UTC
lib_plompiler: use 4-bit lookup ops for Blake2
Tip revision: 13ed79e
report_coverage.sh
#!/bin/sh

set -eu

if [ -z "$(find "$BISECT_FILE" -maxdepth 1 -name '*.corrupt.json' -print -quit)" ]; then
    # Compute coverage
    make coverage-report
    # Rewrite the summary output to remove information points matching the coverage regexp below
    make coverage-report-summary | sed 's@Coverage: [[:digit:]]\+/[[:digit:]]\+ (\(.*%\))@Coverage: \1@'
    make coverage-report-cobertura
    exit 0
else
    # Corrupt coverage files were detected
    echo "Corrupted coverage files were generated by the following jobs, please report this in https://gitlab.com/tezos/tezos/-/issues/1529: ";
    find "$BISECT_FILE" -maxdepth 1 -name '*.corrupt.json' -exec \
             jq -r '"  • Job `" + .job_name + "` (" + .job_web_url + ")"' \{\} \;

    if [ "${SLACK_COVERAGE_TOKEN:-}" != "" ]; then
        slack_msg=$(
            echo "⚠️ Corrupted coverage file(s) found in pipeline <$CI_PIPELINE_URL|#$CI_PIPELINE_ID> ⚠️"
            echo
            find "$BISECT_FILE" -maxdepth 1 -name '*.corrupt.json' -exec \
                 jq -r '"  • Job <" + .job_web_url + "|#" + (.job_id|tostring) + "> (`" + .job_name + "`)"' \{\} \;
        )
        curl --silent \
             -H "Authorization: Bearer $SLACK_COVERAGE_TOKEN" \
             -d "channel=$SLACK_COVERAGE_CHANNEL" \
             -d "text=${slack_msg}" \
             -X POST https://slack.com/api/chat.postMessage -o slack-response.json
        jq --exit-status '.ok' < slack-response.json > /dev/null || {
            echo "Slack notification unsuccessful, response received:";
            jq < slack-response.json;
            exit 1;
        }
        echo "Slack notification posted to channel $SLACK_COVERAGE_CHANNEL"
    fi

    exit 64
fi
back to top