defaults: &defaults
  working_directory: /tmp/workspace
  docker:
    - image: circleci/android:api-28-alpha
  environment:
    TERM: xterm # Workaround for Gradle issues https://discuss.circleci.com/t/circleci-terminal-is-a-tty-but-term-is-not-set/9965/18

version: 2
jobs:
  build:
    parallelism: 1
    <<: *defaults
    steps:
    - checkout
    - restore_cache:
        keys:
        # This branch if available
        - v1-dep-{{ .Branch }}-
        # Default branch if not
        - v1-dep-master-
        # Any branch if there are none on the default branch - this should be unnecessary if you have your default branch configured correctly
        - v1-dep-
    - run: ./gradlew dependencies
    # Save dependency cache
    - save_cache:
        key: v1-dep-{{ .Branch }}-{{ epoch }}
        paths:
        - ~/.m2
        - ~/.gradle
    - run: ./gradlew assembleDogfood test runTest
    # Save test results
    - store_test_results:
        path: ./build/test-results
    - persist_to_workspace:
        root: .
        paths:
          - build/*

  deploy:
    <<: *defaults
    steps:
      - checkout
      - attach_workspace:
          at: .
      - run: ./gradlew uploadDeployGateDogfood

workflows:
  version: 2
  build-deploy:
    jobs:
      - build
      - deploy:
          requires:
            - build
          filters:
            branches:
              only:
                - master
                - deploy
defaults: &defaults
  working_directory: /tmp/workspace
  docker:
    - image: circleci/android:api-28-alpha
  environment:
    TERM: xterm # Workaround for Gradle issues https://discuss.circleci.com/t/circleci-terminal-is-a-tty-but-term-is-not-set/9965/18

dep_cache: &dep_cache
  restore_cache:
    keys:
      # This branch if available
      - v1-dep-{{ .Branch }}-
      # Default branch if not
      - v1-dep-master-
      # Any branch if there are none on the default branch - this should be unnecessary if you have your default branch configured correctly
      - v1-dep-

version: 2
jobs:
  build:
    parallelism: 1
    <<: *defaults
    steps:
    - checkout
    - <<: *dep_cache
    - run: ./gradlew dependencies
    # Save dependency cache
    - save_cache:
        key: v1-dep-{{ .Branch }}-{{ epoch }}
        paths:
        - ~/.m2
        - ~/.gradle
    - run: ./gradlew assembleDogfood test runTest
    # Save test results
    - store_test_results:
        path: ./build/test-results
    - persist_to_workspace:
        root: .
        paths:
          - build/*

  deploy:
    <<: *defaults
    steps:
      - checkout
      - <<: *dep_cache
      - attach_workspace:
          at: .
      - run: ./gradlew uploadDeployGateDogfood

workflows:
  version: 2
  build-deploy:
    jobs:
      - build
      - deploy:
          requires:
            - build
          filters:
            branches:
              only:
                - master
                - deploy
Add dependency cache to deploy as well
Add dependency cache to deploy as well
