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:
- The software selection is much smaller, not what’s standard on GitHub Actions, and that can break things.
- The system is older. In fact, actions/checkout complains that Git is too old, so there are problems with downloading repositories.
- Setting up the container takes up more time in the build.
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: