Opam CI failing due to unused dependency

I am trying to submit a new version of the decimal library to the opam-repository, but some of the builds are failing, e.g.: https://opam.ci.ocaml.org/github/ocaml/opam-repository/commit/6022c86c0e6a3f457613a41806a53521c63ed700/variant/compilers,4.08,ppx_decimal.1.0.0,tests

#=== ERROR while compiling ppx_decimal.1.0.0 ==================================#
# context              2.2.0~alpha2~dev | linux/x86_64 | ocaml-base-compiler.4.08.1 | pinned(https://github.com/yawaramin/ocaml-decimal/releases/download/v1.0.0/decimal-1.0.0.tbz)
# path                 ~/.opam/4.08/.opam-switch/build/ppx_decimal.1.0.0
# command              ~/.opam/opam-init/hooks/sandbox.sh build dune build -p ppx_decimal -j 127 @install @runtest
# exit-code            1
# env-file             ~/.opam/log/ppx_decimal-7-957229.env
# output-file          ~/.opam/log/ppx_decimal-7-957229.out
### output ###
# File "test/dune", line 5, characters 21-29:
# 5 |  (libraries alcotest angstrom decimal))
#                          ^^^^^^^^
# Error: Library "angstrom" not found.
# -> required by _build/default/test/decimal_test.exe
# -> required by alias test/runtest in test/dune:2

But the angstrom library is specified as a test dep for the decimal package: https://github.com/yawaramin/ocaml-decimal/blob/46c02f6c5f600ac2887a745424826689d488369d/dune-project#L30

(package
 (name decimal)
  ...
 (depends
  (alcotest
   (and
    (>= 1.5.0)
    (< 2.0.0)
    :with-test))
  (angstrom
   (and
    (>= 0.15.0)
    (< 1.0.0)
    :with-test))...

It’s not specified as a dep of the ppx_decimal package because it’s not used there. I suppose technically, it’s not used by the decimal package either, only by the test dune component. But how do I tell dune that the test component belongs under the decimal package, so that it shouldn’t try to run it for the ppx_decimal package?

By specifying (package decimal) in your test stanza. Sent a PR: Fix test failure on ppx_decimal by anmonteiro · Pull Request #11 · yawaramin/ocaml-decimal · GitHub

1 Like