Sample of releasing golang project from Drone.io
Go
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
LICENCE
README.md
main.go
main_test.go
version.go

README.md

Drone.io for golang

Build Status

This is sample of releasing golang project from Drone.io.

  1. Get source code
  2. Run test
  3. Send test coverage to coveralls.io by mattn/goveralls
  4. Cross-compile by mitchellh/gox
  5. Release binary to Github Release by tcnksm/ghr

Configuration

Paste below codes on commands in drone.io from settings tab and set GITHUB_TOKEN, COVERALLS_TOKEN on Environmental Variables:

# Install go 1.3.1
pushd ~/
curl -s -o go.tar.gz https://storage.googleapis.com/golang/go1.3.1.linux-amd64.tar.gz
tar xzf go.tar.gz
export GOROOT=~/go
export PATH=$GOROOT/bin:$PATH
go version
popd

# Get source code
go get -t -d ./...

go get github.com/axw/gocov/gocov
go get github.com/mattn/goveralls

go test -v -covermode=count -coverprofile=coverage.out ./...
goveralls -coverprofile=coverage.out -service drone.io -repotoken $COVERALLS_TOKEN

# Install gox
go get github.com/mitchellh/gox
gox -build-toolchain
gox -output "pkg/{{.OS}}_{{.Arch}}_{{.Dir}}"

# Release by ghr
go get github.com/tcnksm/ghr
ghr --username tcnksm-sample \
       --token $GITHUB_TOKEN \
       --replace \
       --prerelease \
       --debug \
       pre-release pkg/