File tree Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -51,13 +51,32 @@ before_install:
51
51
export PHPUNIT_X="$PHPUNIT --exclude-group tty,benchmark,intl-data"
52
52
export COMPOSER_UP='composer update --no-progress --no-suggest --ansi'
53
53
54
+ nanoseconds() {
55
+ local cmd="date"
56
+ local format="+%s%N"
57
+ local os=$(uname)
58
+ if hash gdate > /dev/null 2>&1; then
59
+ cmd="gdate"
60
+ elif [[ "$os" = Darwin ]]; then
61
+ format="+%s000000000"
62
+ fi
63
+ $cmd -u $format
64
+ }
65
+ export -f nanoseconds
66
+
54
67
# tfold is a helper to create folded reports
55
68
tfold () {
56
- title=$1
57
- fold=$(echo $title | sed -r 's/[^-_A-Za-z\d ]+/./g')
69
+ local title=$1
70
+ local fold=$(echo $title | sed -r 's/[^-_A-Za-z0-9 ]+/./g')
58
71
shift
72
+ local timer_id=$(printf %08x $(( RANDOM * RANDOM )))
73
+ local start_time=$(nanoseconds)
74
+ echo -e "travis_time:start:$timer_id"
59
75
echo -e "travis_fold:start:$fold\\n\\e[1;34m$title\\e[0m"
60
- bash -xc "$*" 2>&1 &&
76
+ bash -xc "$*" 2>&1 && (
77
+ end_time=$(nanoseconds)
78
+ duration=$(($end_time-$start_time))
79
+ echo -e "travis_time:end:$timer_id:start=$start_time,finish=$end_time,duration=$duration" ) &&
61
80
echo -e "\\e[32mOK\\e[0m $title\\n\\ntravis_fold:end:$fold" ||
62
81
( echo -e "\\e[41mKO\\e[0m $title\\n" && exit 1 )
63
82
}
You can’t perform that action at this time.
0 commit comments