name: CI

on:
  push:
    branches: ["main"]
  pull_request:
    branches: ["main"]

  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3

      - name: Setup OCaml compiler
        uses: ocaml/setup-ocaml@v2
        with:
          ocaml-compiler: 5.0.0

      - name: Menhir setup
        run: |
          opam install conf-python-3.1.0.0 menhir
          eval $(opam env)

      - name: Installing deps
        run: |
          opam install . --deps-only --with-doc
          opam install ppx_expect ppx_inline_test
        shell: bash

      - name: Testing
        run: |
          opam exec -- dune build
          opam exec -- dune runtest
