diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..c7d187a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,50 @@ +# Special thanks to this post for this fancy build & deploy script: +# https://blog.questionable.services/article/build-go-binaries-travis-ci-github/ + +language: go +sudo: false +matrix: + include: + # "1.x" always refers to the latest Go version, inc. the patch release. + # e.g. "1.x" is 1.11 until 1.11.1 is available. + - go: 1.x + env: LATEST=true + - go: 1.7.x + - go: 1.8.x + - go: 1.9.x + - go: 1.10.x + - go: 1.11.x + - go: tip + allow_failures: + - go: tip + +before_install: + # gox simplifies building for multiple architectures + - go get github.com/mitchellh/gox + +install: + - # skip + +script: + - go get -t -v ./... + - diff -u <(echo -n) <(gofmt -d .) + - go vet $(go list ./... | grep -v /vendor/) + - go test -v -race ./... + # Only build binaries from the latest Go release. + - if [ "${LATEST}" = "true" ]; then gox -os="linux darwin windows" -arch="amd64" -ldflags "-X main.Rev=`git rev-parse --short HEAD`" -verbose ./...; fi + +deploy: + provider: releases + skip_cleanup: true + api_key: + secure: dD1n3KLcEYh8Q7zNSeIvVGtZFsdmjS7pEVWYyl6usiyMsn5f6/q3uSvR9PioN5SgqVXQRXA67g4zw1e1I1W49kQtiFTQSSoulM2TDozMgcq66MNt90GoHo0ZTeuXhzvQRxchdep4ubKo96LlONHEbp/Qiw0toHICiCLz0+XWKJNeSDmwGpeZlCxEvQzApHYdmQ5tysU2mUkaRNddeHC45pAiLpUyqMfdQE0JlhZ3cO92n4VvWtJTVphpqfUflqOf/u7Q1XhuKqbTUe+luqg1NoOJZvktGJALvQPfKXzXxYeXQWwP2BzwSZVwLK6Pk5ERj7kvqZtWT+Go4zqH9SrYqbJ0O4I7NJjAxDMDNhRSjvTHoGTD6nhpdzDvj+tA3CvxyDYWKYinKOBEvHLEI6D56/INCMMcmPkQ1iwMifR6/mZqW3nPE/mGy7lLrxDbMWbMK8sDw3Dm91EzVGHzd282q+sK5P7EFkJ1Hc7QqBH1BfSIutyNPVlLsX9t34dfxdCuzChslZ+jK/i3u4oKtpkTclyk00DIBUvjC8PuFXT+9yb+Xr3GaJEO7Y7mBRbORB76CnH5lQydyQPENQ/f7fFpkk7vtZhMTU4SS5zmMrrfvNj91Xw09P9QYvMizAEnfnZExal17W/6QImxtwNM2nZCf6PJBIPPToDitfx/1hSGbzE= + file: + - serv_windows_amd64.exe + - serv_darwin_amd64 + - serv_linux_amd64 + on: + # What to repository to build + repo: markwatson/serv + # Only build binaries for tagged commits + tags: true + condition: $LATEST = true diff --git a/buildspec.yml b/buildspec.yml deleted file mode 100644 index 70c4314..0000000 --- a/buildspec.yml +++ /dev/null @@ -1,18 +0,0 @@ -version: 0.2 - -phases: - build: - commands: - - echo Build started on `date` - - echo Compiling the Go code... - - make all - post_build: - commands: - - echo Build completed on `date` - - aws s3 cp --recursive --acl public-read ./build/ s3://us.markwatson.serv/ -artifacts: - files: - - build/linux-serv - - build/osx-serv - - build/windows-serv.exe -