
language: go
go_import_path: github.com/jetstack/cert-manager
go:
  - 1.13.x

os:
  - linux

services:
  - docker

branches:
  only:
    - master
    - /^[0-9]+\..*$/
    - /^v[0-9]+\..*$/
    - /^release-[0-9]+\..*$/

addons:
  sonarcloud:
    organization: "open-cluster-management"
    token:
      secure: "fw+/KBylkBhy6XBwQOCvUOClabglG31czKguGkPzK53xa67Kqtpfs73RxmPu/p1Hs0qG4wA83KGDBHx/qJHGiVuOMrII2crmp66ifA+gnhASsROFUbDgTiClx8MTeeQ9coL8L5EXic03reUNCi2vG8zlU2Q2+m/d3eX3rD9XhUw7QsJ4gsdXDPMrk3sADmUIgr60N2c2tDbk9io9X3sUXaTfmiFuoGtubMInazfblOFVu378puhP/y2mS8HQZiqW/kvadbFHakmusPFCQT0Y6Sbm39iqCF7ESvX1blJCUV2axymveJc6Ff39MVbe8tB2W0vLr/OfCDImKZ6iM2V7xjozIbKL5bpUQfKYtwgqNuh5yTDGWArEohIboFuWA7xuMQyfl0KMf1SMhI2FGQq8RKhy++YulxWfnsL4V7bjpNfzNtvfvmQ0THwAfu2RTTL7rL2zYmdaAmRdkzU5rQMTxe2lFCfQCKHV8p3eApd7l1XOPJtEwwav1V6PXAF1Co7v+YDEFAGWxGQznGWPV67avkTUE5SlTdtX7DivTQCVpxumQtKzXQIal2AtM+kgmoO4vlEWLzzmCBWdz5/3E0t48vMr8HHvaK219Giwcpl2VLYiLu5wA+rAqft3pdlBFNEUaUH6GkcG8E2hoSe4LgZ4sUHncFJSHTv3udnLJeFnkj0="

env:
  global:
    # Required
    - OS=linux
    - COMPONENT_TAG_EXTENSION="-${TRAVIS_COMMIT}"
    # Component Specific
    - COMPONENT_TYPE="make"
    - COMPONENT_INIT_COMMAND=${TRAVIS_BUILD_DIR}/build/install-dependencies.sh
    - COMPONENT_BUILD_COMMAND=${TRAVIS_BUILD_DIR}/build/build.sh
    - COMPONENT_UNIT_TEST_COMMAND=${TRAVIS_BUILD_DIR}/build/run-unit-tests.sh
    - COMPONENT_E2E_TEST_COMMAND=${TRAVIS_BUILD_DIR}/build/run-e2e-tests.sh

stages:
  - build
  - unit-test
  - test-e2e
  - publish

jobs:
  include:
    - stage: build
      name: "Build the image and push"
      script:
        - |
          make init
          make component/build
    - stage: unit-test
      name: "Build and run unit tests"
      os: linux
      script:
        - |
          make copyright-check TRAVIS_BRANCH=${TRAVIS_BRANCH} TRAVIS_PULL_REQUEST_BRANCH=${TRAVIS_PULL_REQUEST_BRANCH}
          make init
          make component/test/unit
    - stage: test-e2e
      name: "Run e2e tests"
      os: linux
      script:
        - |
          make init
          make component/pull
          make component/test/e2e
    - stage: publish
      name: "Publish the image to quay with an official version/sha tag and publish entry to integration pipeline stage"
      if: type = push AND branch =~ /^release-[0-9]+\..*$/
      script:
        - |
          make init
          ${TRAVIS_BUILD_DIR}/build/pipeline.sh

