Enjoy Brotli by default in GitHub-hosted Runners
2 Aug 2020 - Open Source, GitHub
In GitHub Actions, GitHub-hosted runners include the operating system’s default built-in tools among others. As part of one of my deployment workflows, I needed the brotli CLI. Unfortunately but it was not installed by default. Here is how it was added for future uses.
Having software tools already installed in GitHub-hosted runners have the following benefits:
- No code dedicated to download & install them;
- Actions are faster to execute;
- They are continuously updated by the GitHub engineers.
Only the most common tools are included, but sadly brotli was not part of the list. It is a generic-purpose lossless compression algorithm, usually performing better than gzip for web assets (HTML documents, JS scripts, etc.). It is also well supported by the major web browsers.
The definitions of the runners are open-source, so I was able to submit a PR to get brotli added. The team was really responsive, and the next day it was merged. Few days after the CLI was available to everybody.
Hopefully, other engineers will notice the addition and remove the code needed to use it. As the package is fetched from apt repositories, you might use a different version depending on the virtual environment you are currently using (Ubuntu 16.04, 18.04, or 20.04).
Notes to future me
I initially created an issue. The next day I was so convinced that I created a pull request. Retrospectively I think it would have been a better idea to wait for an approval from the Github team. Even if it is part of their work, they have spent time to review it, write some comments, etc.