blob: 8603416094f39d4cb5d8aab6707688de26dea6e7 (
plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
#!/usr/bin/env bash
# build.sh - Performs a build on the branch
#
# Syntax: build.sh
#
# Usage: Can be used by either Travis or an ephermal build machine
#
# Examples: scripts/travis/build.sh
MAKE_DEBUG_OPTION=""
while [ "$1" != "" ]; do
case "$1" in
--make_debug)
shift
MAKE_DEBUG_OPTION="1"
;;
*)
echo "Unknown option" "$1"
exit 1
;;
esac
shift
done
# turn off exit on error
set +e
set -x
# $1 - Message
LAST_DURATION=$SECONDS
function duration() {
ELAPSED=$((SECONDS - $LAST_DURATION))
printf "Duration: '%s' - %02dh:%02dm:%02ds\n" "$1" $(($ELAPSED/3600)) $(($ELAPSED%3600/60)) $(($ELAPSED%60))
LAST_DURATION=$SECONDS
}
CONFIGURE_SUCCESS=false
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
OS=$("${SCRIPTPATH}/../ostype.sh")
ARCH=$("${SCRIPTPATH}/../archtype.sh")
# Get the go build version.
if [ -z "${SKIP_GO_INSTALLATION}" ]; then
GOLANG_VERSION=$(./scripts/get_golang_version.sh)
curl -sL -o ~/gimme https://raw.githubusercontent.com/travis-ci/gimme/master/gimme
chmod +x ~/gimme
eval "$(~/gimme "${GOLANG_VERSION}")"
fi
# travis sometimes fail to download a dependency. trying multiple times might help.
for (( attempt=1; attempt<=5; attempt++ ))
do
scripts/travis/configure_dev.sh
ERR=$?
if [ "${ERR}" == "0" ]; then
CONFIGURE_SUCCESS=true
break
fi
echo "Running configure_dev.sh resulted in exit code ${ERR}; retrying in 3 seconds"
sleep 3s
done
duration "configure_dev.sh"
if [ "${CONFIGURE_SUCCESS}" = "false" ]; then
echo "Attempted to configure the environment multiple times, and failed. See above logs for details."
exit 1
fi
set -e
scripts/travis/before_build.sh
duration "before_build.sh"
if [ "${OS}-${ARCH}" = "linux-arm" ] || [ "${OS}-${ARCH}" = "windows-amd64" ]; then
# for arm, build just the basic distro
# for windows, we still have some issues with the enlistment checking, so we'll make it simple for now.
MAKE_DEBUG_OPTION=""
fi
if [ "${MAKE_DEBUG_OPTION}" != "" ]; then
make build build-race
duration "make build build-race"
else
make build
duration "make build"
fi
|