georgeyk/loafer

View on GitHub
.circleci/config.yml

Summary

Maintainability
Test Coverage
version: 2
jobs:
  build_py36: &test-template
    working_directory: ~/repo
    docker:
      - image: circleci/python:3.6.9-stretch
    environment:
      PRE_COMMIT_SKIP=no-commit-to-branch

    steps:
      - checkout

      - restore_cache:
          key: deps-{{ .Branch }}-{{ checksum "setup.py" }}

      - run:
          name: install
          command: |
            python3 -m venv venv
            . venv/bin/activate
            pip install -r requirements/test.txt
            pip install -e .

      - save_cache:
          key: deps-{{ .Branch }}-{{ checksum "setup.py" }}
          paths:
            - "venv"

      - run:
          name: linters
          command: |
            . venv/bin/activate
            SKIP=$PRE_COMMIT_SKIP pre-commit run -a -v

      - run:
          name: tests
          command: |
            . venv/bin/activate
            make test-cov

      - run:
          name: check-fixtures
          command: |
            . venv/bin/activate
            make check-fixtures

  build_py37:
    <<: *test-template
    docker:
      - image: circleci/python:3.7.7-stretch
    environment:
      PRE_COMMIT_SKIP=no-commit-to-branch

  build_py38:
    <<: *test-template
    docker:
      - image: circleci/python:3.8.2-buster
    environment:
      PRE_COMMIT_SKIP=no-commit-to-branch


workflows:
  version: 2
  commit:
    jobs:
      - build_py36
      - build_py37
      - build_py38

  scheduled:
    triggers:
      - schedule:
          cron: "0 0 * * *"
          filters:
            branches:
              only: master

    jobs:
      - build_py36
      - build_py37
      - build_py38