version: 2

defaults: &defaults
  docker:
    - image: circleci/node:10-browsers
  environment:
    CHROME_BIN: /usr/bin/google-chrome
  working_directory: ~/vue-event-manager

jobs:
  build:
    <<: *defaults
    steps:
      - checkout
      - restore_cache:
          key: yarn-{{ checksum "yarn.lock" }}
      - run:
          name: Install Dependencies
          command: yarn --pure-lockfile
      - save_cache:
          key: yarn-{{ checksum "yarn.lock" }}
          paths:
            - ./node_modules
      - run:
          name: Run ESLint
          command: yarn eslint
      - run:
          name: Run Tests
          command: |
            yarn karma --browsers Chrome
      - run:
          name: Build Release
          command: yarn build