language: cpp
sudo: false

jobs:
  include:
    - stage: build
      if: type = pull_request
      os: linux
      env: NQQ_BUILD_TYPE=FORMAT
      script: .travis/script.sh
      addons:
        apt:
          sources:
            - llvm-toolchain-trusty-6.0
            - ubuntu-toolchain-r-test
          packages:
            - clang-format-6.0
    - stage: build
      os: linux
      env: NQQ_BUILD_TYPE=COMPILE
      sudo: true
      script: .travis/script.sh
      services:
        - docker
    - stage: deploy
      os: osx
      osx_image: xcode11
      env:
        - NQQ_BUILD_TYPE=DEPLOY
        - NQQ_VERSION=${TRAVIS_TAG:-${TRAVIS_COMMIT}}
      script: .travis/macos-script.sh
      deploy:
        provider: releases
        edge: true  # https://docs.travis-ci.com/user/deployment-v2
        file:
          - "out/release/notepadqq-${NQQ_VERSION}.dmg"
        skip_cleanup: true
        draft: true
        on:
          repo: notepadqq/notepadqq
          tags: true
