version: '{build}'
image: Visual Studio 2017

skip_tags: true

install:
  - git submodule update --init --recursive

  # environment and system dependency
  - bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://github.com/premake/premake-core/releases/download/v5.0.0-alpha13/premake-5.0.0-alpha13-windows.zip ; exit 0"
  - 7z x premake-5.0.0-alpha13-windows.zip
  
  - bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz ; exit 0"
  - tar xf libevent-2.0.22-stable.tar.gz
  - move libevent-2.0.22-stable event
  - xcopy /E event\WIN32-Code event\include
  
  - bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://www.sqlite.org/2018/sqlite-amalgamation-3240000.zip ; exit 0"
  - 7z x -y sqlite-amalgamation-3240000.zip
  - move sqlite-amalgamation-3240000 sqlite3
  
  - appveyor DownloadFile https://github.com/tronkko/dirent/raw/master/include/dirent.h
  - move dirent.h gframe\

  # let premake happy
  - xcopy /E premake\* .
    
  # premake
  - premake5 vs2017
  
configuration: Release

build: 
    project: build/ygo.sln
    parallel: true

after_build:
  - ps: move bin\release\ygopro.exe .


test: off

artifacts:
  - path: ygopro.exe
    name: ygopro server mode

deploy:
  release: win
  description: 'Automatic build commit $(APPVEYOR_REPO_COMMIT) $(APPVEYOR_REPO_COMMIT_TIMESTAMP)'
  provider: GitHub
  force_update: true
  auth_token:
    secure: EQ9miMjfX/QAoBvgc6D+JLmHatLyxOEKZ/uo68QijxWW5Gp4MzB/pOH9+u2GlDVO
  on:
    branch: server

cache:
  - premake-5.0.0-alpha13-windows.zip
  - libevent-2.0.22-stable.tar.gz
  - freetype-2.9.1.tar.bz2
  - irrlicht-1.8.4.zip
  - sqlite-amalgamation-3240000.zip
