This is the announcement of the first alpha release of setup-ocaml v2. This includes quite a few changes, including reliable cache, as mentioned in a recent post.
There are so many changes, so I would like to list only the notable changes. (The full changelog can be found at the bottom of the post.)
This was changed because calling it “OCaml Version” is not appropriate enough, e.g. to use the new variant naming convention introduced from 4.12.
With the naughty exception of
4.02.2 , point releases are meant to be strictly compatible, so once OCaml dev team release a new point release, upgrading should be a no-brainer. With that in mind, it’s obviously not smart to rewrite every workflow every time a new point release is released, so you can now specify versions in the style like
The action supports not only the compiler cache, but also the dune cache. However, note that it is not available on the macOS runners until opam 2.0.9 is released. The dune cache is actually quite powerful for large projects, if you’re interested in it, check out the comparison section of ocaml/setup-ocaml#66. The reliable cache feature uses the @actions/cache package internally, and I worked with the GitHub team to make it fast enough for setup-ocaml to be up to 4x faster. For the Ubuntu runners, you can set up your environment with cache in about 30~40 seconds at the fastest.
For example, if you have a very large number of local packages, like the Irmin project, it can be quite a pain for a human to have to write a script to pin them all in your workflow. The action pins and depext the local packages if they exist in the repository by default. You can also use the glob pattern to select which local packages to handle, as described here.