Skip to content

Instantly share code, notes, and snippets.

@goldeneggg
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goldeneggg/2158643ec3b8b15a838e to your computer and use it in GitHub Desktop.
Save goldeneggg/2158643ec3b8b15a838e to your computer and use it in GitHub Desktop.
Cross build script for Go project on drone.io (using godep). "Artifacts" setting on drone.io must be set "artifacts/bin/*/*"
BINNAME=YOUR_APP_NAME
export GO_VERSION=1.3.3
pushd ~
wget -q https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz
tar zxf go${GO_VERSION}.linux-amd64.tar.gz
popd
export GOROOT=~/go
export PATH=${GOROOT}/bin:${PATH}
go env
go version
rm -rf ${GOROOT}/src/pkg/appengine
rm -rf ${GOROOT}/src/pkg/appengine_internal
go get github.com/tools/godep
godep get
godep go test ./...
OSS=("linux" "darwin" "windows")
ARCHS=("amd64" "386")
pushd ${GOROOT}/src
for os in ${OSS[@]}
do
for arch in ${ARCHS[@]}
do
GOOS=${os} GOARCH=${arch} ./make.bash --no-clean > /dev/null 2>&1
done
done
popd
for os in ${OSS[@]}
do
for arch in ${ARCHS[@]}
do
GOOS=${os} GOARCH=${arch} godep go build -o ${GOPATH}/bin/${os}_${arch}/${BINNAME}
done
done
mkdir artifacts
cp -r ${GOPATH}/bin artifacts/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment