# Use, modification, and distribution are
# subject to the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
# Copyright Rene Rivera 2015-2019.

trigger:
- feature/cxx

jobs:

- job: 'Linux'
  pool:
    vmImage: 'ubuntu-16.04'
  strategy:
    matrix:
      GCC:
        TOOLSET: gcc
        TEST_TOOLSET: gcc
        CXX: g++-8
  steps:
  - task: UsePythonVersion@0
    inputs:
      versionSpec: '2.7'
      architecture: 'x64'
      addToPath: true
  - bash: |
        set -e
        uname -a
        sudo -E apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
        sudo -E apt-get -yq --no-install-suggests --no-install-recommends install g++-8
        which g++-8
    displayName: Install
  - bash: |
        set -e
        cd src/engine
        set PATH=${PATH};${CXX_PATH}
        ./build.sh ${TOOLSET}
        cd ../..
    displayName: Build
  - bash: |
        set -e
        CXX_PATH=`which ${CXX}`
        cd test
        echo "using ${TEST_TOOLSET} : : ${CXX_PATH} ;" > ${HOME}/user-config.jam
        python test_all.py ${TEST_TOOLSET}
        cd ..
    displayName: Test

- job: 'Windows'
  pool:
    vmImage: 'vs2017-win2016'
  strategy:
    matrix:
      MSVC 14.1:
        TOOLSET: vc141
        TEST_TOOLSET: msvc
  steps:
  - task: UsePythonVersion@0
    inputs:
      versionSpec: '2.7'
      architecture: 'x64'
      addToPath: true
  - powershell: |
        cd src/engine
        $env:path += ';' + $env:CXX_PATH
        cmd /c build.bat $env:TOOLSET
        cd ../..
    displayName: Build
  - powershell: |
        cd test
        echo "using" $env:TEST_TOOLSET ":" ":" $env:CXX ";" > $env:HOME/user-config.jam
        python test_all.py $env:TEST_TOOLSET
        cd ..
    displayName: Test
