version: 2

jobs:
  build_and_test:
    docker:
      - image: circleci/python:2.7
      - image: rabbitmq:3

    working_directory: ~/repo

    steps:
      - checkout
      - restore_cache:
          key: v1-dependency-cache-{{ checksum "requirements.txt" }}
      - run:
          name: Install dependencies
          command: |
            git clone -b master git@github.com:stackstorm-exchange/ci.git ~/ci
            sudo pip install tox
            ~/ci/.circle/dependencies
      - run:
          name: Compile
          command: python setup.py install
      - save_cache:
          key: v1-dependency-cache-{{ checksum "requirements.txt" }}
          paths:
            - ~/.cache/pip
            - ~/.apt-cache
      - run:
          name: Test
          command: |
            tox
            .circle/test_creating_pack

workflows:
  version: 2
  build_test:
    jobs:
      - build_and_test

version: 2

jobs:
  build_and_test:
    docker:
      - image: circleci/python:2.7
      - image: rabbitmq:3

    working_directory: ~/repo

    steps:
      - checkout
      - restore_cache:
          key: v1-dependency-cache-{{ checksum "requirements.txt" }}
      - run:
          name: Install dependencies
          command: |
            git clone -b master git@github.com:stackstorm-exchange/ci.git ~/ci
            sudo pip install tox
            ~/ci/.circle/dependencies
      - run:
          name: Compile
          command: sudo python setup.py install
      - save_cache:
          key: v1-dependency-cache-{{ checksum "requirements.txt" }}
          paths:
            - ~/.cache/pip
            - ~/.apt-cache
      - run:
          name: Test
          command: |
            tox
            .circle/test_creating_pack

workflows:
  version: 2
  build_test:
    jobs:
      - build_and_test

Use sudo to run setup
Use sudo to run setup
