machine:
  java:
    version:
      oraclejdk8
  environment:
    TERM: dumb
    JAVA_OPTS: -Djava.awt.headless=true -server -Xmx1G
    GRADLE_OPTS: '-Xmx256M -Dorg.gradle.daemon=true -Dorg.gradle.jvmargs="-Xmx256M -XX:+HeapDumpOnOutOfMemoryError"'

dependencies:
  override:
    - sudo pip install codecov
    - ./gradlew classes testClasses

  cache_directories:
    - ~/.gradle

test:
  override:
    - ./gradlew check
    - ./gradlew jacocoTestReport

  post:
    - 'find . -type f -name "*.xml" | grep "build/test-results" | xargs cp -t $CIRCLE_TEST_REPORTS/'
    - codecov --token=${CODECOV_TOKEN}

deployment:
  snapshot:
    branch: master
    commands:
      - ./gradlew publish -PsmartThingsUserName=$ARTIFACTORY_USERNAME -PsmartThingsPassword=$ARTIFACTORY_PASSWORD

  release:
    branch: release
    commands:
      - ./gradlew bintrayUpload

  1.2.x-snapshot:
    branch: 1.2.x-master
    commands:
      - ./gradlew publish -PsmartThingsUserName=$ARTIFACTORY_USERNAME -PsmartThingsPassword=$ARTIFACTORY_PASSWORD

  1.2.x-release:
    branch: 1.2.x-release
    commands:
      - ./gradlew bintrayUpload

machine:
  java:
    version:
      oraclejdk8
  environment:
    TERM: dumb
    JAVA_OPTS: -Djava.awt.headless=true -server -Xmx1G
    GRADLE_OPTS: '-Xmx256M -Dorg.gradle.daemon=true -Dorg.gradle.jvmargs="-Xmx256M -XX:+HeapDumpOnOutOfMemoryError"'

dependencies:
  override:
    - sudo apt-get update
    - sudo apt-get install -y python-dev  
    - sudo pip install codecov
    - ./gradlew classes testClasses

  cache_directories:
    - ~/.gradle

test:
  override:
    - ./gradlew check
    - ./gradlew jacocoTestReport

  post:
    - 'find . -type f -name "*.xml" | grep "build/test-results" | xargs cp -t $CIRCLE_TEST_REPORTS/'
    - codecov --token=${CODECOV_TOKEN}

deployment:
  snapshot:
    branch: master
    commands:
      - ./gradlew publish -PsmartThingsUserName=$ARTIFACTORY_USERNAME -PsmartThingsPassword=$ARTIFACTORY_PASSWORD

  release:
    branch: release
    commands:
      - ./gradlew bintrayUpload

  1.2.x-snapshot:
    branch: 1.2.x-master
    commands:
      - ./gradlew publish -PsmartThingsUserName=$ARTIFACTORY_USERNAME -PsmartThingsPassword=$ARTIFACTORY_PASSWORD

  1.2.x-release:
    branch: 1.2.x-release
    commands:
      - ./gradlew bintrayUpload

Install python-dev, which is required for latest codecov
Install python-dev, which is required for latest codecov
