Alexander Afanasyev | a87e0a8 | 2014-10-21 14:09:19 -0400 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Alexander Afanasyev | 33ce4c3 | 2014-10-24 11:19:45 -0700 | [diff] [blame] | 2 | set -e |
Alexander Afanasyev | a87e0a8 | 2014-10-21 14:09:19 -0400 | [diff] [blame] | 3 | |
Davide Pesavento | e6e125e | 2019-10-08 18:08:36 -0400 | [diff] [blame] | 4 | nanos() { |
| 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 Afanasyev | a87e0a8 | 2014-10-21 14:09:19 -0400 | [diff] [blame] | 8 | |
Davide Pesavento | e6e125e | 2019-10-08 18:08:36 -0400 | [diff] [blame] | 9 | for file in .jenkins.d/*; do |
Alexander Afanasyev | e749003 | 2014-12-11 12:40:53 -0800 | [diff] [blame] | 10 | [[ -f $file && -x $file ]] || continue |
Davide Pesavento | e6e125e | 2019-10-08 18:08:36 -0400 | [diff] [blame] | 11 | |
| 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 Afanasyev | e749003 | 2014-12-11 12:40:53 -0800 | [diff] [blame] | 20 | "$file" |
Davide Pesavento | e6e125e | 2019-10-08 18:08:36 -0400 | [diff] [blame] | 21 | |
| 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 Afanasyev | a87e0a8 | 2014-10-21 14:09:19 -0400 | [diff] [blame] | 27 | done |