clone_depth: 200
version: '1.0.0-{Build}'

environment:
  matrix:
  # MSVC x86
  - name: win32_56
    platformEnv: amd64_x86
    qt: 5.6
    compiler: msvc2015

  - name: win32_57
    platformEnv: amd64_x86
    qt: 5.7
    compiler: msvc2015

  # MSVC x64
  - name: win64_56
    platformEnv: amd64
    qt: 5.6
    compiler: msvc2015_64

  - name: win64_57
    platformEnv: amd64
    qt: 5.7
    compiler: msvc2015_64

  # MinGW
  - name: win32_56
    platformEnv: mingw
    qt: 5.6
    compiler: mingw49_32
    tools: mingw492_32

  - name: win32_57
    platformEnv: mingw
    qt: 5.7
    compiler: mingw53_32
    tools: mingw530_32

configuration: Release

clone_folder: c:\ci\notes

cache:
  - C:\Program Files (x86)\Inno Setup 5 -> appveyor.yml

install:
  - ps: Update-AppveyorBuild -Version "$(git describe --tags $(git rev-list --tags --max-count=1))~git$($env:appveyor_repo_commit.substring(0,7))"
  - setx /m PLATFORMENV %platformEnv%
  - if not exist "C:\Program Files (x86)\Inno Setup 5" choco install innosetup 
  - set PATH=C:\\Program Files (x86)\\Inno Setup 5;%PATH%
  - if %platformEnv%==mingw set PATH=C:\Qt\Tools\%tools%\bin;%PATH%
  - set PATH=C:\Qt\%qt%\%compiler%\bin;%PATH%
  - if not %platformEnv%==mingw call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %platformEnv%

build_script:
  - cd C:\ci\notes\src
  - qmake -config release 
  - if not %platformEnv%==mingw (nmake) else (mingw32-make)
  - if not %platformEnv%==mingw (nmake install) else (mingw32-make install)
  - cd C:\ci\notes\bin
  - windeployqt .
  - if %compiler%==msvc2015 copy "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\redist\\x86\\Microsoft.VC140.CRT\\msvcp140.dll" .
  - if %compiler%==msvc2015 copy "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\redist\\x86\\Microsoft.VC140.CRT\\vcruntime140.dll" .
  - if %compiler%==msvc2015_64 copy "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\redist\\x64\\Microsoft.VC140.CRT\\msvcp140.dll" .
  - if %compiler%==msvc2015_64 copy "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\redist\\x64\\Microsoft.VC140.CRT\\vcruntime140.dll" .
  - iscc C:\ci\notes\packaging\windows\Notes_Inno_Script.iss
  - cd C:\ci\notes\installer
  - dir

on_success:
  - ps: Push-AppveyorArtifact $("NotesSetup_"+$env:APPVEYOR_BUILD_VERSION+"_"+$env:platformEnv+".exe")

artifacts:
  - path: '\bin\Notes.exe'
    name: 'App Executable $(name)'
