This is already driving me crazy! In my local environment I have the same version of dune (3.13.1), untracked files include only .vscode/ folder and some local .sh script. OCaml 4.14.1 in my local opam switch. Same version of ocamlformat (it’s version is in config file, so if it runs with different version - it will error out). I do exactly the same command
opam exec -- dune build --verbose @fmt as CI is doing and see wildly different behavior. In CI it did not produce any output at all, while in my environment
dune fmt was chaging a lot of source files and dune files. I tried messing up some .ml files and dune files and commit them to CI - now the pipeline fails, dune tries to format OCaml sources back, but completely ignores messed up dune files. I’m completely lost on the root cause for this. Sounds like different configuration is getting used for ocamlformat in CI then locally somehow. And why dune ignores dune files for formatting - no idea at all. Dune lang is set to 2.0, according to documentation this already includes formatting of OCaml sources and dune sources out of the box. I’ve tried to specify this behavior explicitly with
(formatting (enabled_for ocaml dune)) - changed nothing.
This is the CI run in question: Check source code formatting in CI · mransan/ocaml-protoc@ac03314 · GitHub