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”.
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 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)
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 https://github.com/fangyi-zhou/actions-ocaml, 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.
Because Travis CI is dying (or walking dead already) I opened an issue in ocaml-ci-scripts to drop its support and switch or just mention these GitHub Actions instead: #353.
I would also recommend setting up dependabot to check the versions of the GitHub actions you are using.
Something like this will check you are using the latest version of each action within the build OCaml CI:
Dependabot supports GitHub Actions, but that support is pretty fragile. In general, if you are using the major version style (e.g. @v1, @v2), they should prioritize the major version style, but it will force you to change to the semver style (e.g. v1.0.0, v2.0.0) even if you are using the major version style.
It’s not good in setup-ocaml as described in the documentation: GitHub - avsm/setup-ocaml: GitHub Action for the OCaml programming language
This is great work. I was wondering whether there are any plans to support even more output of the sophisticated GitHub actions – a brief look into what Coq projects are doing (e.g. fiat) displaying comments and warnings from the compiler – something like that (including eventually “ocamlformat”) would be amazing. I’ve no clue what is involved / how to set this up, but eventually someone else is already deep in GitHub actions yaml / json land and could provide some recipes?
If you are using dune, you should be able to use the matcher in the repository in the same way. Also, we can include them in setup-ocaml by default. (It has been planned for a long time and I’m planning to work on it once the review of setup-ocaml v2 is finished.)
that sounds great yes, I mainly use dune - is there an example on “able to use the matcher in the repository in the same way” (I’ve no clue what I need to do for this - likely edit something in .github/)?