version: 3.0.0.{build}-test

shallow_clone: true

matrix:
  fast_finish: true

environment:
  LUAROCKS_VER: 3.0.0

  matrix:
  # Lua 5.1 tests
  - LUA: "lua 5.1"
    COMPILER: "vs"
    FILES: ""
    EXCLUDE: "integration"
  - LUA: "lua 5.1"
    COMPILER: "vs"
    FILES: ""
    EXCLUDE: "unit"
  - LUA: "lua 5.1"
    COMPILER: "mingw"
    FILES: "spec//build_spec.lua"
    EXCLUDE: ""
  # Lua 5.2 tests  
  - LUA: "lua 5.2"
    COMPILER: "vs"
    FILES: ""
    EXCLUDE: "integration"
  - LUA: "lua 5.2"
    COMPILER: "vs"
    FILES: ""
    EXCLUDE: "unit"
  - LUA: "lua 5.2"
    COMPILER: "mingw"
    FILES: "spec//build_spec.lua"
    EXCLUDE: ""
  # Lua 5.3 tests
  - LUA: "lua 5.3"
    COMPILER: "vs"
    FILES: ""
    EXCLUDE: "integration"
  - LUA: "lua 5.3"
    COMPILER: "vs"
    FILES: ""
    EXCLUDE: "unit"
  - LUA: "lua 5.3"
    COMPILER: "mingw"
    FILES: "spec//build_spec.lua"
    EXCLUDE: ""
  # LuaJIT 2.1 tests
  - LUA: "luajit 2.1"
    COMPILER: "vs"
    FILES: ""
    EXCLUDE: "integration"
  - LUA: "luajit 2.1"
    COMPILER: "vs"
    FILES: ""
    EXCLUDE: "unit"
  - LUA: "luajit 2.1"
    COMPILER: "mingw"
    FILES: "spec//build_spec.lua"
    EXCLUDE: ""

init:
# Setup Lua development/build environment
# Make VS 2015 command line tools available
- call "%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %platform%
# Add MinGW compiler to the path
- set PATH=C:\MinGW\bin;%PATH%

before_build:
  - set PATH=C:\Python27\Scripts;%PATH% # Add directory containing 'pip' to PATH
  - pip install hererocks
  - hererocks lua_install --%LUA% --luarocks latest --target=%COMPILER%
  - call lua_install\bin\activate

build_script:
  - luarocks install busted 1> NUL 2> NUL
  - luarocks install cluacov 1> NUL 2> NUL

test_script:
  - busted -o gtest -v --lpath=.//?.lua --exclude-tags=ssh,unix,%EXCLUDE% -Xhelper lua_dir=%CD%\lua_install,appveyor,%COMPILER% %FILES%

after_test:
  - pip install codecov
  - luacov -c testrun/luacov.config
  - cd testrun && codecov -f luacov.report.out -X gcov