variables:
  MAVEN_OPTS: "-Djava.awt.headless=true -Dmaven.repo.local=./.m2/repository"
  MAVEN_CLI_OPTS: "-s bin/settings.xml --batch-mode -U --errors --fail-at-end --show-version -Droot.logging.level=INFO"

cache:
  paths:
    - ./.m2/repository
  # keep cache across branch
  key: "$CI_BUILD_REF_NAME"

.verify: &verify
  stage: test
  script:
    - export repoToken=$COVERALLS_TOKEN
    - mvn $MAVEN_CLI_OPTS clean install verify jacoco:report coveralls:report -Dmaven.javadoc.skip=true

# Verify merge requests using JDK8
verify:jdk8:
  <<: *verify
  image: maven:3-jdk-8

# Verify merge requests using JDK11
verify:jdk11:
  <<: *verify
  image: maven:3-jdk-11
  when: manual

deploy:jdk8:
  stage: deploy
  script:
    - mvn $MAVEN_CLI_OPTS deploy -DskipTests=true -Dmaven.javadoc.skip=true
  only:
    - master
  image: maven:3-jdk-8

variables:
  MAVEN_OPTS: "-Djava.awt.headless=true -Dmaven.repo.local=./.m2/repository"
  MAVEN_CLI_OPTS: "-s bin/settings.xml --batch-mode -U --errors --fail-at-end --show-version -Droot.logging.level=INFO"

cache:
  paths:
    - ./.m2/repository
  # keep cache across branch
  key: "$CI_BUILD_REF_NAME"

.verify: &verify
  stage: test
  script:
    - export repoToken=$COVERALLS_TOKEN
    - export CI_BRANCH=$CI_COMMIT_REF_NAME
    - mvn $MAVEN_CLI_OPTS clean install verify jacoco:report coveralls:report -Dmaven.javadoc.skip=true

# Verify merge requests using JDK8
verify:jdk8:
  <<: *verify
  image: maven:3-jdk-8

# Verify merge requests using JDK11
verify:jdk11:
  <<: *verify
  image: maven:3-jdk-11
  when: manual

deploy:jdk8:
  stage: deploy
  script:
    - mvn $MAVEN_CLI_OPTS deploy -DskipTests=true -Dmaven.javadoc.skip=true
  only:
    - master
  image: maven:3-jdk-8

Set environment variable for coveralls
Set environment variable for coveralls