So what exactly is a runner and how do I know what’s in it? When you use GitHub Actions and specify:
jobs: build: name: Build runs-on: ubuntu-latest
What exactly does that mean ‘ubuntu-latest’? Well a runner is defined as ‘a virtual machine hosted by GitHub with the GitHub Actions runner application installed.’ Clear? LOL, basically it is a machine that has a target operating system (OS) as well as a set of software and/or tools you may desire for completing your job. GitHub provides a set of these pre-configured runners that you are using when you use the runs-on label and use any one of the combination of: windows-latest, ubuntu-latest (or ubuntu-18.04 or ubuntu-16.04), macosx-latest. As of this writing the matrix is documented here with also the specs of the virtual environment: Supported runners and hardware resources.
What is on a GitHub-hosted runner?
I personally think it is good practice to never assume the tool you want is on the environment you didn’t create and you should always acquire the SDK, tools, etc. you need. That’s just me and possibly being overly cautious especially when a definition of a hosted runner provides the tools you need. But it makes your workflow very explicit, perhaps portable to other runners, etc. Again, I just think it is good practice.
But you may want to know what exactly you can use on a GitHub-hosted runner when you specify it. Luckily GitHub publishes this in the documentation Software installed on GitHub-hosted runners. For example as a .NET developer you might be interested to know that the windows-latest runner has:
- Powershell Core
- Visual Studio 2019 Enterprise (as of this writing 16.4)
- .NET Core SDK 3.1.100 (and others)
This would be helpful to know that you could use choco install commands to get a new tool for your desired workflow you are trying to accomplish. What if you don’t see a tool/SDK that you think should be a part of the base image? You can request to add/update a tool on a virtual environment on their repo! Better yet, submit a repo if you can.
How much will it cost me to use GitHub-hosted runners?
Well, if you are a public repository, it’s free. If you are not a public repository your account gets a certain number of minutes per month for free before billing as well. It’s pretty generous and you can read all the details here: About billing for GitHub Actions. In your account settings under the Billing section you can see your usage. They don’t even bother to show your usage for public repositories because it’s free. I have one private repo that I’ve used 7 minutes on this month. My bill is $0 so far. The cool thing is you can setup spending limits there as well.
Can I run my own runner?
Yes! Similar to Azure Pipelines you can create and host your own self-hosted runner. The GitHub team did an amazing job with the steps here and it seriously couldn’t be simpler. Details about self-hosted runners (either on your local machine, your own cloud environment, etc.) can be found in About self-hosted runners documentation. Keep in mind that now the billing is on you and you should understand the security here as well because PRs and such may end up using these agents and the documentation talks all about this. But if you are needing to do this, the steps are dead simple and the page in your repo pretty much makes it fool proof for most cases:
It’s good to know what is on the environment you are using for your CI/CD and also cool to know you can bring your own and still use the same workflow. I’ve experimented with both and frankly like the GitHub-hosted model the best for my projects. They don’t have unique requirements and since they are all public repositories, no cost to me. Best of all that I don’t have to now manage an environment!
Please enjoy some of these other recent posts...