version: 2
jobs:
  build:
    docker:
      - image: mikeastock/rust:0.3
        environment:
          - DATABASE_URL=postgres://localhost/mob_test
      - image: circleci/postgres:9.6
        environment:
          - POSTGRES_USER=root
          - POSTGRES_DB=mob_test
    working_directory: /mob
    steps:
      - checkout
      - restore_cache:
          key: warehouse-v1-{{ checksum "Cargo.lock" }}
      - run:
          name: Install Diesel CLI
          command: |
            if ! type diesel > /dev/null; then
              cargo install diesel_cli --no-default-features --features postgres
            fi
      - run:
          name: Setup Database
          command: diesel setup
      - run:
          name: Build
          command: cargo build --all
      - run:
          name: Run Tests
          command: RUST_TEST_THREADS=1 cargo test -all
      - save_cache:
          key: mob-v1-{{ checksum "Cargo.lock" }}
          paths:
            - ~/.cargo

version: 2
jobs:
  build:
    docker:
      - image: mikeastock/rust:nightly
        environment:
          - DATABASE_URL=postgres://localhost/mob_test
      - image: circleci/postgres:9.6
        environment:
          - POSTGRES_USER=root
          - POSTGRES_DB=mob_test
    working_directory: /mob
    steps:
      - checkout
      - restore_cache:
          key: warehouse-v1-{{ checksum "Cargo.lock" }}
      - run:
          name: Install Diesel CLI
          command: |
            if ! type diesel > /dev/null; then
              cargo install diesel_cli --no-default-features --features postgres
            fi
      - run:
          name: Setup Database
          command: diesel setup
      - run:
          name: Build
          command: cargo build --all
      - run:
          name: Run Tests
          command: RUST_TEST_THREADS=1 cargo test -all
      - save_cache:
          key: mob-v1-{{ checksum "Cargo.lock" }}
          paths:
            - ~/.cargo

Use Rust nightly on Circle
chore: Use Rust nightly on Circle
