2017-05-11 18:52:17 -04:00
|
|
|
#!/usr/bin/env bash
|
2017-05-25 12:41:56 -04:00
|
|
|
#
|
|
|
|
# Build a binary for all supported platforms
|
|
|
|
#
|
2017-05-09 12:38:23 -04:00
|
|
|
|
2017-05-11 18:52:17 -04:00
|
|
|
set -eu -o pipefail
|
|
|
|
|
2017-05-15 17:59:51 -04:00
|
|
|
BUILDDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
2017-06-15 18:00:36 -04:00
|
|
|
export SHELL=bash
|
2017-05-11 18:52:17 -04:00
|
|
|
|
2017-06-15 18:00:36 -04:00
|
|
|
jobs=(
|
2017-05-12 12:07:57 -04:00
|
|
|
"$BUILDDIR/windows" \
|
|
|
|
"$BUILDDIR/osx" \
|
2017-05-25 12:41:56 -04:00
|
|
|
"GOOS=linux GOARCH=amd64 $BUILDDIR/binary" \
|
|
|
|
"GOOS=linux GOARCH=arm $BUILDDIR/binary" \
|
|
|
|
"GOOS=linux GOARCH=ppc64le $BUILDDIR/binary" \
|
|
|
|
"GOOS=linux GOARCH=s390x $BUILDDIR/binary" \
|
2017-06-15 18:00:36 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
# Outside of circleCI run all at once. On circleCI run two at a time because
|
2017-07-18 08:17:17 -04:00
|
|
|
# each container has access to two cores.
|
2017-06-15 18:00:36 -04:00
|
|
|
group=${CROSS_GROUP-"all"}
|
|
|
|
|
2019-02-26 06:09:21 -05:00
|
|
|
if [ "$group" = "all" ]; then
|
2017-06-15 18:00:36 -04:00
|
|
|
|
|
|
|
echo "Building binaries for all platforms"
|
|
|
|
parallel ::: "${jobs[@]}"
|
|
|
|
exit 0
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
2017-07-18 08:17:17 -04:00
|
|
|
declare -i start="$group*2"
|
2017-06-15 18:00:36 -04:00
|
|
|
parallel ::: "${jobs[@]:$start:2}"
|