Skip to content
This repository was archived by the owner on Apr 13, 2024. It is now read-only.

Commit 7b6ba79

Browse files
committed
build-all.sh: Initial revision
This is a script that will run all of the builds that Travis does on a local user's machine. This can help validate changes faster than Travis can if the user has a very fast machine (like I do). [skip ci] Signed-off-by: Nathan Chancellor <[email protected]>
1 parent e42dfd6 commit 7b6ba79

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

build-all.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env bash
2+
# shellcheck disable=SC1117
3+
4+
function format_time() {(
5+
MINS=$(((${2} - ${1}) / 60))
6+
SECS=$(((${2} - ${1}) % 60))
7+
8+
if [[ ${MINS} -ge 60 ]]; then
9+
HOURS=$((MINS / 60))
10+
MINS=$((MINS % 60))
11+
fi
12+
13+
[[ -n ${HOURS} ]] && TIME_STRING="${HOURS}h "
14+
echo "${TIME_STRING}${MINS}m ${SECS}s"
15+
)}
16+
17+
BLD_ALL_START=$(date +%s)
18+
19+
echo
20+
grep "env:" .travis.yml | grep -v LLVM_VERSION | sed "s/.*env: //g" | while read -r ITEM; do (
21+
DRIVER_START=$(date +%s)
22+
read -ra VALUES <<< "${ITEM}"
23+
for VALUE in "${VALUES[@]}"; do
24+
export "${VALUE:?}"
25+
done
26+
27+
# Make sure that the version suffix is stripped for local builds,
28+
# where it is assumed that the user will be using a tip of tree build
29+
[[ -n ${LD} ]] && export LD=${LD//-*}
30+
31+
echo -e "Running '${ARCH:+ARCH=${ARCH} }${LD:+LD=${LD} }${REPO:+REPO=${REPO} }./driver.sh'... \c"
32+
if ! ./driver.sh "${@}" &>/dev/null; then
33+
echo -e "\033[01;31mFailed\033[0m\c"
34+
else
35+
echo -e "\033[01;32mSuccessful\033[0m\c"
36+
fi
37+
echo " in $(format_time "${DRIVER_START}" "$(date +%s)")"
38+
) done
39+
40+
echo
41+
echo "Total script time: $(format_time "${BLD_ALL_START}" "$(date +%s)")"
42+
echo

0 commit comments

Comments
 (0)