version: 2

jobs:
  build:
    docker:
      - image: circleci/python:3.6

    steps:
      - checkout
      - run: sudo pip install tox
      - restore_cache:
         keys:
           - v1-tox-{{ checksum "tox.ini" }}-{{ checksum "requirements/base.txt" }}-{{ checksum "requirements/dev.txt" }}
      - run: tox --notest
      - save_cache:
         key: v1-tox-{{ checksum "tox.ini" }}-{{ checksum "requirements/base.txt" }}-{{ checksum "requirements/dev.txt" }}
         paths:
           - .tox
      - run: tox -e flake8
      - run: tox -e isort
      - run: tox -e py2-tests
      - run: tox -e py3-tests
      - run: tox -e coverage

workflows:
  version: 2

  build:
    jobs:
      - build

version: 2

jobs:
  flake8:
    docker:
      - image: circleci/python:3.6

    steps:
      - checkout
      - run: sudo pip install tox
      - restore_cache:
         keys:
           - v1-tox-{{ checksum "tox.ini" }}-{{ checksum "requirements/base.txt" }}-{{ checksum "requirements/dev.txt" }}
      - run: tox --notest
      - save_cache:
         key: v1-tox-{{ checksum "tox.ini" }}-{{ checksum "requirements/base.txt" }}-{{ checksum "requirements/dev.txt" }}
         paths:
           - .tox
      - run: tox -e flake8

  isort:
    docker:
      - image: circleci/python:3.6

    steps:
      - checkout
      - run: sudo pip install tox
      - restore_cache:
         keys:
           - v1-tox-{{ checksum "tox.ini" }}-{{ checksum "requirements/base.txt" }}-{{ checksum "requirements/dev.txt" }}
      - run: tox --notest
      - save_cache:
         key: v1-tox-{{ checksum "tox.ini" }}-{{ checksum "requirements/base.txt" }}-{{ checksum "requirements/dev.txt" }}
         paths:
           - .tox
      - run: tox -e isort

  tests:
    docker:
      - image: circleci/python:3.6

    steps:
      - checkout
      - run: sudo pip install tox
      - restore_cache:
         keys:
           - v1-tox-{{ checksum "tox.ini" }}-{{ checksum "requirements/base.txt" }}-{{ checksum "requirements/dev.txt" }}
      - run: tox --notest
      - save_cache:
         key: v1-tox-{{ checksum "tox.ini" }}-{{ checksum "requirements/base.txt" }}-{{ checksum "requirements/dev.txt" }}
         paths:
           - .tox
      - run: tox -e py2-tests
      - run: tox -e py3-tests
      - run: tox -e coverage

workflows:
  version: 2

  build:
    jobs:
      - flake8
      - isort
      - tests

Divide circle ci into different jobs for better feedback on prs
chore: Divide circle ci into different jobs for better feedback on prs
