GitHub Actions – Utilizing Matrix Workflows

When building applications, and certainly libraries that have to support a combination of runtime environments, the DevOps engineer needs to think about how they can effectively describe the process of building, testing, and releasing the target application across the span of configurations. Lets say that a library needs to be built in different runtime environments and across different SDKs, there are many situations in which you would want to run and test your application under different environments. In this post we shall take the example of a dotnet core application that needs to be tested on windows, linux, and osx. In addition to those operating system runtime environments, there are also SDK targets that you want to build and test your application on, dotnet 3.1.0, 3.0, and 3.1.403. Given we have 3 runtime operating systems and 3 SDK targets, the DevOps engineer would need to make 3 * 3 = 9 pipelines in order to support this when using traditional CI/CD pipelines. This would be quite laborious since semantically the pipelines are the same, the only differences lie in the pipeline configuration.

With GitHub Action Matrix Workflows, the pipeline can be written as one definition, but in such a way that the pipeline will expand to 9 logical pipelines which will run on each unique build / test configuration that has been set as a matrix.

An example pipeline may look like:

The resulting pipeline as code definition will instruction the GitHub Action pipeline agent to map and expand your matrix variables and run the pipeline as if it was its own definition.

Using workflows like GitHub actions matrices can open up a new potential to also instrument and benchmark your applications on a granular “per-configuration” level. You can test for regressions on older systems, or people who are solely interested in performance can run a matrix of tests that report the benchmarks of the applications across the different runtime environments. Needless to say that matrix pipelines have a host of applications and uses and the possibilities for CI/CD pipelines has been enriched because of this matrix experience.

If you would like to discuss this with more us contact me at or via my LinkedIn.