blob: 78e1ca13502de03cee35740804e8c22b6d20b37c [file] [log] [blame]
Alexander Afanasyeva87e0a82014-10-21 14:09:19 -04001#!/usr/bin/env bash
Alexander Afanasyev33ce4c32014-10-24 11:19:45 -07002set -e
Alexander Afanasyeva87e0a82014-10-21 14:09:19 -04003
Davide Pesaventoe6e125e2019-10-08 18:08:36 -04004nanos() {
5 # Cannot use date(1) because macOS does not support %N format specifier
6 python -c 'import time; print(int(time.time() * 1e9))'
7}
Alexander Afanasyeva87e0a82014-10-21 14:09:19 -04008
Davide Pesaventoe6e125e2019-10-08 18:08:36 -04009for file in .jenkins.d/*; do
Alexander Afanasyeve7490032014-12-11 12:40:53 -080010 [[ -f $file && -x $file ]] || continue
Davide Pesaventoe6e125e2019-10-08 18:08:36 -040011
12 if [[ -n $TRAVIS ]]; then
13 label=$(basename "$file" | sed -E 's/[[:digit:]]+-(.*)\..*/\1/')
14 echo -ne "travis_fold:start:${label}\r"
15 echo -ne "travis_time:start:${label}\r"
16 start=$(nanos)
17 fi
18
19 echo "\$ $file"
Alexander Afanasyeve7490032014-12-11 12:40:53 -080020 "$file"
Davide Pesaventoe6e125e2019-10-08 18:08:36 -040021
22 if [[ -n $TRAVIS ]]; then
23 finish=$(nanos)
24 echo -ne "travis_time:end:${label}:start=${start},finish=${finish},duration=$((finish-start)),event=${label}\r"
25 echo -ne "travis_fold:end:${label}\r"
26 fi
Alexander Afanasyeva87e0a82014-10-21 14:09:19 -040027done