jobs:
  - job: Ubuntu_CMake
    pool:
      vmImage: 'Ubuntu-16.04'
    steps:
    - script: |
        sudo apt-get install -y autogen libogg-dev libvorbis-dev libflac-dev libasound2-dev libsqlite3-dev libspeex-dev
      displayName: Installing dependencies
    - script: |
        mkdir build
      displayName: Creating build directory
    - task: CMake@1
      inputs:
        workingDirectory: 'build'
        cmakeArgs: ' ..'
    - script: |
        cd build
        cmake --build .
      displayName: Building
    - script: |
        cd build
        ctest
      displayName: Testing

  - job: Ubuntu_AutoTools
    pool:
      vmImage: 'Ubuntu-16.04'
    steps:
    - script: sudo apt-get install -y autogen libogg-dev libvorbis-dev libflac-dev libasound2-dev libsqlite3-dev libspeex-dev
      displayName: Installing dependencies
    - script: ./autogen.sh
      displayName: Bootstrapping
    - script: ./configure --enable-werror
      displayName: Configuring
    - script: make all
      displayName: Building
    - script: make check
      displayName: Testing
    - script: make distcheck
      displayName: Testing distribution

  - job: Windows_CMake_VS2015_Win32
    pool:
      vmImage: 'vs2015-win2012r2'
    steps:
    - script: git clone https://github.com/microsoft/vcpkg
      displayName: Bootstraping Vcpkg
    - script: .\vcpkg\bootstrap-vcpkg.bat
      displayName: Bootstraping Vcpkg
    - script: .\vcpkg\vcpkg.exe install libogg libvorbis libflac sqlite3 speex
      displayName: Installing dependencies
    - script: |
        mkdir build
      displayName: Creating build directory
    - task: CMake@1
      inputs:
        workingDirectory: 'build'
        cmakeArgs: ' -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake ..'
    - script: |
        cd build
        cmake --build .
      displayName: Building
    - script: |
        cd build
        ctest
      displayName: Testing

  - job: Windows_CMake_VS2015_Win64
    pool:
      vmImage: 'vs2015-win2012r2'
    steps:
    - script: git clone https://github.com/microsoft/vcpkg
      displayName: Bootstraping Vcpkg
    - script: .\vcpkg\bootstrap-vcpkg.bat
      displayName: Bootstraping Vcpkg
    - script: .\vcpkg\vcpkg.exe install libogg:x64-windows libvorbis:x64-windows libflac:x64-windows sqlite3:x64-windows speex:x64-windows
      displayName: Installing dependencies
    - script: |
        mkdir build
      displayName: Creating build directory
    - task: CMake@1
      inputs:
        workingDirectory: 'build'
        cmakeArgs: ' -G "Visual Studio 14 2015" -A x64 -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake ..'
    - script: |
        cd build
        cmake --build .
      displayName: Building
    - script: |
        cd build
        ctest
      displayName: Testing

  - job: Windows_CMake_VS2017_Win32
    pool:
      vmImage: 'vs2017-win2016'
    steps:
    - script: git clone https://github.com/microsoft/vcpkg
      displayName: Bootstraping Vcpkg
    - script: .\vcpkg\bootstrap-vcpkg.bat
      displayName: Bootstraping Vcpkg
    - script: .\vcpkg\vcpkg.exe install libogg libvorbis libflac sqlite3 speex
      displayName: Installing dependencies
    - script: |
        mkdir build
      displayName: Creating build directory
    - task: CMake@1
      inputs:
        workingDirectory: 'build'
        cmakeArgs: ' -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake ..'
    - script: |
        cd build
        cmake --build .
      displayName: Building
    - script: |
        cd build
        ctest
      displayName: Testing

  - job: Windows_CMake_VS2017_Win64
    pool:
      vmImage: 'vs2017-win2016'
    steps:
    - script: git clone https://github.com/microsoft/vcpkg
      displayName: Bootstraping Vcpkg
    - script: .\vcpkg\bootstrap-vcpkg.bat
      displayName: Bootstraping Vcpkg
    - script: .\vcpkg\vcpkg.exe install libogg:x64-windows libvorbis:x64-windows libflac:x64-windows sqlite3:x64-windows speex:x64-windows
      displayName: Installing dependencies
    - script: |
        mkdir build
      displayName: Creating build directory
    - task: CMake@1
      inputs:
        workingDirectory: 'build'
        cmakeArgs: ' -G "Visual Studio 15 2017" -A x64 -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake ..'
    - script: |
        cd build
        cmake --build .
      displayName: Building
    - script: |
        cd build
        ctest
      displayName: Testing

  - job: MacOS
    pool:
      vmImage: 'macOS-10.13'
    steps:
    - script: |
        brew update
        brew install autogen libogg libvorbis flac sqlite3 speex
      displayName: Installing dependencies
    - script: |
        mkdir build
      displayName: Creating build directory
    - task: CMake@1
      inputs:
        workingDirectory: 'build'
        cmakeArgs: ' ..'
    - script: |
        cd build
        cmake --build .
      displayName: Building
    - script: |
        cd build
        ctest
      displayName: Testing
