ocurrent / ocaml-ci

A CI for OCaml projects
https://ocaml.ci.dev
MIT License
112 stars 74 forks source link

lint-fmt fails on package using dune's "site" feature #871

Closed edwintorok closed 10 months ago

edwintorok commented 1 year ago

Context

lint-fmt fails in the OCaml CI when using dune's site feature in install stanzas.

Step(s) to reproduce

https://ocaml.ci.dev/github/edwintorok/lintcstubs/commit/8db4abc2ae1f8c579940a6a98940a41419a7aca0/variant/%28lint-fmt%29

Expected behaviour

lint-fmt in ocaml-ci should pass, it passes in setup-ocaml based action: https://github.com/edwintorok/lintcstubs/actions/runs/6157861712/job/16709496685

It should either detect and install the missing package before running the formatting command, or allow the user to manually override this with some x- field in opam.

Technical details

This is more a limitation of dune perhaps, it currently requires packages that are specified in install stanza as sites to be installed even for actions that wouldn't result in installing the package (such as @fmt). It may be desirable to fix this in dune, but meanwhile would be good to have some override for this in OCaml-CI.

Additional context

For setup-ocaml I worked this around by explicitly installing goblint beforehand: https://github.com/edwintorok/lintcstubs/blob/main/.github/workflows/workflow.yml#L54-L55

edwintorok commented 10 months ago

This has now been fixed in Dune upstream, although there is another instance of this where an .ml file gets generated and to do that you need build a local binary which has external dependencies. But that one can be fixed by running dune build @fmt --ignore-promoted-rules instead.

edwintorok commented 10 months ago

That last bug should be fixed by https://github.com/ocurrent/ocaml-ci/pull/909