GitHub Actions Tutorial — Matrix Builds

1 minute read

Chapter 9 — Matrix Builds

Matrix builds let you run the same job across multiple combinations of parameters — operating systems, language versions, dependency sets — in parallel. Instead of writing one job per combination, you define a matrix and GitHub Actions generates all the jobs for you.

A single 3-line matrix definition can spawn 12 parallel jobs, testing your code on every combination of OS and runtime version simultaneously.


What You’ll Learn

  • Defining matrix strategies with multiple dimensions
  • Adding and excluding specific combinations
  • Controlling failure behavior and parallelism
  • Generating matrices dynamically from JSON
  • Real-world matrix patterns for CI/CD

Topics Covered

1. Matrix Basics

Define multi-dimensional matrices and understand how combinations are generated.

Read: Matrix Basics →


2. Include & Exclude

Fine-tune your matrix by adding extra combinations or removing specific ones.

Read: Include & Exclude →


3. Fail-Fast & Parallel

Control whether matrix jobs cancel on first failure and limit concurrent runs.

Read: Fail-Fast & Parallel →


4. Dynamic Matrix

Generate matrix values at runtime using fromJSON() for flexible CI pipelines.

Read: Dynamic Matrix →


5. Matrix Patterns

Real-world patterns — cross-platform testing, version grids, and conditional matrix expansion.

Read: Matrix Patterns →


Practice

Test your understanding with hands-on exercises.

Practice Exercises →


← Previous: Chapter 8: Artifacts & Caching

Next: Chapter 10: Reusable Workflows →

Updated: