version: 2
jobs:
  build:
    working_directory: ~/code
    docker:
      - image: circleci/openjdk:8-jdk
    steps:
      - checkout
      - restore_cache:
          key: jars-{{ checksum "build.gradle" }}-{{ checksum  "library/build.gradle" }}-{{ checksum  "sample/build.gradle" }}
      - run:
          name: Download Dependencies
          command: ./gradlew library:dependencies sample:dependencies --console=plain
      - save_cache:
          paths:
            - ~/.gradle
          key: jars-{{ checksum "build.gradle" }}-{{ checksum  "library/build.gradle" }}-{{ checksum  "sample/build.gradle" }}
      - run:
          name: Run Build
          command: ./gradlew build --console=plain
      - store_test_results:
          path: library/build/test-results/test
      - run:
          name: Generate Coverage
          command: ./gradlew jacocoTestReport --console=plain
      - run:
          name: Upload Coverage
          command: bash <(curl -s https://codecov.io/bash)

version: 2
jobs:
  build:
    working_directory: ~/code
    docker:
      - image: circleci/openjdk:8-jdk
    steps:
      - checkout
      - restore_cache:
          key: jars-{{ checksum "build.gradle" }}-{{ checksum  "library/build.gradle" }}-{{ checksum  "sample/build.gradle" }}
      - run:
          name: Run Build
          command: ./gradlew build --console=plain
      - store_test_results:
          path: library/build/test-results/test
      - run:
          name: Generate Coverage
          command: ./gradlew jacocoTestReport --console=plain
      - run:
          name: Upload Coverage
          command: bash <(curl -s https://codecov.io/bash)
      - save_cache:
          paths:
            - ~/.gradle
          key: jars-{{ checksum "build.gradle" }}-{{ checksum  "library/build.gradle" }}-{{ checksum  "sample/build.gradle" }}

Save the cache after build
Save the cache after build
