#
# Circle CI configuration. Runs each time we push a new commit to Github.
#
# This file is derived from the project's Dockerfile, which we use for
# local testing.
#
version: 2.1
jobs:
  build:
    docker:
      - image: returntocorp/ocaml:ubuntu

    working_directory: ~/ocaml-tree-sitter
    steps:
      - checkout
      - run:
          name: set up node
          command: ./scripts/setup-node
      - run:
          name: fetch submodules
          command: git submodule update --init --recursive --depth 1
      - run:
          name: configure
          command: ./configure
      - run:
          name: install dependencies
          command: opam exec -- make setup
      - run:
          name: check code formatting
          command: ./scripts/lint
      - run:
          name: build
          command: opam exec -- make
      - run:
          name: install
          command: opam exec -- make install
      - run:
          name: unit tests
          command: opam exec -- make unit
      - run:
          name: end-to-end tests
          command: opam exec -- make e2e

workflows:
  version: 2

  build-on-commit:
    # Default trigger, on commit.
    jobs:
      - build
