version: 2.1
executors:
  my-executor:
    docker:
      - image: smokserwis/build:python3
orbs:
  code-climate: travelaudience/code-climate@0.1.5
commands:
  setup_python:
    description: Set up requirements
    steps:
      - run:
          command: |
            pip install -r requirements.txt
            pip install -U pytest-xdist pytest-cov pytest pytest-forked pluggy py
            pip install .
  unit_test:
    description: Run the unit tests
    steps:
      - run: pytest -n 8 -vv --cov=satella
jobs:
  test:
    executor: my-executor
    steps:
      - checkout
      - code-climate/install
      - setup_python
      - unit_test
      - run:
          name: Collect results
          command:
            coverage xml
      - code-climate/format_coverage:
          input_type: coverage.py
          coverage_file: coverage.xml
      - code-climate/upload_coverage
workflows:
  unit_test:
    jobs:
      - test