name: CI

on:
  # Triggers the workflow on push or pull request events but only for the master branch
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v2

      - name: Set up OCaml
        uses: avsm/setup-ocaml@v1
        with:
          # Version of the OCaml compiler to initialise
          ocaml-version: 4.11.1
          
      - name: install dependencies
        run: opam install . --deps-only --with-doc --with-test
        
      - name: build
        run: |
          opam exec -- dune build @install @JS @main
          
      - name: runtest
        run: opam exec -- dune runtest

