version: '{build}'
install:
  - git submodule update --init --recursive

  # environment and system dependency
  - appveyor DownloadFile https://github.com/premake/premake-core/releases/download/v5.0.0-alpha10/premake-5.0.0-alpha10-windows.zip
  - 7z x premake-5.0.0-alpha10-windows.zip
  
  - appveyor DownloadFile https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz
  - tar xf libevent-2.0.22-stable.tar.gz
  - move libevent-2.0.22-stable event
  - xcopy /E event\WIN32-Code event\include
  
  - appveyor DownloadFile http://downloads.sourceforge.net/freetype/freetype-2.7.tar.bz2
  - tar xf freetype-2.7.tar.bz2
  - move freetype-2.7 freetype
  
  - appveyor DownloadFile http://downloads.sourceforge.net/irrlicht/irrlicht-1.8.4.zip
  - 7z x irrlicht-1.8.4.zip
  - md irrlicht
  - move irrlicht-1.8.4\source\Irrlicht irrlicht\src
  - move irrlicht-1.8.4\include irrlicht\include
  
  - appveyor DownloadFile https://www.lua.org/ftp/lua-5.2.4.tar.gz
  - tar xf lua-5.2.4.tar.gz
  - move lua-5.2.4\src lua
  
  - appveyor DownloadFile https://www.sqlite.org/2016/sqlite-amalgamation-3150200.zip
  - 7z x sqlite-amalgamation-3150200.zip
  - move sqlite-amalgamation-3150200 sqlite3

  # let premake happy
  - xcopy /E premake\* .
  
  # patch irrlicht
  - patch -p1 < irrlicht\irrlicht.patch
  
  # premake
  - premake5 vs2015
  
configuration: Release
build: 
    project: build/ygo.sln
    parallel: true
after_build:
  - ps: move bin\release\ygopro.exe .
artifacts:
  - path: ygopro.exe
    name: ygopro
deploy:
    tag: latest
    release: latest
    description: 'Auto'
    provider: GitHub
    auth_token:
        secure: DOOS4g7CT8ctOgiMr62K56qQ1FO6s2ESpqNZlhf8F4nomemvvwxV/pRj9nbKmtjR
    artifact: ygopro.exe
    force_update: true
    on:
        branch: master
    appveyor_repo_tag: false
