jobs:
  build:
    working_directory: /go/src/github.com/observatorium/deployments
    docker:
      - image: quay.io/coreos/jsonnet-ci
    steps:
      - checkout
      - run: make fmt
      - run: make generate-cert
      - run: make environments/base/manifests environments/dev/manifests example/manifests tests/manifests
      - run: git diff --exit-code -- . ':(exclude)tests/manifests/observatorium-xyz-tls-secret.yaml' ':(exclude)tests/manifests/observatorium-xyz-tls-configmap.yaml'

  tests:
    machine: true
    steps:
      - checkout
      - run:
          name: e2e tests
          no_output_timeout: 30m
          command : |
            ./tests/e2e.sh kind
            ./tests/e2e.sh deploy
            ./tests/e2e.sh test
      - store_artifacts:
          path: /tmp/artifacts

workflows:
  version: 2
  test-and-push:
    jobs:
      - build
      - tests
