version: 2
jobs:
  build:
    docker:
      - image: circleci/node:8.4.0
        environment:
          DATABASE_URL_TEST: postgres://test_user@localhost:5432/test_db
      - image: circleci/postgres:latest
        environment:
          POSTGRES_USER: test_user
          POSTGRES_DB: test_db
          POSTGRES_PASSWORD: ""

    working_directory: ~/repo

    steps:
      - checkout

      - restore_cache:
          keys:
          - v2-dependencies-{{ checksum "package.json" }}
          # fallback to using the latest cache if no exact match is found
          - v2-dependencies-

      - run: CFLAGS=-std=gnu11 yarn install

      - save_cache:
          paths:
            - node_modules
          key: v2-dependencies-{{ checksum "package.json" }}

      - run: yarn test
      - run: yarn run integration

version: 2
jobs:
  build:
    docker:
      - image: circleci/node:8.4.0
        environment:
          DATABASE_URL_TEST: postgres://test_user@localhost:5432/test_db
      - image: circleci/postgres:latest
        environment:
          POSTGRES_USER: test_user
          POSTGRES_DB: test_db
          POSTGRES_PASSWORD: ""

    working_directory: ~/repo

    steps:
      - checkout

      - restore_cache:
          keys:
          - v3-dependencies-{{ checksum "package.json" }}
          # fallback to using the latest cache if no exact match is found
          - v3-dependencies-

      - run: SAUCE_CONNECT_DOWNLOAD_ON_INSTALL=true CFLAGS=-std=gnu11 yarn install

      - save_cache:
          paths:
            - node_modules
          key: v3-dependencies-{{ checksum "package.json" }}

      - run: yarn test
      - run: yarn run integration

Install sauceconnect on install instead of on first run
CircleCI: Install sauceconnect on install instead of on first run
