ocaml / setup-ocaml

GitHub Action for the OCaml programming language
https://ocaml.org/
MIT License
199 stars 39 forks source link

Suggestion: don't give up if installing optional dependencies fails #860

Closed nlsandler closed 1 month ago

nlsandler commented 2 months ago

Currently, if installing a dependency fails, including optional dependencies like darcs and mercurial, the entire action fails. It would be useful if the action continued instead of giving up after failing to install an optional dependency, so it can still be used in cases where, for whatever reason, these can't be installed.

For example, this action currently doesn't work on the Ubuntu 24.04 image because of https://github.com/actions/runner-images/issues/10476. Using this on the ubuntu-24.04 image results in:

  /usr/bin/sudo apt-get --yes install bubblewrap darcs g++-multilib gcc-multilib mercurial musl-tools rsync
  Reading package lists...
  Building dependency tree...
  Reading state information...
  Package darcs is not available, but is referred to by another package.
  This may mean that the package is missing, has been obsoleted, or
  is only available from another source

  E: Package 'darcs' has no installation candidate
Error: The process '/usr/bin/sudo' failed with exit code 100

The full logs of the failing job is here.

This is an issue with the Ubuntu image rather than the setup-ocaml action, but it would be nice if this action were better able to recover from this sort of issue.

shym commented 2 months ago

I ended up in exactly the same in a case where I need to use the 24.04 image to get more recent packages that I need to run my tests. I worked around the problem by using a simple script called sudo and prepended in $PATH to install only what is available. But beyond that use case, it could make sense to expose a key to tune the list of packages that should be installed, so that you could avoid installing optional packages, even when available, if you know you won’t need them (to save time, network, energy, etc.).