language: java

jdk:
  - openjdk8

env:
  matrix:
    # we skip openjdk till we find way to install "hg" to shippable image
    #- CMD="./.ci/shippable.sh no-exception-openjdk7-openjdk8"
    - CMD="./.ci/shippable.sh no-exception-openjdk9-lucene-and-others"
    - CMD="./.ci/shippable.sh no-exception-cassandra-storm-tapestry"
    - CMD="./.ci/shippable.sh no-exception-hadoop-apache-groovy-scouter"
    - CMD="./.ci/shippable.sh no-exception-only-javadoc"

branches:
  only:
    - master

build:
  cache: true
  cache_dir_list:
    - /root/.m2
    - /root/groovy-2.4.7

  pre_ci_boot:
    # This version should match version defined in "Node Pools" in Shippable UI
    image_name: drydock/u16javall
    image_tag: v7.2.4

  ci:
    # we skip PRs and commits that are not for Issues, as pitest is too time consuming
    - |
      set -e
      pwd
      ls -la
      if [ ! -d /root/groovy-2.4.7 ]; then
        wget https://dl.bintray.com/groovy/maven/apache-groovy-binary-2.4.7.zip
        unzip apache-groovy-binary-2.4.7.zip -d /root/
      fi
      # load custom PATH
      export PATH=/root/groovy-2.4.7/bin:$PATH
      SKIP_FILES1="appveyor.yml|codeship-*|buddy.yml|circleci|.travis.yml"
      SKIP_FILES2="|wercker.yml|wercker.sh|fast-forward-merge.sh|LICENSE|LICENSE.apache20|README.md"
      SKIP_FILES3="|release.sh|RIGHTS.antlr|intellij-idea-inspections.xml"
      SKIP_FILES4="|org.eclipse.jdt.core.prefs"
      SKIP_FILES5="|Jenkinsfile"
      SKIP_FILES=$SKIP_FILES1$SKIP_FILES2$SKIP_FILES3$SKIP_FILES4$SKIP_FILES5
      export RUN_JOB=1
      source ./.ci/common.sh
      # should_run_job will change RUN_JOB variable
      should_run_job "recheck" $SKIP_FILES
      if [[ $RUN_JOB == 1 ]];
      then
        echo "eval of CMD is starting"
        echo "CMD=$CMD"
        eval $CMD
        echo "eval of CMD is completed"
      else
        echo "Build is skipped"
      fi
