version: 2

defaults: &defaults
  working_directory: ~/ledger-live-desktop
  docker:
    - image: circleci/node:8.11.3-stretch-browsers

jobs:
  build:
    <<: *defaults
    steps:
      - run: sudo apt-get install -y libudev-dev
      - checkout
      - restore_cache:
          keys:
            - v7-yarn-packages-{{ checksum "yarn.lock" }}
      - run: yarn install
      - save_cache:
          key: v7-yarn-packages-{{ checksum "yarn.lock" }}
          paths:
            - node_modules
      - run: yarn lint
      - run: ./node_modules/.bin/prettier -l "{src,webpack,.storybook,static/i18n}/**/*.js"
      - run: yarn flow --quiet
      - run: yarn test
      - run: yarn release