GitHub Actions for OCaml / opam now available

I was in the GitHub Actions beta program and forward ported my code to the latest version that just went public. It’s a pretty simple way to get your OCaml code tested on Linux, macOS and Windows, without requiring an external CI service. The action attempts to provide a homogenous interface across all three operating systems, so invoking ‘opam’ from subsequent actions should “just work”.

You can find it here:

This should be considered fairly experimental as GH Actions is so new. If you do use it, then consider updating this issue with your usage. It does not current supporting caching yet, but is pretty fast to bootstrap (~4minutes).

It also doesn’t have any higher level purpose other than to set up an opam environment, since most of the additional functionality such as revdeps testing is planned for addition to the ocurrent DSL. Nevertheless, this GH feature will hopefully be useful for smaller projects without a lot of computational requirements. Let me know how it goes!

Windows is currently supported through @fdopen’s excellent fork that uses Cygwin. As Windows support is being mainlined into opam itself at the moment, I’m hoping that we will gradually move over to that. That should eventually remove the need for two separate opam-repositories, so I won’t be adding any features that are Linux or macOS-specific and do not work on the Cygwin version.


Thank you for publishing this. I’ve been able to migrate my smallish project entirely to github actions :slight_smile: While migrating to actions i’ve also been add a few things I didn’t have on travis (testing on mac + windows, testing formatting + creating automated PR)

1 Like

Glad to hear it! I’ll check out your improvements and see about folding them in :slight_smile:


Is it a substitute for Which one should be used by the new projects?

Thank you so much. The action and code you provide completely unblocked me.
I now have a nice CI for my little project.

1 Like

They’re still slightly orthogonal, as ocaml-ci-scripts cover many more Linux distributions via the Docker support. I’ve still not decided whether or not it makes sense to include Docker support into the GH Actions scripts or not.

I did the same thing a while ago, but didn’t have the windows support.
I was thinking about adding cache to the .opam directory to shorten the build time, but didn’t have time to look into the provided APIs. I think that’ll be a useful feature to have.