name: Build
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v3
    - name: Setup OCaml
      uses: ocaml/setup-ocaml@v2
      with:
        ocaml-compiler: 5.0.0
    - name: Install dependencies
      run: opam install . --deps-only --with-test
    - name: Build
      run: opam exec -- dune build
    - name: Test
      run: opam exec -- dune runtest
    - name: Build documentation
      run: |
        sudo apt-get install -y texlive texlive-pictures texlive-latex-extra texlive-lang-french preview-latex-style
        eval $(opam env) && make -C docs website
        ls public
    - name: Deploy documentation
      uses: peaceiris/actions-gh-pages@v3
      with:
        github_token: ${{ secrets.GITHUB_TOKEN }}
        publish_dir: ./public
