kedder/openvario-shell

View on GitHub
.circleci/config.yml

Summary

Maintainability
Test Coverage
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: build-{{ checksum "Pipfile.lock" }}-{{ checksum ".cache-key" }}
      - run:
          name: Install dependencies
          command: |
            pip install pipenv coveralls[yaml]
            pipenv sync --dev --bare
      - save_cache:
          key: build-{{ checksum "Pipfile.lock" }}-{{ checksum ".cache-key" }}
          paths:
            - /home/circleci/.cache
      - run:
          name: Test
          command: |
             pipenv run pytest --junit-xml var/test-results/results.xml --cov=ovshell --cov=ovshell_core --cov=ovshell_xcsoar --cov=ovshell_fileman --cov=ovshell_connman --cov-report=term tests
             pipenv run black --check setup.py src tests
             pipenv run mypy src tests
             pipenv run isort --check-only setup.py src tests
      - store_test_results:
          path: var/test-results
      - run:
          name: Generate reports
          when: on_success
          environment:
            COVERALLS_PARALLEL: "true"
          command: |
            coveralls
  build-complete:
    executor:
      name: python/default
      tag: "3.8"
    steps:
      - run:
          name: Complete coveralls report
          command: |
            pip install coveralls[yaml]
            coveralls --finish

workflows:
  main:
    jobs:
      - build-and-test:
          matrix:
            parameters:
              python_ver: ["3.9", "3.10", "3.11"]
      - build-complete:
          requires:
            - build-and-test