language: c
sudo: false

addons:
  apt:
    sources:
    - kalakris-cmake
    packages:
    - cmake

env:
  global:
    - LUAROCKS=2.3.0
  matrix:
    - WITH_LUA_ENGINE=Lua LUA=lua5.3
    - WITH_LUA_ENGINE=LuaJIT LUA=luajit2.1
    - PROCESS_CLEANUP_TEST=1 LUA=lua5.2

os:
  - linux
  - osx

before_install:
  - git submodule update --init --recursive
  - git submodule update --recursive

script:
  - if [ "x$PROCESS_CLEANUP_TEST" = "x" ]; then make && make test; else ./tests/test-sigchld-after-lua_close.sh; fi
  # Test rock installation
  - source .ci/setenv_lua.sh
  - luarocks make
  - test $PWD = `lua -e "print(require'luv'.cwd())"`
  - luarocks remove luv
  # Test the alternate rockspec
  - mkdir build/lib
  - cp build/libuv.a build/lib
  - cp -a deps/libuv/include build
  - luarocks make rockspecs/$(ls rockspecs) LIBUV_DIR=build
  - test $PWD = `lua -e "print(require'luv'.cwd())"`

notifications:
  email: true
  irc: "irc.freenode.org#luvit"
