version: 2.1

commands:
  test-nodejs:
    steps:
      - run:
          name: Versions
          command: npm version
      - checkout
      - restore_cache:
          keys:
            - v{{ .Environment.CIRCLE_CACHE_VERSION }}-{{ arch }}-npm-cache-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }}
            - v{{ .Environment.CIRCLE_CACHE_VERSION }}-{{ arch }}-npm-cache-master-{{ .Environment.CIRCLE_JOB }}
      - run:
          name: Install dependencies
          command: npm ci
      - run:
          name: Test
          command: npm test
      - save-npm-cache
  save-npm-cache:
    steps:
      - save_cache:
          key: v{{ .Environment.CIRCLE_CACHE_VERSION }}-{{ arch }}-npm-cache-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "package-lock.json" }}
          paths:
            - ~/.npm/_cacache

jobs:
  node-v8:
    docker:
      - image: node:8
    steps:
      - test-nodejs
  node-v10:
    docker:
      - image: node:10
    steps:
      - test-nodejs
  node-v12:
    docker:
      - image: node:12
    steps:
      - test-nodejs

workflows:
  node-multi-build:
    jobs:
      - node-v8
      - node-v10
      - node-v12

version: 2.1

commands:
  test-nodejs:
    steps:
      - run:
          name: Versions
          command: npm version
      - checkout
      - restore_cache:
          keys:
            - v{{ .Environment.CIRCLE_CACHE_VERSION }}-{{ arch }}-npm-cache-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }}
            - v{{ .Environment.CIRCLE_CACHE_VERSION }}-{{ arch }}-npm-cache-master-{{ .Environment.CIRCLE_JOB }}
      - run:
          name: Install dependencies
          command: npm ci
      - run:
          name: Test
          command: npm test
      - save-npm-cache
  save-npm-cache:
    steps:
      - save_cache:
          key: v{{ .Environment.CIRCLE_CACHE_VERSION }}-{{ arch }}-npm-cache-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "package-lock.json" }}
          paths:
            - ~/.npm/_cacache

jobs:
  node-v8:
    docker:
      - image: node:8
    steps:
      - test-nodejs
  node-v10:
    docker:
      - image: node:10
    steps:
      - test-nodejs
  node-v12:
    docker:
      - image: node:12
    steps:
      - test-nodejs
  node-v14:
    docker:
      - image: node:14
    steps:
      - test-nodejs

workflows:
  node-multi-build:
    jobs:
      - node-v8
      - node-v10
      - node-v12
      - node-v14

Add Node v14 to CircleCI testing
Add Node v14 to CircleCI testing
