name: Tests

on:
  - pull_request

jobs:
  build:
    strategy:
      fail-fast: false
      matrix:
        os:
          - macos-latest
          - ubuntu-latest
          - windows-latest
        ocaml-version:
          - 4.11.0
          - 4.10.1
          - 4.09.1
          - 4.08.1

    runs-on: ${{ matrix.os }}

    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Use OCaml ${{ matrix.ocaml-version }}
        uses: ocaml/setup-ocaml@v2
        with:
          ocaml-compiler: ${{ matrix.ocaml-version }}

      - run: opam pin add FrontC . --no-action
      - run: opam install FrontC --deps-only
      - run: opam exec -- dune build
      - run: opam exec -- dune runtest
