version: 3.8.0.{build}

shallow_clone: true

platform:
  - x64

os: Visual Studio 2015

environment:
  BOOST_ROOT: C:\Libraries\boost
  BOOST_LIBRARYDIR: C:\Libraries\boost\stage\lib
  matrix:
    - MSYS2_ARCH: x86_64

cache:
  - C:\mingw64
  - C:\externals-siconos -> appveyor.yml

init:
  # Disable popups
  - reg add "HKLM\SYSTEM\CurrentControlSet\Control\Windows" /f /v ErrorMode /d 2
  - reg add "HKLM\Software\Microsoft\Windows\Windows Error Reporting" /f /v DontShowUI /d 1


install:
  #  - C:\msys64\usr\bin\bash -lc "for i in {1..3}; do pacman --noconfirm -S gcc gcc-fortran swig && break || sleep 15; done"
    #  - set PATH=C:\Python27\scripts;%PATH%
    #  - pip install lxml numpy scipy pytest
  - set PATH=%PATH%;C:\MinGW\msys\1.0\bin
  - cd C:\projects\siconos
  - bash Build\Windows\deal-with-symlink-zip.sh ; echo symlink replacement 
  - echo %PATH%
  - cd C:\
  - ps: |
      if ( -Not (Test-Path "C:\mingw64")) {
        # Install MinGW.
        Invoke-WebRequest -UserAgent wget -Uri "http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/5.2.0/threads-posix/seh/x86_64-5.2.0-release-posix-seh-rt_v4-rev0.7z/download" -OutFile "mingw64-toolchain.7z"
        &7z x -oC:\ "mingw64-toolchain.7z" > $null
        }
      if ( -Not (Test-Path "C:\externals-siconos")) {
        $file = "siconos-dep-mingw64-msys1.zip"
        $url = "http://siconos.gforge.inria.fr/windows/"
        $url += $file
        Invoke-WebRequest -UserAgent wget -Uri $url -OutFile $file
        &7z x -oC:\ $file > $null
      }

build_script:
  - echo %cd%
    #  - set PATH=%PATH%;C:\msys64\usr\local\bin;C:\msys64\usr\bin;C:\msys64\bin\opt\bin
  - set PATH=C:\externals-siconos\bin;C:\mingw64\bin;%PATH%
  - dir C:\
  - dir C:\externals-siconos
  - dir C:\externals-siconos\bin
  - mkdir builddir
  - cd builddir
  - C:\projects\siconos\Build\Windows\build-siconos-appveyor.bat C:\projects\siconos
  - 7z a debugFiles.zip '**\*.def'
  - 7z a debugFiles.zip '**\*.rsp'
  - 7z a siconos_install.zip -rC:\install-vs2015-amd64

test_script:
  - ctest -D ExperimentalStart
  - ctest -D ExperimentalTest -j2; echo do not fail here
  - ctest -D ExperimentalSubmit

after_build:
  - appveyor PushArtifact debugFiles.zip
  - appveyor PushArtifact siconos_install.zip

artifacts:
  - path: debugFiles.zip
    name: DefFiles
  - path: siconos_install.zip
    name: SiconosInstall

notifications:
- provider: Email
  to:
  - ohuber2@wisc.edu
  on_build_success: false
  on_build_failure: true
  on_build_status_changed: true
