From a20233a45532031c94f8e15f4e60665185662401 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Sun, 15 Feb 2026 16:30:20 -0500 Subject: [PATCH] add CI for formatting --- .github/workflows/format.yml | 28 ++++++++++++++++++++++++++++ Makefile | 6 ++++++ 2 files changed, 34 insertions(+) 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..29e9129 --- /dev/null +++ b/.github/workflows/format.yml @@ -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 + diff --git a/Makefile b/Makefile index 7c931c1..24aaba4 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,12 @@ test-autopromote: doc: @dune build $(DUNE_OPTS) @doc +format: + @dune build @fmt --auto-promote + +format-check: + @dune build @fmt --ignore-promoted-rules + WATCH?= @install @runtest watch: dune build $(DUNE_OPTS) -w $(WATCH)