From 2304d03b4094d6db3893c64ea3a9105a77e6f98b Mon Sep 17 00:00:00 2001 From: Cameron Sparr Date: Tue, 18 Aug 2015 09:21:14 -0600 Subject: [PATCH] Add build function to circle-test.sh, and remove release.sh --- circle-test.sh | 18 +++++++++++------- release.sh | 18 ------------------ 2 files changed, 11 insertions(+), 25 deletions(-) delete mode 100755 release.sh diff --git a/circle-test.sh b/circle-test.sh index dd199aaa4..9392a636e 100755 --- a/circle-test.sh +++ b/circle-test.sh @@ -6,6 +6,8 @@ BUILD_DIR=$HOME/telegraf-build # GO_VERSION=go1.4.2 +# source $HOME/.gvm/scripts/gvm +# exit_if_fail gvm use $GO_VERSION # Executes the given statement, and exits if the command returns a non-zero code. function exit_if_fail { @@ -19,8 +21,12 @@ function exit_if_fail { fi } -# source $HOME/.gvm/scripts/gvm -# exit_if_fail gvm use $GO_VERSION +# build takes three arguments: GOOS & GOARCH & VERSION +function build { + echo -n "=> $1-$2: " + GOOS=$1 GOARCH=$2 godep go build -o telegraf-$1-$2 -ldflags "-X main.Version $3" ./cmd/telegraf/telegraf.go + du -h telegraf-$1-$2 +} # Set up the build directory, and then GOPATH. exit_if_fail mkdir $BUILD_DIR @@ -30,8 +36,6 @@ exit_if_fail mkdir -p $GOPATH/src/github.com/influxdb # Get golint go get github.com/golang/lint/golint -# Get gox (cross-compiler) -go get github.com/mitchellh/gox # Get godep tool go get github.com/tools/godep @@ -55,9 +59,9 @@ exit_if_fail godep go vet ./... exit_if_fail godep go test -v -short ./... # Build binaries -GOPATH=`godep path`:$GOPATH gox -os="linux" -arch="386 amd64" ./... -# Check return code of gox command -exit_if_fail return $? +build "linux" "amd64" `git rev-parse --short HEAD` +build "linux" "386" `git rev-parse --short HEAD` +build "linux" "arm" `git rev-parse --short HEAD` # Artifact binaries mv telegraf* $CIRCLE_ARTIFACTS diff --git a/release.sh b/release.sh deleted file mode 100755 index 21cc650ac..000000000 --- a/release.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -VERSION="0.9.b1" - -echo "Building Telegraf version $VERSION" - -mkdir -p pkg - -build() { - echo -n "=> $1-$2: " - GOOS=$1 GOARCH=$2 go build -o pkg/telegraf-$1-$2 -ldflags "-X main.Version $VERSION" ./cmd/telegraf/telegraf.go - du -h pkg/telegraf-$1-$2 -} - -build "darwin" "amd64" -build "linux" "amd64" -build "linux" "386" -build "linux" "arm"