language: go
sudo: required
services:
  - docker

go:
  - 1.5.3
  - 1.6.2
  - tip

before_install:
  - go get github.com/mattn/goveralls
  - go get golang.org/x/tools/cmd/cover
  - docker pull golang:alpine

install: go get -t ./...

script:
  - go test -v ./...
  - if [ "$TRAVIS_GO_VERSION" = "1.6.2" ]; then go test -race -v ./...; fi
  - go vet ./...
  - diff <(gofmt -d .) <(echo -n "")
  - if [ "$TRAVIS_GO_VERSION" = "1.6.2" ]; then $HOME/gopath/bin/goveralls -service=travis-ci || true; fi

after_success:
  - if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_GO_VERSION" = "1.6.2" ]; then
      docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$(echo $DOCKER_PASSWORD | base64 -d)";
      docker run --rm
        -v $PWD:/app/src/shell2telegram
        -w /app/src/shell2telegram
        -e GOPATH=/app golang:alpine
        sh -c 'apk add --no-cache git; go get .; go build -o shell2telegram';
      docker build -t msoap/shell2telegram .;
      docker push msoap/shell2telegram;
    fi

language: go
sudo: required
services:
  - docker

go:
  - 1.5.3
  - 1.6.2
  - tip

before_install:
  - go get github.com/mattn/goveralls
  - go get golang.org/x/tools/cmd/cover
  - docker pull golang:alpine

install: go get -t ./...

script:
  - go test -v ./...
  - if [ "$TRAVIS_GO_VERSION" = "1.6.2" ]; then go test -race -v ./...; fi
  - go vet ./...
  - diff <(gofmt -d .) <(echo -n "")
  - if [ "$TRAVIS_GO_VERSION" = "1.6.2" ]; then $HOME/gopath/bin/goveralls -service=travis-ci || true; fi

after_success:
  - if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_GO_VERSION" = "1.6.2" ]; then
      docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$(echo $DOCKER_PASSWORD | base64 -d)";
      docker run --rm
        -v $PWD:/app/src/shell2telegram
        -w /app/src/shell2telegram
        -e GOPATH=/app golang:alpine
        sh -c 'apk add --no-cache git; go get .; go build -o shell2telegram';
      docker build -t msoap/shell2telegram .;
      docker push msoap/shell2telegram;
      rm $HOME/.docker/config.json;
    fi

Remove docker config after build
Remove docker config after build
