blob: 1a12b6cb3b83e676844c8f4589ebb06c5a904f19 [file] [log] [blame]
Alexander Afanasyeva87e0a82014-10-21 14:09:19 -04001#!/usr/bin/env bash
Alexander Afanasyev33ce4c32014-10-24 11:19:45 -07002set -e
Davide Pesavento2349e282020-03-24 14:28:03 -04003source .jenkins.d/util.sh
4
Davide Pesaventoab7300b2020-04-09 00:51:41 -04005export CACHE_DIR=${CACHE_DIR:-/tmp}
Davide Pesavento2349e282020-03-24 14:28:03 -04006export WAF_JOBS=${WAF_JOBS:-1}
Davide Pesaventoab7300b2020-04-09 00:51:41 -04007[[ $JOB_NAME == *"code-coverage" ]] && export DISABLE_ASAN=yes
Alexander Afanasyeva87e0a82014-10-21 14:09:19 -04008
Davide Pesaventoe6e125e2019-10-08 18:08:36 -04009nanos() {
10 # Cannot use date(1) because macOS does not support %N format specifier
Davide Pesaventod776a932020-03-20 18:42:36 -040011 python3 -c 'import time; print(int(time.time() * 1e9))'
Davide Pesaventoe6e125e2019-10-08 18:08:36 -040012}
Alexander Afanasyeva87e0a82014-10-21 14:09:19 -040013
Davide Pesaventoe6e125e2019-10-08 18:08:36 -040014for file in .jenkins.d/*; do
Alexander Afanasyeve7490032014-12-11 12:40:53 -080015 [[ -f $file && -x $file ]] || continue
Davide Pesaventoe6e125e2019-10-08 18:08:36 -040016
Davide Pesavento30ed6282021-07-25 20:05:06 -040017 label=$(basename "$file" | sed -E 's/[[:digit:]]+-(.*)\..*/\1/')
18 if [[ -n $GITHUB_ACTIONS ]]; then
19 echo "::group::${label}"
20 elif [[ -n $TRAVIS ]]; then
Davide Pesaventoe6e125e2019-10-08 18:08:36 -040021 echo -ne "travis_fold:start:${label}\r"
22 echo -ne "travis_time:start:${label}\r"
23 start=$(nanos)
24 fi
25
26 echo "\$ $file"
Alexander Afanasyeve7490032014-12-11 12:40:53 -080027 "$file"
Davide Pesaventoe6e125e2019-10-08 18:08:36 -040028
Davide Pesavento30ed6282021-07-25 20:05:06 -040029 if [[ -n $GITHUB_ACTIONS ]]; then
30 echo "::endgroup::"
31 elif [[ -n $TRAVIS ]]; then
Davide Pesaventoe6e125e2019-10-08 18:08:36 -040032 finish=$(nanos)
33 echo -ne "travis_time:end:${label}:start=${start},finish=${finish},duration=$((finish-start)),event=${label}\r"
34 echo -ne "travis_fold:end:${label}\r"
35 fi
Alexander Afanasyeva87e0a82014-10-21 14:09:19 -040036done