# https://aka.ms/yaml

variables:
  CMAKE_PREFIX_PATH: /usr/local/opt/qt5/lib/cmake
  CEF_BUILD_VERSION: 3770
  CEF_VERSION: 75.1.16+g16a67c4+chromium-75.0.3770.100
  TWITCH-CLIENTID: $(twitch_clientid)
  TWITCH-HASH: $(twitch_hash)
  MIXER-CLIENTID: $(mixer_clientid)
  MIXER-HASH: $(mixer_hash)
  RESTREAM-CLIENTID: $(restream_clientid)
  RESTREAM-HASH: $(restream_hash)

jobs:
- job: 'Build_macOS'
  pool:
    vmImage: 'macos-10.13'
  steps:
  - script: git submodule update --init --recursive
    displayName: 'Checkout Submodules'
  - script: ./CI/install-dependencies-osx.sh
    displayName: 'Install Dependencies'

  - script: ./CI/before-script-osx.sh
    displayName: 'Cmake'

  - bash: |
      cd ./build
      make -j4
      cd -
    displayName: 'Build'

  - script: ./CI/before-deploy-osx.sh
    condition: ne(variables['Build.Reason'], 'PullRequest')
    displayName: 'Before Deploy'

  - task: PublishBuildArtifacts@1
    condition: ne(variables['Build.Reason'], 'PullRequest')
    inputs:
      pathtoPublish: './nightly'
      artifactName: build

- job: 'Build_Windows32'
  pool:
    vmImage: 'vs2017-win2016'
  steps:
  - script: git submodule update --init --recursive
    displayName: 'Checkout Submodules'
  - script: ./CI/install-qt-win.cmd
    displayName: 'Install QT'
  - script: ./CI/install-script-win.cmd
    displayName: 'Download / Setup Deps / Run CMake'
  - task: MSBuild@1
    displayName: 'Build 32-bit'
    inputs: 
      msbuildArguments: '/m /p:Configuration=RelWithDebInfo'
      solution: .\build32\obs-studio.sln
  - script: ./CI/before-deploy-win.cmd
    condition: ne(variables['Build.Reason'], 'PullRequest')
    displayName: 'Before deploy'
  - task: PublishBuildArtifacts@1
    condition: ne(variables['Build.Reason'], 'PullRequest')
    inputs:
      pathtoPublish: './build'
      artifactName: winbuild

- job: 'Build_Windows64'
  pool:
    vmImage: 'vs2017-win2016'
  steps:
  - script: git submodule update --init --recursive
    displayName: 'Checkout Submodules'
  - script: ./CI/install-qt-win.cmd
    displayName: 'Install QT'
  - script: ./CI/install-script-win.cmd
    displayName: 'Download / Setup Deps / Run CMake'
  - task: MSBuild@1
    displayName: 'Build 64-bit'
    inputs: 
      msbuildArguments: '/m /p:Configuration=RelWithDebInfo'
      solution: .\build64\obs-studio.sln
  - script: ./CI/before-deploy-win.cmd
    condition: ne(variables['Build.Reason'], 'PullRequest')
    displayName: 'Before deploy'
  - task: PublishBuildArtifacts@1
    condition: ne(variables['Build.Reason'], 'PullRequest')
    inputs:
      pathtoPublish: './build'
      artifactName: winbuild

- job: 'Build_Linux'
  pool:
    vmImage: 'ubuntu-16.04'
  steps:
  - script: git submodule update --init --recursive
    displayName: 'Checkout Submodules'
  - script: ./CI/install-dependencies-linux.sh
    displayName: 'Install Dependencies'

  - script: ./CI/before-script-linux.sh
    displayName: 'CMake'

  - bash: |
      cd ./build
      make -j4
      cd -
    displayName: 'Build'

