language: scala

sudo: false

scala:
  - "2.12.11"
  - "2.13.3"

before_install: curl -Ls https://git.io/jabba | bash && . ~/.jabba/jabba.sh
install: jabba install "adopt@~1.$TRAVIS_JDK.0-0" && jabba use "$_" && java -Xmx32m -version

addons:
  apt:
    packages:
    - graphviz

before_cache:
  - find $HOME/.ivy2 -name "ivydata-*.properties" -print -delete
  - find $HOME/.sbt  -name "*.lock"               -print -delete

cache:
  directories:
    - $HOME/.cache/coursier
    - $HOME/.ivy2/cache
    - $HOME/.sbt
    - $HOME/.jabba/jdk

# script for the default 'test' stage:
script: sbt -jvm-opts .jvmopts-travis -Dakka.build.scalaVersion=$TRAVIS_SCALA_VERSION ";update ;mimaReportBinaryIssues ;test:compile ;validateCompile ;headerCheckAll"

jobs:
  include:
    - stage: whitesource
      name: whitesource
      script: git branch -f "$TRAVIS_BRANCH" && git checkout "$TRAVIS_BRANCH" && sbt whitesourceCheckPolicies whitesourceUpdate

stages:
  - name: whitesource
    if: repo = akka/akka AND ((branch = master AND type != pull_request) OR tag =~ ^v) AND env(TRAVIS_SCALA_VERSION) =~ ^2.12
  - name: test
    if: type == pull_request OR NOT tag =~ ^v

env:
  global:
    - TRAVIS_JDK=8
    # encrypt with: travis encrypt WHITESOURCE_PASSWORD=...
    - secure: "BCWtUqKG7trI7n5OZE2ReCGXQE/f5P8kXpfcpa5DXJeautBnpH/jettY5ermB5JLl12CisG6S4nS3BSKP4Uf8WPpPeSq402CZYTCbUxMWCvS+9N+kEQrHU7iwYqHQBL/RMy6eIyWPRD+JqxKuvlgfNuSEry9pMagwW7mNQrZgYU="

# safelist
branches:
  only:
  - master
  - release-2.5
  - /^v\d+\.\d+(\.\d+)?(-\S*)?$/
