version: 2
jobs:
  build:
    docker:
      - image: circleci/node:10
    steps:
      - checkout
      - restore_cache:
          name: Restore Yarn Package Cache
          keys:
            - yarn-packages-{{ checksum "yarn.lock" }}
      - run:
          name: Install Dependencies
          command: yarn install
      - save_cache:
          name: Save Yarn Package Cache
          key: yarn-packages-{{ checksum "yarn.lock" }}
          paths:
            - ~/.cache/yarn
      - run: # run tests
          name: Run Test and Coverage
          command: yarn test:build
      - run: # install now
          name: Install Now.sh
          command: sudo npm i -g now
      - run: # deploy Now.sh
          name: Deploy Now.sh
          command: now -t ${NOW_TOKEN} --public
      - run: # merge domain Now.sh
          name: Merge Domain Now.sh
          command: now -t ${NOW_TOKEN} alias key46
