language: java
jdk:
  - openjdk8
  - oraclejdk8
sudo: false
env:
  global:
    - BUILD_CMD='make'
    - RUN_TESTS=false
matrix:
  include:
    - jdk: oraclejdk8
      env: 
        - BUILD_CMD='ant -f build.xml'
        - RUN_TESTS=true
cache:
  directories:
  - "${HOME}/dependencies"
before_install:
  - "export CASHER_TIME_OUT=300"
  - "export DISPLAY=:99.0"
  - "sh -e /etc/init.d/xvfb start"
  - "source install_dependencies.sh"
install:
  - "$BUILD_CMD"
script:
  - if [ "$RUN_TESTS" == "true" ]; then
      cd test;
      ln -s $(pwd)/../etc/log4j.properties .;
      ./RunDefaultUnitTests.sh | tee test.log && [ -z "$(grep 'Failures:\s[^0]\|Errors:\s[^0]' test.log)" ];
    fi
