forked from algorand/go-algorand
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
testing: move travis_retry to skip rebuilding (algorand#2324)
Remove the top-level retry command. This will allow build / lint failures to terminate the build with no retry, and may speed up test failure retries.
- Loading branch information
Showing
5 changed files
with
51 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env bash | ||
|
||
# https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/bash/travis_retry.bash | ||
|
||
ANSI_RED="\033[31;1m" | ||
ANSI_RESET="\033[0m" | ||
|
||
travis_retry() { | ||
local result=0 | ||
local count=1 | ||
while [[ "${count}" -le 3 ]]; do | ||
[[ "${result}" -ne 0 ]] && { | ||
echo -e "\\n${ANSI_RED}The command \"${*}\" failed. Retrying, ${count} of 3.${ANSI_RESET}\\n" >&2 | ||
} | ||
# run the command in a way that doesn't disable setting `errexit` | ||
"${@}" | ||
result="${?}" | ||
if [[ $result -eq 0 ]]; then break; fi | ||
count="$((count + 1))" | ||
sleep 1 | ||
done | ||
|
||
[[ "${count}" -gt 3 ]] && { | ||
echo -e "\\n${ANSI_RED}The command \"${*}\" failed 3 times.${ANSI_RESET}\\n" >&2 | ||
} | ||
|
||
return "${result}" | ||
} | ||
|
||
travis_retry "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,4 +69,4 @@ travis_wait() { | |
return $result | ||
} | ||
|
||
travis_wait $@ | ||
travis_wait "$@" |