ocaml-ci icon indicating copy to clipboard operation
ocaml-ci copied to clipboard

Question about best practices for depexts in test packages

Open mbarbin opened this issue 6 months ago • 3 comments

Hello and thanks for ocaml-ci. The following may be perhaps better addressed as a general opam question, I'm not sure.

I am testing a new repo on ocaml-ci vcs, the first ocaml-ci was today.

The tests are grouped into a package named volgo-tests - they depends on the hg cli. I don't recall using depexts configs before, I wonder what's best:

  1. Should I add a list of depexts to that package file .opam in the repo
  2. Is is best to create a conf package for this (I suppose conf-mercurial, or something like that?), and if so is it something that should live in the repo, or is there a practice by which opam user share config packages like that?

I could perhaps start with 1. to see if the ocaml-ci works. What could I do to test locally before pushing? I'm guessing this would look something like this:

depexts: [
  ["mercurial"] {os-distribution = "debian"}
  ["mercurial"] {os-distribution = "ubuntu"}
  ["mercurial"] {os-distribution = "fedora"}
  ["mercurial"] {os-distribution = "arch"}
  ["mercurial"] {os-distribution = "alpine"}
  ["mercurial"] {os-distribution = "centos"}
  ["mercurial"] {os = "macos"}
  ...
]

but I have no idea how to write this in idiomatic way, or to test the names of os-family and/or distribution that are going to be helpful.

Any pointers would be much appreciated, thanks a lot!

mbarbin avatar Jun 06 '25 12:06 mbarbin

I would add a conf package to opam-repository, perhaps conf-hg or conf-mercurial. There are plenty of examples in the repository. Perhaps conf-jq is a good starting point? Then you'd add the conf package to your depends. When you create a PR on opam-repository, it will be tested on multiple machines, so you'll get feedback on whether it works on the architectures you expect.

depends: [
...
  "conf-hg" {with-test}
]

mtelvers avatar Jun 06 '25 13:06 mtelvers

That's very helpful, thank you - wip adding a conf-hg package to opam-repository here.

Thanks a lot!

mbarbin avatar Jun 07 '25 10:06 mbarbin

Hi, I'm re-opening this issue as I am not able to make things work.

In this opam-repo pr there was an attempt to add the depexts configuration required for the Windows jobs of the CI.

Here is a run from the vcs ocaml-ci with this change pulled in.

I can see that the mercurial depext is correctly identified and installed, however the pipeline fails during the installation of the conf-hg package, build step with hg: command not found.

Would you be able to look into it ? I don't know what to try next. Thanks!

mbarbin avatar Jun 13 '25 14:06 mbarbin