version: 2
jobs:
  build:
    working_directory: ~/react-native-router-flux
    docker:
      - image: circleci/node:10
    steps:
      - checkout
      - restore_cache:
          key: dependency-cache-{{ checksum "package.json" }}
      - run:
          name: install-dependencies
          command: yarn install --frozen-lockfile
      - save_cache:
          key: dependency-cache-{{ checksum "package.json" }}
          paths:
            - ~/.cache/yarn
      - run:
          name: test
          command: yarn test
      - run:
          name: linter
          command: yarn lint
      - run:
          name: install-dependencies react-native example
          command: yarn install --frozen-lockfile
          working_directory: ~/react-native-router-flux/examples/react-native
      - run:
          name: test react-native example
          command: yarn test
          working_directory: ~/react-native-router-flux/examples/react-native
