forked from haskell/cabal
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtravis-common.sh
More file actions
38 lines (29 loc) · 838 Bytes
/
Copy pathtravis-common.sh
File metadata and controls
38 lines (29 loc) · 838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
set -e
HACKAGE_REPO_TOOL_VERSION="0.1.1"
CABAL_VERSION="2.1.0.0"
# ---------------------------------------------------------------------
# Timing / diagnostic output
# ---------------------------------------------------------------------
JOB_START_TIME=$(date +%s)
timed() {
echo "\$ $*"
start_time=$(date +%s)
# Run the job
$* || exit $?
# Calculate the durations
end_time=$(date +%s)
duration=$((end_time - start_time))
total_duration=$((end_time - JOB_START_TIME))
# Print them
echo "$* took $duration seconds."
echo "whole job took $total_duration seconds so far."
# Terminate on OSX
if [ $total_duration -ge 2400 -a $(uname) = "Darwin" ]; then
echo "Job taking over 40 minutes. Terminating"
exit 1
fi
echo "----"
}
travis_retry () {
$* || (sleep 1 && $*) || (sleep 2 && $*)
}