sudo: required
dist: xenial
language: go
go:
- "1.12.x"
go_import_path: github.com/coreos/prometheus-operator
env:
  - GO111MODULE=on
cache:
  directories:
  - $GOCACHE
  - $GOPATH/pkg/mod
services:
- docker
before_install:
  - pip install --user awscli
  - export PATH=$PATH:$HOME/.local/bin
jobs:
  include:
  - stage: Sanity check and tests
  # Check generated contents are up to date and code is formatted.
    script: make --always-make format generate-in-docker && git diff --exit-code
  # Build Prometheus Operator rule config map to rule file crds cli tool
  - script: cd cmd/po-rule-migration && go install
  # Ensure vendor folder matches vendor.json
  - script: make --always-make vendor && git diff --exit-code vendor/
  # Unit tests
  - script: make test-unit
  # E2e tests
  - script: ./scripts/travis-e2e.sh
  # kube-prometheus e2e tests

  - stage: push-docker-image
    script: ./scripts/travis-push-docker-image.sh
