version: '{build}'
clone_folder: c:\pillow
init:
- ECHO %PYTHON%
#- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# Uncomment previous line to get RDP access during the build.

environment:
  X64_EXT: -x64
  EXECUTABLE: python.exe
  PIP_DIR: Scripts
  VENV: NO
  matrix:
  - PYTHON: C:/vp/pypy2
    EXECUTABLE: bin/pypy.exe
    PIP_DIR: bin
    VENV: YES
  - PYTHON: C:/Python27-x64
  - PYTHON: C:/Python34
  - PYTHON: C:/Python27
  - PYTHON: C:/Python34-x64
  - PYTHON: C:/Python33
  - PYTHON: C:/Python33-x64


install:
- curl -fsSL -o pillow-depends.zip https://github.com/python-pillow/pillow-depends/archive/master.zip
- 7z x pillow-depends.zip -oc:\
- mv c:\pillow-depends-master c:\pillow-depends
- xcopy c:\pillow-depends\*.zip c:\pillow\winbuild\
- xcopy c:\pillow-depends\*.tar.gz c:\pillow\winbuild\
- xcopy /s c:\pillow-depends\test_images\* c:\pillow\tests\images
- cd c:\pillow\winbuild\
- ps: |
      if ($env:PYTHON -eq "c:/vp/pypy2")
      {
        c:\pillow\winbuild\appveyor_install_pypy.cmd
      }
- c:\python34\python.exe c:\pillow\winbuild\build_dep.py
- c:\pillow\winbuild\build_deps.cmd

build_script:
- '%PYTHON%\%EXECUTABLE% c:\pillow\winbuild\build.py'
- cd c:\pillow
- dir dist\*.egg
- '%PYTHON%\%EXECUTABLE% selftest.py --installed'

test_script:
- cd c:\pillow
- '%PYTHON%\%PIP_DIR%\pip.exe install nose'
- '%PYTHON%\%EXECUTABLE% test-installed.py -v -s'

matrix:
  fast_finish: true

artifacts:
- path: pillow\dist\*.egg
  name: egg
- path: pillow\dist\*.wheel
  name: wheel

after_test:
  - '%PYTHON%\%PIP_DIR%\pip.exe install wheel'
  - cd c:\pillow\winbuild\
  - '%PYTHON%\%EXECUTABLE% c:\pillow\winbuild\build.py --wheel'
  - cd c:\pillow
  - ps: Get-ChildItem .\dist\*.* | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }

deploy:
  provider: S3
  region: us-west-2
  access_key_id: AKIAIRAXC62ZNTVQJMOQ
  secret_access_key:
    secure: Hwb6klTqtBeMgxAjRoDltiiqpuH8xbwD4UooDzBSiCWXjuFj1lyl4kHgHwTCCGqi
  bucket: pillow-nightly
  folder: win/$(APPVEYOR_BUILD_NUMBER)/
  artifact: /.*egg|wheel/
  on:
    branch: master

# Uncomment the following line to get RDP access after the build/test and block for
# up to the timeout limit (~1hr)
#
#on_finish:
#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))