blob: 21cce4909401163033b6eeb21838999514bbc09e [file] [log] [blame]
Junxiao Shi439d9722015-03-20 15:08:44 -07001#!/usr/bin/env bash
2set -e
Davide Pesaventod8398822020-03-29 18:46:19 -04003source .jenkins.d/util.sh
Junxiao Shi439d9722015-03-20 15:08:44 -07004
Davide Pesavento8c353902021-08-30 19:10:36 -04005if has Linux $NODE_LABELS; then
6 export PATH="~/.local/bin${PATH:+:}${PATH}"
7fi
Davide Pesaventod8398822020-03-29 18:46:19 -04008export CACHE_DIR=${CACHE_DIR:-/tmp}
Davide Pesaventoa1a9d702020-03-29 00:58:15 -04009export WAF_JOBS=${WAF_JOBS:-1}
Davide Pesaventod5c24472020-04-01 17:46:18 -040010[[ $JOB_NAME == *"code-coverage" ]] && export DISABLE_ASAN=yes
Davide Pesaventoa1a9d702020-03-29 00:58:15 -040011
Davide Pesaventocbef7b82019-10-09 00:15:13 -040012nanos() {
13 # Cannot use date(1) because macOS does not support %N format specifier
Davide Pesaventoa1a9d702020-03-29 00:58:15 -040014 python3 -c 'import time; print(int(time.time() * 1e9))'
Davide Pesaventocbef7b82019-10-09 00:15:13 -040015}
Junxiao Shi439d9722015-03-20 15:08:44 -070016
Davide Pesaventocbef7b82019-10-09 00:15:13 -040017for file in .jenkins.d/*; do
Junxiao Shi439d9722015-03-20 15:08:44 -070018 [[ -f $file && -x $file ]] || continue
Davide Pesaventocbef7b82019-10-09 00:15:13 -040019
Davide Pesaventoe8c82ef2021-07-28 02:38:51 -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 Pesaventocbef7b82019-10-09 00:15:13 -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"
Junxiao Shi439d9722015-03-20 15:08:44 -070030 "$file"
Davide Pesaventocbef7b82019-10-09 00:15:13 -040031
Davide Pesaventoe8c82ef2021-07-28 02:38:51 -040032 if [[ -n $GITHUB_ACTIONS ]]; then
33 echo "::endgroup::"
34 elif [[ -n $TRAVIS ]]; then
Davide Pesaventocbef7b82019-10-09 00:15:13 -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
Junxiao Shi439d9722015-03-20 15:08:44 -070039done