language: python

matrix:
  include:
    - os: linux
      env:
        - LUA="lua=5.1"
    - os: linux
      env:
        - LUA="lua=5.2"
    - os: linux
      env:
        - LUA="lua=5.3"
    - os: linux
      env:
        - LUA="luajit=2.0"
    - os: linux
      env:
        - LUA="luajit=2.1"
    - os: osx
      language: generic
      env:
        - LUA="lua=5.1"
    - os: osx
      language: generic
      env:
        - LUA="lua=5.2"
    - os: osx
      language: generic
      env:
        - LUA="lua=5.3"
    - os: osx
      language: generic
      env:
        - LUA="luajit=2.0"
    - os: osx
      language: generic
      env:
        - LUA="luajit=2.1"


before_install:
  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update;fi
  - pip install hererocks
  - hererocks lua_install -r^ --$LUA
  - export PATH=$PATH:$PWD/lua_install/bin # Add directory with all installed binaries to PATH

install:
  - luarocks install busted
  - luarocks install luacov
  - luarocks install luacov-coveralls

script:
  - busted -Xhelper travis --verbose
  - busted -Xhelper travis,env=full --verbose

after_success:
  - luacov -c $TRAVIS_BUILD_DIR/test/luacov.config
  - cd $TRAVIS_BUILD_DIR/test/ && bash <(curl -s https://codecov.io/bash)
  - grep "Summary" -B1 -A1000 $TRAVIS_BUILD_DIR/test/luacov.report.out

notifications:
  email:
    on_success: change
    on_failure: change
  webhooks:
    urls:
      - https://webhooks.gitter.im/e/3320fc3f28abbb06e1d8
    on_success: change
    on_failure: always
    on_start: never