Last active
August 29, 2015 14:10
-
-
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/*/*"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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