workflows:
  version: 2
  node-multi-build:
    jobs:
      - node-v6
      - node-v8
      - node-v10

version: 2
jobs:
  node-base: &node-base
    docker:
      - image: node
    steps:
      - checkout
      - restore_cache:
          name: Restore Yarn Package Cache
          keys:
            - yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }}
            - yarn-packages-{{ .Branch }}
            - yarn-packages-master
            - yarn-packages-
      - run:
          name: Install dependencies
          command: yarn --frozen-lockfile
      - run:
          name: Test
          command: yarn test-ci
      - save_cache:
          name: Save Yarn Package Cache
          key: yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }}
          paths:
            - node_modules/
  node-v6:
    <<: *node-base
    docker:
      - image: node:6
  node-v8:
    <<: *node-base
    docker:
      - image: node:8
  node-v10:
    <<: *node-base
    docker:
      - image: node:10
