add CI for formatting

This commit is contained in:
Simon Cruanes 2026-02-15 16:30:20 -05:00
parent d8cdb2bcc2
commit a20233a455
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
2 changed files with 34 additions and 0 deletions

28
.github/workflows/format.yml vendored Normal file
View file

@ -0,0 +1,28 @@
name: format
on:
pull_request:
push:
branches:
- main
jobs:
format:
name: format
strategy:
matrix:
ocaml-compiler:
- '5.3'
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@main
- name: Use OCaml ${{ matrix.ocaml-compiler }}
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
dune-cache: true
allow-prerelease-opam: true
- run: opam install ocamlformat.0.27.0
- run: opam exec -- make format-check

View file

@ -14,6 +14,12 @@ test-autopromote:
doc: doc:
@dune build $(DUNE_OPTS) @doc @dune build $(DUNE_OPTS) @doc
format:
@dune build @fmt --auto-promote
format-check:
@dune build @fmt --ignore-promoted-rules
WATCH?= @install @runtest WATCH?= @install @runtest
watch: watch:
dune build $(DUNE_OPTS) -w $(WATCH) dune build $(DUNE_OPTS) -w $(WATCH)