version: 1.0.{build}

skip_branch_with_pr: true

os:
  - Visual Studio 2015
  - Visual Studio 2017

platform:
  - x86

# install:
#   ### Having trouble with enabling python on windows
#   - set PATH=C:\Python27-x64;C:\Python27-x64\Scripts;%PATH%
#   - "python.exe -m pip install numpy"

# init:
#  - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

before_build:
- del /q /f "C:\Program Files (x86)\MSBuild\14.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets"
- cd C:\projects\adios2
- git reset --hard %APPVEYOR_PULL_REQUEST_HEAD_COMMIT%
- ps: |
    if(Test-Path env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH) {
        $env:BUILD_NAME_BRANCH = $env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH
    } else {
        $env:BUILD_NAME_BRANCH = $env:APPVEYOR_REPO_BRANCH
    }
    $env:CUSTOM_BUILD_NAME = ("{0}_{1}_vs{2}" -f $env:BUILD_NAME_BRANCH, $env:APPVEYOR_BUILD_NUMBER, $env:APPVEYOR_BUILD_WORKER_IMAGE.split()[2] )
    $env:DASHBOARD_SCRIPT_SUFFIX = ($ENV:APPVEYOR_BUILD_WORKER_IMAGE -replace '\s', '-').ToLower()
- ctest.exe -VV -S ../adios2/scripts\appveyor\av_%DASHBOARD_SCRIPT_SUFFIX%.cmake
    -Ddashboard_full=OFF
    -Ddashboard_do_update=true
    -DCTEST_BUILD_NAME=%CUSTOM_BUILD_NAME%

build_script:
- ctest.exe -VV -S ../adios2/scripts\appveyor\av_%DASHBOARD_SCRIPT_SUFFIX%.cmake
    -Ddashboard_full=OFF
    -Ddashboard_do_configure=true
    -DCTEST_BUILD_NAME=%CUSTOM_BUILD_NAME%
- ctest.exe -VV -S ../adios2/scripts\appveyor\av_%DASHBOARD_SCRIPT_SUFFIX%.cmake
    -Ddashboard_full=OFF
    -Ddashboard_do_build=true
    -DCTEST_BUILD_NAME=%CUSTOM_BUILD_NAME%

test_script:
- ctest.exe -VV -S ../adios2/scripts\appveyor\av_%DASHBOARD_SCRIPT_SUFFIX%.cmake
    -Ddashboard_full=OFF
    -Ddashboard_do_test=true
    -DCTEST_BUILD_NAME=%CUSTOM_BUILD_NAME%

# on_finish:
#  - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
