sudo: required

services:
  - docker

before_install:
  - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
  - sudo apt-get update
  - sudo apt-get -y install docker-ce

script:
  - docker build --no-cache -t "nats-io/nats-operator:${TRAVIS_TAG:-latest}" .

after_success:
  - if ([[ "${TRAVIS_BRANCH}" == "master" ]] && [[ "${TRAVIS_PULL_REQUEST}" == "false" ]]) || [[ "${TRAVIS_TAG}" != "" ]];
    then
        docker login -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}" quay.io;
        docker push "nats-io/nats-operator:${TRAVIS_TAG:-latest}";
    fi

sudo: required

language: go
go:
- "1.10.x"

env:
- KUBERNETES_CONFIG_FILE=$HOME/.kube/config CHANGE_MINIKUBE_NONE_USER=true

install:
- go get -u github.com/golang/dep/cmd/dep
- cd $GOPATH/src/github.com/nats-io/nats-operator && dep ensure

before_script:
- go version
- curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.9.0/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
- curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
- sudo minikube start --vm-driver=none --kubernetes-version=v1.9.0
- minikube update-context
- JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'; until kubectl get nodes -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do sleep 1; done

script:
- kubectl cluster-info 
- cd $GOPATH/src/github.com/nats-io/nats-operator/test/operator/ && go test ./... -v

Update Travis to use minikube for tests
Update Travis to use minikube for tests
