Ryuno-Ki/webmention-tools

View on GitHub
.circleci/config.yml

Summary

Maintainability
Test Coverage
# Python CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-python/ for more details
#
version: 2
jobs:
  build:
    docker:
      - image: circleci/python:3.8.0

    working_directory: ~/repo

    steps:
      - checkout

      # Download and cache dependencies
      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "requirements.txt" }}
          # fallback to using the latest cache if no exact match is found
          - v1-dependencies-

      - run:
          name: install dependencies
          command: |
            python3 -m venv venv
            . venv/bin/activate
            pip3 install -r requirements.txt

      - save_cache:
          paths:
            - ./venv
          key: v1-dependencies-{{ checksum "requirements.txt" }}

  lint:
    docker:
      - image: circleci/python:3.8.0

    working_directory: ~/repo

    steps:
      - checkout

      - run:
          name: install dependencies
          command: |
            python3 -m venv venv
            . venv/bin/activate
            pip3 install -r requirements.txt
            pip3 install -r requirements-dev.txt

      - run:
          name: run lint
          command: |
            . venv/bin/activate
            pylint webmentiontools
            pycodestyle webmentiontools
            flake8 webmentiontools
            mypy webmentiontools
            flake8 test
 
  test:
    docker:
      - image: circleci/python:3.8.0

    working_directory: ~/repo

    steps:
      - checkout

      - run:
          name: install dependencies
          command: |
            python3 -m venv venv
            . venv/bin/activate
            pip3 install -r requirements.txt
            pip3 install -r requirements-dev.txt

      - run:
          name: run tests with coverage
          command: |
            . venv/bin/activate
            pytest --cov=webmentiontools -m "not with_domain"
            codecov

      - store_artifacts:
          path: test-reports
          destination: test-reports

      - store_test_results:
          path: test-reports

  smoke_test37:
    docker:
      - image: circleci/python:3.7.5

    working_directory: ~/repo

    steps:
      - checkout

      # Download and cache dependencies
      - restore_cache:
          keys:
          - v37-dependencies-{{ checksum "requirements.txt" }}
          # fallback to using the latest cache if no exact match is found
          - v37-dependencies-

      - run:
          name: install dependencies
          command: |
            python3 -m venv venv
            . venv/bin/activate
            pip3 install -r requirements.txt
            pip3 install -r requirements-dev.txt
            pytest --cov=webmentiontools -m "not with_domain"

      - save_cache:
          paths:
            - ./venv
          key: v37-dependencies-{{ checksum "requirements.txt" }}

  smoke_test36:
    docker:
      - image: circleci/python:3.6.9

    working_directory: ~/repo

    steps:
      - checkout

      # Download and cache dependencies
      - restore_cache:
          keys:
          - v36-dependencies-{{ checksum "requirements.txt" }}
          # fallback to using the latest cache if no exact match is found
          - v36-dependencies-

      - run:
          name: install dependencies
          command: |
            python3 -m venv venv
            . venv/bin/activate
            pip3 install -r requirements.txt
            pip3 install -r requirements-dev.txt
            pytest --cov=webmentiontools -m "not with_domain"

      - save_cache:
          paths:
            - ./venv
          key: v36-dependencies-{{ checksum "requirements.txt" }}


workflows:
  version: 2
  build-test:
    jobs:
      - build
      - lint
      - test
      - smoke_test37
      - smoke_test36