language: java
env:
  global:
    - BUILD_CMD='mvn -Dskip.tests=true clean package'
    - RUN_TESTS=true
sudo: true
matrix:
  include:
    - jdk: oraclejdk12
      env: 
       - TEST_EXCLUDES="**/*_ESTest*"
    - jdk: openjdk9
      env: 
       - TEST_EXCLUDES="**/*_ESTest*"
    - jdk: openjdk11
      env: 
       - TEST_EXCLUDES="**/*_ESTest*"
cache:
  directories:
  - "${HOME}/dependencies"
  - "${HOME}/.m2"
services:
  - xvfb
before_install:
  - "export CASHER_TIME_OUT=300"
  - "export DISPLAY=:99.0"
  - "source install_dependencies.sh"
  - mvn validate
install:
  - "$BUILD_CMD"
script:
  - if [ "$RUN_TESTS" == "true" ]; then
      cd test;
      ln -s $(pwd)/../etc/log4j.properties .;
      ./RunTravisTests.sh -e "$TEST_EXCLUDES" | tee test.log && [ -z "$(grep 'Failures:\s[^0]\|Errors:\s[^0]' test.log)" ];
    fi
