version: 2
jobs:
  build:
    docker:
      - image: python:3.4-jessie
    working_directory: ~/robot

    steps:
      - checkout

      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "requirements.txt" }}
          - v1-dependencies-{{ checksum "robotd/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
      - run: apt-get update -y
      - run: apt-get install -y libcv-dev libopencv-photo-dev libopencv-contrib-dev libusb-1.0.0-dev
      - run: pip3 install -r requirements.txt
      - run: pip3 install -r script/linting/requirements.txt
      - run: git clone git@github.com:sourcebots/sb-vision.git
      - run: cd sb-vision; pip3 install .
      - run: git clone git@github.com:sourcebots/robotd.git
      - run: cd robotd; pip3 install .
      - save_cache:
          paths:
            - ./venv
          key: v1-dependencies-{{ checksum "requirements.txt" }}

      - run:
          name: run tests
          command: python3 -m unittest

      - run: script/linting/lint

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

version: 2
jobs:
  build:
    docker:
      - image: python:3.4-jessie
    working_directory: ~/robot

    steps:
      - checkout

      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "requirements.txt" }}
          - v1-dependencies-{{ checksum "robotd/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
      - run: apt-get update -y
      - run: apt-get install -y libcv-dev libopencv-photo-dev libopencv-contrib-dev libusb-1.0.0-dev
      - run: pip3 install -r requirements.txt
      - run: pip3 install -r script/linting/requirements.txt
      - run: pip3 install git+https://github.com/sourcebots/sb-vision
      - run: pip3 install git+https://github.com/sourcebots/robotd
      - save_cache:
          paths:
            - ./venv
          key: v1-dependencies-{{ checksum "requirements.txt" }}

      - run:
          name: run tests
          command: python3 -m unittest

      - run: script/linting/lint

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

Clone and install `robotd` and `sb-vision` in 1 command
Clone and install `robotd` and `sb-vision` in 1 command
