GitHub Action to install Crystal and Shards: unified CI across Linux, macOS, *and Windows*

The common approach to test Crystal projects on GitHub Actions has been to use the official Docker image. However, that is limited to Linux and has side effects:

Instead, I bring to your attention the practice that’s more common for other programming languages: just install it into the main environment!

It works on Linux, macOS and Windows (even Shards has been made to work on Windows).
It is very convenient to use it with GitHub’s matrix config, so you don’t need to set up separate solutions depending on the OS. You can also put the version of Crystal (incl. nightly) into the test matrix.

Some examples:

14 Likes

This action implicitly switched over to Crystal 0.36 by default, as that’s the latest release now.

The GitHub action itself also got a nice update - now shards works on Windows without any additional steps.

By the way, if the Crystal release broke your projects by surprise, you could’ve been prepared for that by running CI with nightlies and also on schedule, e.g. as done here.

6 Likes