Skip to content

Commit

Permalink
Add build function to circle-test.sh, and remove release.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
sparrc committed Aug 18, 2015
1 parent 4e3213f commit 2304d03
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 25 deletions.
18 changes: 11 additions & 7 deletions circle-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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

Expand Down
18 changes: 0 additions & 18 deletions release.sh

This file was deleted.

0 comments on commit 2304d03

Please sign in to comment.