sudo: required
dist: xenial
language: go

go:
    - "1.13.x"

services:
  - docker

git:
  # Benchmark tests needs to access other branches, thereby we need to fetch all
  # of the repository.
  depth: false

env:
  global:
      - E2E_SETUP_MINIKUBE=yes
      - E2E_SETUP_KUBECTL=yes
      - E2E_SETUP_PROMTOOL=yes
      - MINIKUBE_DRIVER=none
      - SUDO=sudo

before_script:
- make install-tools

install:
- mkdir -p $HOME/gopath/src/k8s.io
- mv $TRAVIS_BUILD_DIR $HOME/gopath/src/k8s.io/kube-state-metrics
- cd $HOME/gopath/src/k8s.io/kube-state-metrics

jobs:
  include:
    - stage: all
      name: Lint
      script: make lint
    - name: Validate generated manifests
      script: make validate-manifests
    - name: Validate vendor is in sync with go modules
      script: make validate-modules
    - name: Check that all metrics are documented
      script: make doccheck
    - name: Unit tests
      script: make test-unit
    - name: Benchmark tests
      script: make test-benchmark-compare
    - name: Build
      script: make build
    - name: End to end tests
      script: make e2e
