language: java
os:
  - linux
jdk:
  - openjdk8
sudo: required
dist: xenial
services:
  - docker
cache:
  directories:
    - $HOME/mvn-home
addons:
  apt:
    sources:
      - deadsnakes

install:
  # install maven 3.3.9 if it is not in cache already
  - bash .travis.install-maven.sh "3.3.9" "${HOME}/mvn-home"
  - export M2_HOME=${HOME}/mvn-home
  - export PATH=${HOME}/mvn-home/bin:${PATH}
  # visual check that we have the correct maven/python versions installed
  - mvn -version
  - python2 --version
  - python3 --version

before_install:
  - wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
  - sudo dpkg -i packages-microsoft-prod.deb
  - sudo add-apt-repository universe
  - sudo apt update
  - sudo apt install apt-transport-https
  - sudo apt update
  - sudo apt install dotnet-sdk-3.1
  - sudo apt install python3.6
  - sudo rm /usr/bin/python3
  - sudo ln -s python3.6 /usr/bin/python3

jobs:
  include:
    - stage: "tests"
      script: "mvn clean install -Dci --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn"
      name: "mvn clean install"
    - script: "touch gremlin-dotnet/src/.glv && touch gremlin-dotnet/test/.glv && mvn clean install -q -DskipTests && mvn verify -pl :gremlin-dotnet,:gremlin-dotnet-tests -P gremlin-dotnet"
      name: ".net"
    - script: "touch gremlin-python/.glv && mvn clean install -q -DskipTests && mvn verify -pl gremlin-python"
      name: "python"
    - script: "mvn clean install -q -DskipTests && mvn verify -pl :gremlin-javascript"
      name: "javascript"
    - script:
      - "mvn clean install -q -DskipTests"
      - "mvn verify -pl :gremlin-server -DskipTests -DskipIntegrationTests=false"
      name: "gremlin server"
    - script:
        - "mvn clean install -q -DskipTests"
        - "mvn verify -pl :gremlin-console -DskipIntegrationTests=false"
      name: "gremlin console"
    - script:
      - "mvn clean install -q -DskipTests"
      - "travis_wait 60 mvn verify -pl :spark-gremlin -DskipIntegrationTests=false"
      name: "spark"
    - script: "docker/build.sh"
      name: "docker"
