os: Visual Studio 2015

# Test with the latest two releases of MSVC
configuration:
  - 2015
  - 2013

# Test with the latest Lua and LuaJIT versions
environment:
  LUAROCKS_VER: 2.3.0
  matrix:
  - LUA_VER: 5.3.2
    NOCOMPAT: true  # with compatibility flags disabled.
  - LJ_VER: 2.1

platform:
  - x86
  - x64

matrix:
  fast_finish: true

cache:
  - c:\lua -> appveyor.yml
  - c:\external -> appveyor.yml

install:
  - git submodule update --init

build_script:
  - msvcbuild.bat
  - luajit.exe tests\run.lua
  # Test rock installation
  - call .ci\set_compiler_env.bat
  - call .ci\install.bat
  - luarocks make
  - ps: if("$(Get-Location)" -eq $(lua -e "print(require'luv'.cwd())")) { "LuaRocks test OK" } else { "LuaRocks test failed"; exit 1 }
  - luarocks remove luv
    # Test the alternate rockspec
  - mkdir build\lib
  - cp build\Release\uv.lib build\lib
  - cp -a deps\libuv\include build
  - ps: luarocks make rockspecs\$(ls rockspecs) LIBUV_DIR=build CFLAGS="/nologo /MT /O2"
  - ps: if("$(Get-Location)" -eq $(lua -e "print(require'luv'.cwd())")) { "LuaRocks test OK" } else { "LuaRocks test failed"; exit 1 }
  - luarocks remove luv

artifacts:
  - path: luv.dll
  - path: luajit.exe
