language: python
matrix:
  include:
    - os: linux
      # We need an older version of python in order to have compatibility with
      # older versions of libc
      dist: trusty
      python: 3.6
      services:
        - docker
      env:
        BUILD_BINARY: "true"
    - os: linux
      dist: xenial
      python: 3.6
      services:
        - docker
      env:
        BUILD_DOCKER: "true"
    - os: linux
      dist: xenial
      python: 3.6
      services:
        - docker
      env:
        BUILD_PYPI: "true"
    - os: osx
      language: generic
      env:
        BUILD_BINARY: "true"

script:
  - make ci-info
  - make ci-bundle
  - make ci-test

deploy:
  # Push tutor binary to github releases
  - provider: releases
    api_key:
      secure: ffrhGvgxHf3WVnKsKiJZTUoEf3+ZBtIydPHQoTDmHiYMyPnaO6RJWxq5PnoDRr47b1vnvbCE0lhNsGr3sgnruQSN3xHYfT4wz1F6Lz7Y5Jt7Uq1W0/UfSRlB3BwYcFpkUb5fSXLSku+QrV8OTk/yItlY9tppnvXA9h4CZjQqgJYHYc1DRKWQVYnVs/dCttUpiPV3eyIFeQoPKFsHwZXKcm9cVzom5r+lkjwpw3AIuAutPd71jyj/Va/By6B/43yAIqw3sA/thBeL76vqd8C4cMeWE00of1EWnH+sx6pKz32Fqe/o6dVop5PZPCiI+TVIDxR8oLevHtPTCfIwRDg60y23DdH3bMGSw1bAyjeWTnhRGcdYQJi1NKq3hJ0ldy0lOFlUiMkKPdQBtU7i0xIpoXTIhnro0YUUtjbh/QEtyRn8nbMVeenId42Bymah5P8srhE8S2z0x0mirIqNlM/tgLKEOJXdSL4sPKCMwRLcTUIc0fCiwLeHJnHIrMNEfnWsqO1odzv/PS5nLsdiGHBmC63d+xLNllzincIV1djyi5SEzMZxcqmjX1n/G3nKYVXhaIQE0wWQSHqNwLlKluY0kPXCNtU1TPr5SJHGnomQKizVaEsDrdAjylBL+rPwVCAv9z8FCtyOg7uMx2WdD0pvky2Iy4rbl2RBLUHmUZoAjPY=
    file: dist/tutor-$TRAVIS_OS_NAME
    skip_cleanup: true
    on:
      tags: true
      condition: $BUILD_BINARY = true

  # Push docker images to docker hub
  - provider: script
    script: make ci-images
    skip_cleanup: true
    on:
      tags: true
      condition: $BUILD_DOCKER = true

  # Push to pypi
  - provider: script
    script: make ci-pypi
    skip_cleanup: true
    on:
      tags: true
      condition: $BUILD_PYPI = true
