blob: 21cce4909401163033b6eeb21838999514bbc09e [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 Pesavento09d56622021-08-23 17:44:25 -04005if has Linux $NODE_LABELS; then
6 export PATH="~/.local/bin${PATH:+:}${PATH}"
7fi
Davide Pesaventoab7300b2020-04-09 00:51:41 -04008export CACHE_DIR=${CACHE_DIR:-/tmp}
Davide Pesavento2349e282020-03-24 14:28:03 -04009export WAF_JOBS=${WAF_JOBS:-1}
Davide Pesaventoab7300b2020-04-09 00:51:41 -040010[[ $JOB_NAME == *"code-coverage" ]] && export DISABLE_ASAN=yes
Alexander Afanasyeva87e0a82014-10-21 14:09:19 -040011
Davide Pesaventoe6e125e2019-10-08 18:08:36 -040012nanos() {
13 # Cannot use date(1) because macOS does not support %N format specifier
Davide Pesaventod776a932020-03-20 18:42:36 -040014 python3 -c 'import time; print(int(time.time() * 1e9))'
Davide Pesaventoe6e125e2019-10-08 18:08:36 -040015}
Alexander Afanasyeva87e0a82014-10-21 14:09:19 -040016
Davide Pesaventoe6e125e2019-10-08 18:08:36 -040017for file in .jenkins.d/*; do
Alexander Afanasyeve7490032014-12-11 12:40:53 -080018 [[ -f $file && -x $file ]] || continue
Davide Pesaventoe6e125e2019-10-08 18:08:36 -040019
Davide Pesavento30ed6282021-07-25 20:05:06 -040020 label=$(basename "$file" | sed -E 's/[[:digit:]]+-(.*)\..*/\1/')
21 if [[ -n $GITHUB_ACTIONS ]]; then
22 echo "::group::${label}"
23 elif [[ -n $TRAVIS ]]; then
Davide Pesaventoe6e125e2019-10-08 18:08:36 -040024 echo -ne "travis_fold:start:${label}\r"
25 echo -ne "travis_time:start:${label}\r"
26 start=$(nanos)
27 fi
28
29 echo "\$ $file"
Alexander Afanasyeve7490032014-12-11 12:40:53 -080030 "$file"
Davide Pesaventoe6e125e2019-10-08 18:08:36 -040031
Davide Pesavento30ed6282021-07-25 20:05:06 -040032 if [[ -n $GITHUB_ACTIONS ]]; then
33 echo "::endgroup::"
34 elif [[ -n $TRAVIS ]]; then
Davide Pesaventoe6e125e2019-10-08 18:08:36 -040035 finish=$(nanos)
36 echo -ne "travis_time:end:${label}:start=${start},finish=${finish},duration=$((finish-start)),event=${label}\r"
37 echo -ne "travis_fold:end:${label}\r"
38 fi
Alexander Afanasyeva87e0a82014-10-21 14:09:19 -040039done