uktrade/stream-zip

View on GitHub
.circleci/config.yml

Summary

Maintainability
Test Coverage
version: 2.1

jobs:
  download-test-reporter:
    docker:
      - image: cimg/base:2021.04
    steps:
      - attach_workspace:
          at: ~/workspace
      - run:
          name: Download test reporter
          command: |
            set -exu
            curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
            chmod +x ./cc-test-reporter
      - persist_to_workspace:
          root: ./
          paths:
            - cc-test-reporter
  test:
    parameters:
      python-version:
        type: string
    docker:
      - image: cimg/python:<< parameters.python-version >>
    steps:
      - checkout
      - attach_workspace:
          at: ~/workspace
      - run:
          name: Install dependencies
          command: |
            pip install -r requirements-dev.txt
      - run:
          name: Run tests
          command: |
            set -exu
            ~/workspace/cc-test-reporter before-build
            pytest --cov
            coverage xml
            ~/workspace/cc-test-reporter format-coverage --output coverage/<< parameters.python-version >>.json
      - persist_to_workspace:
          root: ./
          paths:
            - coverage/*.json
  upload-coverage:
    docker:
      - image: cimg/base:2021.04
    steps:
      - attach_workspace:
          at: ~/workspace
      - run:
          name: Upload coverage
          command: |
            set -exu
            ~/workspace/cc-test-reporter sum-coverage ~/workspace/coverage/*.json -p 6
            ~/workspace/cc-test-reporter upload-coverage

workflows:
  test:
    jobs:
      - download-test-reporter
      - test:
          requires:
            - download-test-reporter
          matrix:
            parameters:
              python-version:
                - "3.7.4"
                - "3.7.11"
                - "3.8.0"
                - "3.8.12"
                - "3.9.0"
                - "3.9.7"
      - upload-coverage:
          requires:
            - test