version: 2

jobs:
  placeholder:
    docker:
      - image: circleci/node:8.11
    steps:
      - checkout

  build:
    docker:
      - image: circleci/node:8.11
    steps:
      - checkout
      - restore_cache:
          key: npm-deps-{{ checksum "yarn.lock" }}
      - run:
          command: yarn install
      - save_cache:
          key: npm-deps-{{ checksum "yarn.lock" }}
          paths:
            - node_modules

      - run:
          command: yarn test
      - run:
          command: yarn run storybook
      - run:
          command: yarn run build

      - persist_to_workspace:
          root: .
          paths:
            - storybook-static

  percy_upload:
    docker:
      - image: buildkite/puppeteer
    steps:
      - checkout
      - attach_workspace:
          at: .
      - run:
          command: |
            rm package.json yarn.lock
            npm install @percy/storybook
            node_modules/.bin/percy-storybook --widths=320,1280

workflows:
  version: 2
  main:
    jobs:
      - build
      - percy_upload:
          requires:
            - build
          filters:
            branches:
              ignore: master

version: 2.1

jobs:
  placeholder:
    docker:
      - image: circleci/node:8.11
    steps:
      - checkout

  build:
    docker:
      - image: circleci/node:8.11
    steps:
      - checkout
      - restore_cache:
          key: npm-deps-{{ checksum "yarn.lock" }}
      - run:
          command: yarn install
      - save_cache:
          key: npm-deps-{{ checksum "yarn.lock" }}
          paths:
            - node_modules

      - run:
          command: yarn test
      - run:
          command: yarn run storybook
      - run:
          command: yarn run build

      - persist_to_workspace:
          root: .
          paths:
            - storybook-static

  percy_upload:
    docker:
      - image: buildkite/puppeteer
    steps:
      - checkout
      - attach_workspace:
          at: .
      - run:
          command: |
            rm package.json yarn.lock
            npm install @percy/storybook
            node_modules/.bin/percy-storybook --widths=320,1280

workflows:
  version: 2
  main:
    jobs:
      - build
      - percy_upload:
          requires:
            - build
          filters:
            branches:
              ignore: master

Revert "Go back to version 2 in circle ci"
Revert "Go back to version 2 in circle ci"

This reverts commit 6609a1ed7e94955cf4c2797c96fc6971c3ea9946.
