version: 2.1 # use CircleCI 2.1
orbs:
  coveralls: coveralls/coveralls@1.0.6
jobs: # a collection of steps
  build: # runs not using Workflows must have a `build` job as entry point
    working_directory: ~/kass-ci # directory where steps will run
    docker: # run the steps with Docker
      - image: circleci/node:14.15.3 # ...with this image as the primary container; this is where all `steps` will run
    steps: # a collection of executable commands
      - checkout # special step to check out source code to working directory
      - restore_cache: # restore the dependency cache
          # Read about caching dependencies: https://circleci.com/docs/2.0/caching/
          name: Restore Yarn Package Cache
          key: yarn-packages-{{ checksum "yarn.lock" }}
      - run:
          name: yarn install
          command: yarn install --frozen-lockfile
      - save_cache: # special step to save the dependency cache
          name: Save Yarn Package Cache
          key: yarn-packages-{{ checksum "yarn.lock" }}
          paths:
            - ./node_modules
      - run: # Build
          name: Build
          command: yarn build
      - run: # Formatting
          name: Prettier
          command: yarn format
      - run: # Linting
          name: ESLint
          command: yarn lint
      #   - restore_cache: # restore the Hardhat Network Fork Cache
      #       name: Restore Hardhat Network Fork Cache
      #       key: v11-hardhat-network-fork-cache
      - run: # Coverage
          name: solidity-coverage
          command: yarn hardhat coverage
      #   - save_cache: # special step to save the Hardhat Network Fork cache
      #       name: Save Hardhat Network Fork Cache
      #       key: v11-hardhat-network-fork-cache
      #       paths:
      #         - ./cache/hardhat-network-fork
      - coveralls/upload # upload lcov.info to coveralls.io
    #   - store_artifacts: # for display in Artifacts: https://circleci.com/docs/2.0/artifacts/
    #       path: coverage
    #       prefix: coverage
    # See https://circleci.com/docs/2.0/deployment-integrations/ for deploy examples
