language: java

sudo: false
jdk:
  - openjdk8
env:
  - CODACY_PROJECT_TOKEN=636acc26006042628c9ec9391472a1c6
  
before_install:
  - sudo apt-get install jq
  - wget -O ~/codacy-coverage-reporter-assembly-latest.jar https://oss.sonatype.org/service/local/repositories/releases/content/com/codacy/codacy-coverage-reporter/4.0.0/codacy-coverage-reporter-4.0.0-assembly.jar
  - if [ ! -z "$GPG_SECRET_KEYS" ]; then echo $GPG_SECRET_KEYS | base64 --decode | $GPG_EXECUTABLE --import; fi
  - if [ ! -z "$GPG_OWNERTRUST" ]; then echo $GPG_OWNERTRUST | base64 --decode | $GPG_EXECUTABLE --import-ownertrust; fi
  
script: "mvn cobertura:cobertura"

after_success:
  - bash <(curl -s https://codecov.io/bash)
  - mvn site
  - java -jar ~/codacy-coverage-reporter-assembly-latest.jar report -l Java -r target/site/jacoco/jacoco.xml

install:
  - mvn --settings .travis/settings.xml package install -DskipTests=true -Dgpg.skip -Dmaven.javadoc.skip=true -B -V  
  
deploy:
  -
    provider: script
    script: .travis/deploy.sh
    skip_cleanup: true
    on:
      repo: opennars/opennars-gui
      branch: master
      jdk: oraclejdk8
  -
    provider: script
    script: .travis/deploy.sh
    skip_cleanup: true
    on:
      repo: opennars/opennars-gui
      tags: true
      jdk: oraclejdk8
      
