version: 2
jobs:
  build:
    docker:
      - image: cimg/python:3.8
    branches:
      ignore: deploy
    steps:
      - checkout
      - restore_cache:
          key: deps-{{ .Branch }}-{{ checksum "requirements.txt" }}
      - run:
          name: install python dependencies in venv
          command: |
            ssh-keyscan github.com >> ~/.ssh/known_hosts
            python3 -m venv env
            env/bin/pip3 install -r requirements.txt --upgrade
            env/bin/pip3 install -r user_requirements.txt --upgrade
      - save_cache:
          key: deps-{{ .Branch }}-{{ checksum "requirements.txt" }}
          paths:
            - "env"
      - run:
          name: Lint tests
          command: env/bin/python3 -m flake8 --config=tox_tests.ini ./test/
      - run:
          name: Lint classes
          command: env/bin/python3 -m flake8 --config=tox_classes.ini ./classes/
      - run:
          name: Lint code
          command: env/bin/python3 -m flake8 ./
      - run:
          name: Prepare Git for test
          command: |
            git config user.name SmokeDetector
            git config user.email "smokey@erwaysoftware.com"
      - run:
          name: Pytest
          command: env/bin/python3 -W default::Warning -m pytest -n 4 test

version: 2
jobs:
  build:
    docker:
      - image: cimg/python:3.8
    branches:
      ignore: deploy
    steps:
      - checkout
      - restore_cache:
          key: deps-cimg-python3.8-{{ .Branch }}-{{ checksum "requirements.txt" }}
      - run:
          name: install python dependencies in venv
          command: |
            ssh-keyscan github.com >> ~/.ssh/known_hosts
            python3 -m venv env
            env/bin/pip3 install -r requirements.txt --upgrade
            env/bin/pip3 install -r user_requirements.txt --upgrade
      - save_cache:
          key: deps-cimg-python3.8-{{ .Branch }}-{{ checksum "requirements.txt" }}
          paths:
            - "env"
      - run:
          name: Lint tests
          command: env/bin/python3 -m flake8 --config=tox_tests.ini ./test/
      - run:
          name: Lint classes
          command: env/bin/python3 -m flake8 --config=tox_classes.ini ./classes/
      - run:
          name: Lint code
          command: env/bin/python3 -m flake8 ./
      - run:
          name: Prepare Git for test
          command: |
            git config user.name SmokeDetector
            git config user.email "smokey@erwaysoftware.com"
      - run:
          name: Pytest
          command: env/bin/python3 -W default::Warning -m pytest -n 4 test

Use new cache for new image
CircleCI: Use new cache for new image
