version: 2.1.0.dev.3.{build}
pull_requests:
  do_not_increment_build_number: true
branches:
  only:
  - master
  - /\d\.[0-9x](\.[0-9x])?/
skip_branch_with_pr: true
image: Visual Studio 2015
init:
- cmd: >-
    ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%

    SET PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%

    SET PYTHON_SITE=%PYTHON%\lib\site-packages
environment:
  CHROMAPRINT_FPCALC_VERSION: 1.4.3
  DISCID_VERSION: 0.6.2
  matrix:
  - PYTHON: C:\Python35-x64
    PYTHON_VERSION: 3.5.6
    PYTHON_ARCH: 64
  - PYTHON: C:\Python36-x64
    PYTHON_VERSION: 3.6.6
    PYTHON_ARCH: 64
  - PYTHON: C:\Python37-x64
    PYTHON_VERSION: 3.7.0
    PYTHON_ARCH: 64
build_script:
- cmd: >-
    appveyor DownloadFile https://github.com/acoustid/chromaprint/releases/download/v%CHROMAPRINT_FPCALC_VERSION%/chromaprint-fpcalc-%CHROMAPRINT_FPCALC_VERSION%-windows-x86_64.zip -FileName fpcalc.zip

    appveyor DownloadFile https://github.com/metabrainz/libdiscid/releases/download/v%DISCID_VERSION%/libdiscid-%DISCID_VERSION%-win64.zip -FileName libdiscid.zip

    7z x fpcalc.zip -y

    copy /Y chromaprint-fpcalc-%CHROMAPRINT_FPCALC_VERSION%-windows-x86_64\fpcalc.exe fpcalc.exe

    7z x libdiscid.zip -y

    copy /Y discid.dll %PYTHON%

    pip install -r requirements-build.txt

    pip install -r requirements-win.txt

    copy /Y %PYTHON_SITE%\PyQt5\Qt\bin\ssleay32.dll .

    copy /Y %PYTHON_SITE%\PyQt5\Qt\bin\libeay32.dll .

    IF "%APPVEYOR_REPO_TAG%" == "false" python setup.py patch_version --platform=python%PYTHON_VERSION%

    python setup.py build

    python setup.py build_ext -i

    python setup.py test -v

    pyinstaller picard.spec

    makensis.exe installer\picard-setup.nsi

artifacts:
- path: installer/*.exe
deploy:
- provider: GitHub
  auth_token:
    secure: bEUedqYteaHx/e64i8Wy16O/o/2WE/O0VNkTAgWCDTYeuiQvkZa3UqyaFaO2k8vk
  repository: metabrainz/picard
  artifact: /.*\.exe/
  force_update: true
  on:
    APPVEYOR_REPO_TAG: true
    PYTHON_VERSION: 3.7.0
