From 4a750d5aff363bd9cba4459b8ad81cc077428a5d Mon Sep 17 00:00:00 2001 From: Chris Waldon Date: Sat, 19 Jan 2019 12:24:47 -0500 Subject: [PATCH 1/2] Support all valid architectures for target OSes --- build-releases.sh | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/build-releases.sh b/build-releases.sh index 0c3bb31..2d04693 100755 --- a/build-releases.sh +++ b/build-releases.sh @@ -9,7 +9,7 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" ] || [ "$TRAVIS_BRANCH" != "master" ]; th fi # get hub if we don't have it -if ! command -v hub 2>&1 > /dev/null ; then +if ! command -v hub > /dev/null 2>&1 ; then go get github.com/github/hub fi @@ -19,7 +19,7 @@ head_commit="$(git rev-parse HEAD 2> /dev/null)" # build pre-release if not on a tag, otherwise build release if ! git describe --tags --exact-match HEAD > /dev/null 2>&1 ; then echo "Building pre-release, not tagged commit" - readonly tag="release-$(echo ${head_commit} | head -c 7)" + readonly tag="release-$(echo "$head_commit" | head -c 7)" release_flags="--prerelease" else echo "Building release, tagged commit" @@ -30,14 +30,22 @@ readonly project="muscadine" readonly bin_name="$project" readonly message="Automatic build" +declare -A arch_for_os +arch_for_os["darwin"]="386 amd64 arm arm64" +arch_for_os["windows"]="386 amd64" +arch_for_os["linux"]="386 amd64 arm arm64 ppc64 ppc64le mips mipsle mips64 mips64le s390x" +arch_for_os["openbsd"]="386 amd64 arm" + # create the release and upload artifacts hub release create $release_flags --message="$message" --commitish="$head_commit" "$tag" for os in darwin linux windows openbsd; do - archive_name="$project-$os.tar.gz" - echo "Building $project for $os" - env GOOS="$os" CGO_ENABLED=0 go build -o "$bin_name" &&\ - tar czf "$archive_name" "$bin_name" &&\ - rm "$bin_name" - echo "Adding $archive_name to release $tag" - hub release edit --message="$message" --attach="$archive_name#muscadine_${os}" "$tag" + for arch in ${arch_for_os["$os"]}; do + archive_name="$project-$os-$arch.tar.gz" + echo "Building $project for $os on $arch" + env GOOS="$os" GOARCH="$arch" CGO_ENABLED=0 go build -o "$bin_name" &&\ + tar czf "$archive_name" "$bin_name" &&\ + rm "$bin_name" + echo "Adding $archive_name to release $tag" + hub release edit --message="$message" --attach="$archive_name#muscadine_${os}_${arch}" "$tag" + done done From 2f1d88d79489861b4c57830b1066257b66041008 Mon Sep 17 00:00:00 2001 From: Chris Waldon Date: Sat, 19 Jan 2019 12:35:42 -0500 Subject: [PATCH 2/2] Use architectures that compile --- build-releases.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build-releases.sh b/build-releases.sh index 2d04693..c59f7c2 100755 --- a/build-releases.sh +++ b/build-releases.sh @@ -31,10 +31,10 @@ readonly bin_name="$project" readonly message="Automatic build" declare -A arch_for_os -arch_for_os["darwin"]="386 amd64 arm arm64" -arch_for_os["windows"]="386 amd64" -arch_for_os["linux"]="386 amd64 arm arm64 ppc64 ppc64le mips mipsle mips64 mips64le s390x" -arch_for_os["openbsd"]="386 amd64 arm" +arch_for_os["darwin"]="amd64" +arch_for_os["windows"]="amd64" +arch_for_os["linux"]="amd64 arm64 ppc64 ppc64le mips64 mips64le s390x" +arch_for_os["openbsd"]="amd64" # create the release and upload artifacts hub release create $release_flags --message="$message" --commitish="$head_commit" "$tag"