# https://packaging.python.org/en/latest/appveyor/

skip_commits:
  files:
    - doc/*
    - .travis
    - benchmark
    - tutorials

shallow_clone: true
clone_depth: 30

matrix:
  fast_finish: true

environment:
  global:
    PIP_DISABLE_PIP_VERSION_CHECK: 1
    # disable threaded builds on Python 3.5+ when using numpy's distutils
    # (https://github.com/numpy/numpy/issues/7607)
    BUILD_GLOBAL_OPTIONS: build -j1
    BUILD_ENV: wheel==0.29.0 pip==9.0.1 numpy==1.9.3
    TEST_ENV: numpy==1.12.1 scipy==1.0.0b1 scikit-learn PyQt5~=5.9.0

  matrix:
    - PYTHON: C:\Python34
      BUILD_GLOBAL_OPTIONS: build
      # override test env for Py34; test with PyQt4 and legacy scipy
      # from the 'super' installer.
      TEST_ENV: numpy==1.12.1 scipy==0.16.1 scikit-learn PyQt4==4.11.4

    - PYTHON: C:\Python34-x64
      BUILD_GLOBAL_OPTIONS: build
      TEST_ENV: numpy==1.12.1 scipy==1.0.0b1 scikit-learn PyQt5==5.5.1

    - PYTHON: C:\Python35

    - PYTHON: C:\Python35-x64

    - PYTHON: C:\Python36

    - PYTHON: C:\Python36-x64

cache:
  - '%LOCALAPPDATA%\pip\cache -> appveyor.yml'

install:
  # Patch VC 2010 64-bit toolchain
  - call .ci_tools/appveyor/patch-vcvars.bat
  # Configure pip: Add extra links url, force binary numpy, scipy, ...
  - echo [install]> pip.ini
  - echo find-links =>> pip.ini
  - echo     https://orange.biolab.si/download/files/wheelhouse/>> pip.ini
  - echo only-binary = numpy,scipy,bottleneck,scikit-learn>> pip.ini
  - set "PIP_CONFIG_FILE=%CD%\pip.ini"
  - type %PIP_CONFIG_FILE%

  - set "PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%"
  - python -m ensurepip
  - python -m pip install pip~=9.0.1 wheel~=0.29.0
  - python -m pip install %BUILD_ENV_INDEX% %BUILD_ENV%

build_script:
  - python -m pip list --format=freeze
  - python setup.py clean --all
  # get the package version
  - for /f %%f in ('python setup.py --version') do ( set "VERSION=%%f" )
  - python setup.py %BUILD_GLOBAL_OPTIONS% bdist_wheel

test_script:
  - python -m venv --clear build\.test
  - build\.test\Scripts\activate
  - cd build\.test
  # Pre-populate the test environment
  - python -m pip install pip~=9.0.1 wheel~=0.29.0
  - python -m pip install %TEST_ENV_INDEX% %TEST_ENV%
  - python -m pip install --pre -f ..\..\dist orange3==%VERSION%
  - python -m pip list --format=freeze

  # Raise OrangeDeprecationWarnings as errors
  - set ORANGE_DEPRECATIONS_ERROR=1
  - set PYTHONWARNINGS=module
  - python -m unittest -b -v Orange.tests Orange.widgets.tests
  - cd ..\..

artifacts:
  - path: dist\*.whl
