Best way to publish opam package

No, this kind of failures can happen. We cannot guarantee that all the distributions ship the exact version or package you need for your opam package. In those cases (older/newer versions in a distribution repository or specific packages unavailable in a distribution) the CI will inevitably fail. That should not prevent a package from being merged

Can you elaborate on that? If you run on 4.08 then 4.05 does not matter and both dune-release as well as the OCaml compiler are unaware of the existence of 4.05. Is your code compatible with 4.08?

mmm, now I’m not sure anymore. I remember I saw the warnings

 ocamlc lib/.bogue.objs/byte/bogue__B_chain.{cmi,cmo,cmt}
File "lib/b_chain.ml", line 91, characters 27-45:
91 | let comp (x:int) (y:int) = Pervasives.compare x y;;
                            ^^^^^^^^^^^^^^^^^^
Alert deprecated: module Stdlib.Pervasives
Use Stdlib instead.

If you need to stay compatible with OCaml < 4.07, you can use the 
stdlib-shims library: https://github.com/ocaml/stdlib-shims

and I thought this was causing dune to stop. Actually it was probably a problem between Bytes/String (that I have now corrected). The code compiled with 4.05, but not with 4.08 due to this.

My point was: assume I have a code which compiles with 4.05 but not with 4.08, and I’m fine with this because let’s say I only target ubuntu 18. I want to use dune-release to publish my package. Problem: dune-release doesn’t work with 4.05. So I install 4.08 and run dune-release. But, it seems that dune-release cannot publish the package without compiling it, and then it stops because the code does not compile with 4.08.

I don’t know if I’m clear enough :wink:

You can just add stdlib-shims in your dune (libraries ...) stanza, and replace all calls for Pervasives to Stdlib.

It can be frustrating to fight against upgrades when you just want to release something. Sorry about the experience you’re having right now. There are two problems you’re hitting:

  • dune-release works on OCaml >= 4.06 only.
  • your codebase is not compatible with OCaml 4.08

Fortunately, it’s possible to fix this step by step. You can install a 4.07.1 switch, in the same way you installed a 4.08.0 one. This compiler version should be compatible with both dune-release and your package, making it possible to release it without any errors.

Then, if you want to support OCaml >= 4.08, say, in a future release, you can install stdlib-shims or another solution and make sure it builds on 4.08. But that’s not strictly required for releasing it.

Hope that helps!

the package is published! thanks everyone for the help.