language: c

sudo: false

env:
  - LUA="lua 5.1"
  - LUA="lua 5.2"
  - LUA="lua 5.3"
  - LUA="luajit 2.0"
  - LUA="luajit 2.1"

before_install:
  - pip install --user cpp-coveralls hererocks
  - hererocks env --$LUA --luarocks latest
  - export PATH="$PWD/env/bin:$PATH"
  - luarocks install lua-path 
  - luarocks install dkjson
  - luarocks install luacov
  # install luacov-coveralls, but avoid installing luafilesystem
  - luarocks install luacov-coveralls --server=https://luarocks.org/dev --deps-mode=none

install:
  - luarocks make rockspecs/luafilesystem-cvs-3.rockspec CFLAGS="-O2 -fPIC -ftest-coverage -fprofile-arcs" LIBFLAG="-shared --coverage"

script:
  - lua -lluacov tests/test.lua

after_success:
  - coveralls -b . -i src --dump c.report.json
  - luacov-coveralls -j c.report.json -v

notifications:
  email:
    on_success: change
    on_failure: always
