language: go

go:
  - 1.8.x

services:
  - docker

before_install:
  - set -e

script:
  - make
  - tar xfvz build/mqtt_blackbox_exporter-*.linux-amd64.tar.gz
  - ls -lA
  - make test

after_success:
  - |
    if [[ "${TRAVIS_PULL_REQUEST?}" == "false" ]] && [[ -n "${TRAVIS_TAG?}" || "${TRAVIS_BRANCH?}" == master ]]; then
      docker login -u "${DOCKER_USERNAME?}" -p "${DOCKER_PASSWORD?}"
      docker build -t "${DOCKER_BUILD_IMAGE?}" .

      version=""
      if [[ -n "${TRAVIS_TAG?}" ]]; then
        version="${TRAVIS_TAG?}"
      else
        version="${TRAVIS_COMMIT:0:7}-dev"
      fi

      docker tag "${DOCKER_BUILD_IMAGE?}" "${DOCKER_BUILD_IMAGE?}:${version?}"
      docker push "${DOCKER_BUILD_IMAGE?}:${version?}"
    fi

language: go

go:
  - 1.13.x

services:
  - docker

before_install:
  - set -e

script:
  - make
  - tar xfvz build/mqtt_blackbox_exporter-*.linux-amd64.tar.gz
  - ls -lA
  - make test

after_success:
  - |
    if [[ "${TRAVIS_PULL_REQUEST?}" == "false" ]] && [[ -n "${TRAVIS_TAG?}" || "${TRAVIS_BRANCH?}" == master ]]; then
      docker login -u "${DOCKER_USERNAME?}" -p "${DOCKER_PASSWORD?}"
      docker build -t "${DOCKER_BUILD_IMAGE?}" .

      version=""
      if [[ -n "${TRAVIS_TAG?}" ]]; then
        version="${TRAVIS_TAG?}"
      else
        version="${TRAVIS_COMMIT:0:7}-dev"
      fi

      docker tag "${DOCKER_BUILD_IMAGE?}" "${DOCKER_BUILD_IMAGE?}:${version?}"
      docker push "${DOCKER_BUILD_IMAGE?}:${version?}"
    fi

Use most recent go version
Use most recent go version
