├── .gitignore ├── version.go ├── main.go ├── main_test.go ├── .travis.yml ├── README.md └── LICENCE /.gitignore: -------------------------------------------------------------------------------- 1 | *.test 2 | -------------------------------------------------------------------------------- /version.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | // Describe version. 4 | const Version string = "0.1.0" 5 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | func main() { 8 | fmt.Println(hello()) 9 | } 10 | 11 | func hello() string { 12 | return "hello" 13 | } 14 | -------------------------------------------------------------------------------- /main_test.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "testing" 5 | ) 6 | 7 | func HelloTest(t *testing.T) { 8 | result := hello() 9 | if result != "hello" { 10 | t.Errorf("hello() = %s, want %s", result, "hello") 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.3 4 | env: 5 | - "PATH=/home/travis/gopath/bin:$PATH" 6 | before_install: 7 | - go get github.com/mitchellh/gox 8 | - gox -build-toolchain 9 | - go get github.com/tcnksm/ghr 10 | - go get github.com/axw/gocov/gocov 11 | - go get github.com/mattn/goveralls 12 | - go get code.google.com/p/go.tools/cmd/cover 13 | script: 14 | - go test -v -covermode=count -coverprofile=coverage.out ./... 15 | - goveralls -coverprofile=coverage.out -service travis-ci -repotoken $COVERALLS_TOKEN 16 | after_success: 17 | - gox -output "dist/{{.OS}}_{{.Arch}}_{{.Dir}}" 18 | - ghr --username tcnksm-sample --token $GITHUB_TOKEN --replace --prerelease --debug pre-release dist/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | TravisCI for golang 2 | ==== 3 | 4 | [![Build Status](https://travis-ci.org/tcnksm-sample/travis-golang.svg?branch=master)](https://travis-ci.org/tcnksm-sample/travis-golang) 5 | 6 | This is sample of releasing golang project from [TravisCI](https://travis-ci.org) 7 | 8 | 1. Get source code 9 | 1. Run test 10 | 1. Send test coverage to [coveralls.io](https://coveralls.io/) by [mattn/goveralls](https://github.com/mattn/goveralls) 11 | 1. Cross-compile by [mitchellh/gox](https://github.com/mitchellh/gox) 12 | 1. Release binary to Github Release by [tcnksm/ghr](https://github.com/tcnksm/ghr) 13 | 14 | See `.travis.yml`. To use this, you need to set `GITHUB_TOKEN` and `COVERALLS_TOKEN` in settings tab on travis-ci.org 15 | 16 | 17 | -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 tcnksm 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------------------------------------------------------------------