Add build function to circle-test.sh, and remove release.sh

This commit is contained in:
Cameron Sparr 2015-08-18 09:21:14 -06:00
parent 4e3213f3bd
commit 2304d03b40
2 changed files with 11 additions and 25 deletions

View File

@ -6,6 +6,8 @@
BUILD_DIR=$HOME/telegraf-build BUILD_DIR=$HOME/telegraf-build
# GO_VERSION=go1.4.2 # 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. # Executes the given statement, and exits if the command returns a non-zero code.
function exit_if_fail { function exit_if_fail {
@ -19,8 +21,12 @@ function exit_if_fail {
fi fi
} }
# source $HOME/.gvm/scripts/gvm # build takes three arguments: GOOS & GOARCH & VERSION
# exit_if_fail gvm use $GO_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. # Set up the build directory, and then GOPATH.
exit_if_fail mkdir $BUILD_DIR exit_if_fail mkdir $BUILD_DIR
@ -30,8 +36,6 @@ exit_if_fail mkdir -p $GOPATH/src/github.com/influxdb
# Get golint # Get golint
go get github.com/golang/lint/golint go get github.com/golang/lint/golint
# Get gox (cross-compiler)
go get github.com/mitchellh/gox
# Get godep tool # Get godep tool
go get github.com/tools/godep go get github.com/tools/godep
@ -55,9 +59,9 @@ exit_if_fail godep go vet ./...
exit_if_fail godep go test -v -short ./... exit_if_fail godep go test -v -short ./...
# Build binaries # Build binaries
GOPATH=`godep path`:$GOPATH gox -os="linux" -arch="386 amd64" ./... build "linux" "amd64" `git rev-parse --short HEAD`
# Check return code of gox command build "linux" "386" `git rev-parse --short HEAD`
exit_if_fail return $? build "linux" "arm" `git rev-parse --short HEAD`
# Artifact binaries # Artifact binaries
mv telegraf* $CIRCLE_ARTIFACTS mv telegraf* $CIRCLE_ARTIFACTS

View File

@ -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"