GitHub Actions Day 4: Installing Tools

December 4, 2019

This is day 4 of my GitHub Actions Advent Calendar. If you want to see the whole list of tips as they're published, see the index.

I mentioned yesterday that GitHub Actions provides Linux, Windows and macOS virtual environments where you can run your workflows.

But what's actually installed on these environments? It turns out that there's a lot installed.

The team tries to keep our runners up-to-date with a number of different platforms. So you'll find a number of different versions of Python, Ruby, .NET Core and more. But - just by virtue of the wide variety of development tools out there - they can't have absolutely everything installed.

Sometimes you'll need to install it yourself. And since you get a whole virtual machine to yourself, for each job execution, you can install whatever you want on them.

For example, you might want to install the very fine "ninja" build tool.

Linux

The Linux virtual environments are running Ubuntu, so you can use apt to install whatever other tools you might need. By default, you're running as an unprivileged user, but there's passwordless sudo available. So you can:

run: sudo apt-get install ninja-build

Windows

Chocolatey is the package manager of choice for Windows, and it's installed and ready to use in the GitHub Actions virtual environments.

run: choco install ninja

macOS

On macOS, Homebrew is the recommended package manager, and it's available on the GitHub Actions virtual environments. There's no need to run Homebrew as root - in fact, that's frowned upon - so you can just brew install:

run: brew install ninja

All Together Now

To put this all together, if you wanted to install ninja on all three platforms, your workflow would look like this: