version: 2.1

orbs:
  python: circleci/python@1.3.2

jobs:
  build-and-test:
    parameters:
      python_ver:
        type: string
    executor:
      name: python/default
      tag: << parameters.python_ver >>
    steps:
      - checkout
      - run:
          name: Check python version
          command: |
            pyenv version > .cache-key
      - restore_cache:
          key: pipenv-{{ checksum "Pipfile.lock" }}-{{ checksum ".cache-key" }}
      - run:
          name: Install dependencies
          command: |
            pip install pipenv coveralls[yaml]
            pipenv install --dev
      - save_cache:
          key: pipenv-{{ checksum "Pipfile.lock" }}-{{ checksum ".cache-key" }}
          paths:
            - /home/circleci/.local/share/
      - run:
          name: Test
          command: |
            source env.test
            pipenv run python manage.py collectstatic --no-input
            pipenv run pytest --junit-xml var/test-results/results.xml -v --cov sklandymas --cov coupons --cov-report=html --cov-report=term
            pipenv run black --check manage.py sklandymas coupons tests
            pipenv run mypy sklandymas coupons tests
      - store_test_results:
          path: var/test-results
      - run:
          name: Generate reports
          when: on_success
          command: |
            coveralls

workflows:
  main:
    jobs:
      - build-and-test:
          matrix:
            parameters:
              python_ver: ["3.7", "3.8"]

version: 2.1

orbs:
  python: circleci/python@1.3.2

jobs:
  build-and-test:
    parameters:
      python_ver:
        type: string
    executor:
      name: python/default
      tag: << parameters.python_ver >>
    steps:
      - checkout
      - run:
          name: Check python version
          command: |
            pyenv version > .cache-key
      - restore_cache:
          key: pipenv-{{ checksum "Pipfile.lock" }}-{{ checksum ".cache-key" }}
      - run:
          name: Install dependencies
          command: |
            pip install pipenv coveralls[yaml]
            pipenv install --dev --python=`pyenv which python`
      - save_cache:
          key: pipenv-{{ checksum "Pipfile.lock" }}-{{ checksum ".cache-key" }}
          paths:
            - /home/circleci/.local/share/
      - run:
          name: Test
          command: |
            source env.test
            pipenv run python manage.py collectstatic --no-input
            pipenv run pytest --junit-xml var/test-results/results.xml -v --cov sklandymas --cov coupons --cov-report=html --cov-report=term
            pipenv run black --check manage.py sklandymas coupons tests
            pipenv run mypy sklandymas coupons tests
      - store_test_results:
          path: var/test-results
      - run:
          name: Generate reports
          when: on_success
          command: |
            coveralls

workflows:
  main:
    jobs:
      - build-and-test:
          matrix:
            parameters:
              python_ver: ["3.7", "3.8"]

Use pyenv provided python for the build
Use pyenv provided python for the build
