language: java
jdk: openjdk11
os: linux
dist: xenial

cache:
  timeout: 180
  directories:
  - "$HOME/.m2/repository"

## export GPG details
before_install:
  - echo $GPG_SECRET_KEYS | base64 --decode | $GPG_EXECUTABLE --import
  - echo $GPG_OWNERTRUST | base64 --decode | $GPG_EXECUTABLE --import-ownertrust


install:
   - mvn install -U -DskipTests=true -Dmaven.javadoc.skip=true -B -V

script:
  # master or PRs into master, use the release profile
  - 'if [[ "$TRAVIS_BRANCH" =~ master* ]]; then mvn test -B -P release; fi'
  - 'if ! [[ "$TRAVIS_BRANCH" =~ master* ]]; then mvn test -B; fi'


#NOTE: tests were already run as part of the script phase
deploy:
  # deploy develop as a snapshot
  - provider: script
    script: "cp .travis.settings.xml $HOME/.m2/settings.xml && mvn deploy -DskipTests=true"
    on:
      branch: develop
  # deploy master to production
  - provider: script
    script: "cp .travis.settings.xml $HOME/.m2/settings.xml && mvn deploy -P release -DskipTests=true"
    on:
      branch: master

language: java
jdk: openjdk11
os: linux
dist: xenial

cache:
  timeout: 180
  directories:
  - "$HOME/.m2/repository"

## export GPG details
before_install:
  - echo $GPG_SECRET_KEYS | base64 --decode | $GPG_EXECUTABLE --import
  - echo $GPG_OWNERTRUST | base64 --decode | $GPG_EXECUTABLE --import-ownertrust


install:
   - mvn install -U -DskipTests=true -Dmaven.javadoc.skip=true -B -V

script:
  # master or PRs into master, use the release profile
  - 'if [[ "$TRAVIS_BRANCH" =~ master* ]]; then mvn test -B -P release; fi'
  - 'if ! [[ "$TRAVIS_BRANCH" =~ master* ]]; then mvn test -B; fi'


# NOTE: tests were already run as part of the script phase
deploy:
  # deploy develop as a snapshot
  - provider: script
    script: "cp .travis.settings.xml $HOME/.m2/settings.xml && mvn deploy -DskipTests=true"
    on:
      branch: develop
  # deploy master to production
  - provider: script
    script: "cp .travis.settings.xml $HOME/.m2/settings.xml && mvn deploy -P release -DskipTests=true"
    on:
      branch: master

# Remove the binaries generated by this build.
before_cache:
      - rm -rf $HOME/.m2/repository/org/opencds/cqf/cql-engine
      - rm -rf $HOME/.m2/repository/org/opencds/cqf/cql-engine-fhir

Remove files that alter the cache on build
Remove files that alter the cache on build
