From 2b6297c075242a4f95c82698772d80d4559d8e42 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Tue, 20 Jan 2026 20:49:24 -0500 Subject: [PATCH] CI: check format --- .github/workflows/format.yml | 28 ++++++++++++++++++++++++++++ .ocamlformat | 2 +- Makefile | 6 ++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/format.yml diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 0000000..acbf3d1 --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,28 @@ +name: format + +on: + push: + branches: + - main + pull_request: + +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 + diff --git a/.ocamlformat b/.ocamlformat index 7818345..f33f722 100644 --- a/.ocamlformat +++ b/.ocamlformat @@ -1,4 +1,4 @@ -version = 0.26.2 +version = 0.27.0 profile=conventional margin=80 if-then-else=k-r diff --git a/Makefile b/Makefile index f60c62e..e50a206 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,12 @@ test-autopromote: clean: @dune clean +format: + @dune build $(DUNE_OPTS) @fmt --auto-promote + +format-check: + @dune build $(DUNE_OPTS) @fmt --display=quiet + doc: @dune build @doc