language: go go: - 1.12.x services: - docker env: global: - CGO_ENABLED=0 - GO111MODULE=on - GOPROXY=https://proxy.golang.org cache: directories: - "$GOPATH/pkg/mod" - "$GOPATH/bin" install: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.16.0 script: - go test -v -coverprofile=coverage.txt ./... - golangci-lint -v run - | set -e for dist in linux/386 linux/amd64 windows/amd64 darwin/amd64 do os=`echo $dist | cut -d'/' -f1` arch=`echo $dist | cut -d'/' -f2` env GOOS=$os GOARCH=$arch go build -o bin/werther_${os}_${arch} -ldflags "-w -s -X main.version=$TRAVIS_TAG" ./cmd/werther if [[ "$os" = "windows" ]]; then zip -r bin/werther_${os}_${arch}.zip bin/werther_${os}_${arch} else tar cvzf bin/werther_${os}_${arch}.tar.gz bin/werther_${os}_${arch} fi done (cd bin && sha256sum *.{tar.gz,zip} > werther_checksums.txt) - | set -e docker build --build-arg GOPROXY --build-arg VERSION=$TRAVIS_TAG -t "icoreru/werther:$TRAVIS_COMMIT" . if [ -n "$TRAVIS_TAG" ]; then docker tag "icoreru/werther:$TRAVIS_COMMIT" "icoreru/werther:$TRAVIS_TAG" docker tag "icoreru/werther:$TRAVIS_COMMIT" "icoreru/werther:latest" fi after_success: - bash <(curl -s https://codecov.io/bash) before_deploy: - | if [ -n "$TRAVIS_TAG" ]; then docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD" fi deploy: - provider: releases api_key: secure: X0diTlyWbycImd8x1ce1VHC9IcaPD9f0Pl9ynYHoV0BNw4KrgGD6OdiOM7Z7fiZA8jly0jh81orxdm3o7hIAlX02BA2kg8BFi83dcm01pcwW5vZZq0w/XMMtw644O8CAImPr58YKUjBb7c1+RENjPqjIZrdjVDzeRu0k5oOaDpk94016B1j1OB9XtkXzPzgP+KTx5gCmfeipQ6LxbL8wzXEqJWGF6+5B/7bqkzSw7vIvDtYlYgM7jf5NZslxiKlVr7pkRik6KlfRjtt/pi4ZJwpcu4AHdnNZoXkcmQwz21yd1lVFUbqNi8qGJyilOQB+p1RvZ/c5Q7a+FHN9anUM06DtfL/bMII+Kqt429M4sk9mA3rEp61SkDML1o9lJ8iiEKXPxMNtWKv1I/ixrZWYPE3g75fTaoyBusBS1bxNtOgAUf2dIr0JCO+p2NTaCyd0vOr87/KMVnJTeLzOnisMY0DOjQ3FhYmXSRPtyJF72jDxh338YX7hHK5DcwL9aVKOA5t7VbM2RW6VdavH5kHUPDEbZaDFlsUcncHJnzD1QtX7ODJh7EgFteE32fmJFBcE2BAWDIvYy68sCNU64Wwh2yBCbnMzLhET/nLm3Jj4U6Jl3VqAT2ff0UQBgugW0OpxO7JBW4b3dNwmKKA6WE5+WitO8EzE8sA09tnIEIe7YT8= file: - bin/werther_linux_386.tar.gz - bin/werther_linux_amd64.tar.gz - bin/werther_windows_amd64.zip - bin/werther_darwin_amd64.tar.gz - bin/werther_checksums.txt skip_cleanup: true on: tags: true condition: $TRAVIS_OS_NAME = linux - provider: script skip_cleanup: true script: docker push "icoreru/werther:$TRAVIS_TAG" on: tags: true condition: $TRAVIS_OS_NAME = linux - provider: script skip_cleanup: true script: docker push "icoreru/werther:latest" on: tags: true condition: $TRAVIS_OS_NAME = linux