language: go

services:
  - docker

go:
  - "1.10.x"
  - master

script:
  - docker --version
  # dep
  - go get -u github.com/golang/dep/cmd/dep
  
  # build locally and run locally
  - make clean && make vendor && make && ./bin/goldpinger --help
  
  # build an image and run the image
  - make clean && make vendor && make build
  - docker images
  - docker run `make version` --help
  
  # build an image using the multistage builder
  - make clean && make build-multistage
  - docker images
  - docker run `make version` --help

  # build an image with the vendor folder
  - make clean && make vendor && make vendor-build
  - docker images
  - docker run `make version`-vendor --help

deploy:
  provider: script
  script: bash docker_deploy.sh
  skip_cleanup: true
  on:
    tags: true
    go: "1.10.x"
    condition: -n "$DOCKER_PASSWORD"
