#   from: https://raw.githubusercontent.com/AndrewAnnex/SpiceyPy/master/appveyor.yml
# retrieved feb 2 2019

build: off

environment:
  global:
      WITH_COMPILER: "cmd /E:ON /V:ON /C .\\appveyor\\windows_sdk.cmd"

  matrix:

      - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
        PYTHON: "C:\\Python37-x64"
        PYTHON_VERSION: "3.7.x"
        ARCH: "64"
        WINDOWS_SDK_VERSION: "v7.1"
        PLAT_NAME: "win-amd64"
        PY_TAG: "cp37"

      - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
        PYTHON: "C:\\Python38-x64"
        PYTHON_VERSION: "3.8.x"
        ARCH: "64"
        WINDOWS_SDK_VERSION: "v7.1"
        PLAT_NAME: "win-amd64"
        PY_TAG: "cp38"

      - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
        PYTHON: "C:\\Python39-x64"
        PYTHON_VERSION: "3.9.x"
        ARCH: "64"
        WINDOWS_SDK_VERSION: "v7.1"
        PLAT_NAME: "win-amd64"
        PY_TAG: "cp39"

      - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
        PYTHON: "C:\\Python310-x64"
        PYTHON_VERSION: "3.10.x"
        ARCH: "64"
        WINDOWS_SDK_VERSION: "v7.1"
        PLAT_NAME: "win-amd64"
        PY_TAG: "cp310"

platform:
  - x64

cache:
  - C:\Users\appveyor\Downloads -> setup.py

install:
  # Check that we have the expected version and architecture for Python
  - "%PYTHON%/python --version"
  - "%PYTHON%/python -c \"import struct; print(struct.calcsize('P') * 8)\""

# Log out the python version just so we know it
  - ECHO "%PYTHON_VERSION%"

  # update path to use installed pip
  - set PATH=%PYTHON%\\scripts;%PATH%

  # Download things we absolutely need
  - pip install numpy setuptools wheel

  - IF "%ARCH%"=="32" IF "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2022" (call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat") ELSE (ECHO "probably a 64bit build or VS2015")
  - IF "%ARCH%"=="64" IF "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2022" (call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat") ELSE (ECHO "probably a 32bit build or VS2015")

  - "%PYTHON%/python setup.py develop"

  - ECHO "Installed scikit-fmm!"
  - "%PYTHON%/python -c \"import skfmm; print(skfmm.__version__)\""

test_script:
  - "%PYTHON%/python -c \"import skfmm, sys; sys.exit(skfmm.test())\""

after_test:
  - ECHO "DONE!"
  - ECHO "BUILDING WHEELS..."
  - "%PYTHON%/python setup.py sdist bdist_wheel --plat-name=%PLAT_NAME% --python-tag=%PY_TAG%"
  - ps: "ls dist"

branches:
  only:
    - master

artifacts:
  - path: dist\*
