This demo shows how to scale a single job across many OS / runtime combinations without wasting runner minutes.
You’ll fork this repo, inspect the pre-built strategy.matrix workflow, then make a few edits to watch how fail-fast, continue-on-error, max-parallel, include, and exclude change the run behavior.
No local setup is required, the code only prints “OK.” You just need a GitHub account with Actions enabled.
-
Create your own copy
- Click Use this template → Create a new repository.
- Name it anything you like and leave it Public (Actions are free for public repos).
-
Open the workflow file
- Navigate to
.github/workflows/matrix.yml.
This is the only file you’ll edit.
- Navigate to
-
Observe the default matrix
- Two OSes (
ubuntu-latest,windows-latest). - Two Node versions (
18,20). - One extra “experimental” combo added under
include.
Goal: understand what will run before changing anything.
- Two OSes (
-
Run the workflow once
- Go to Actions → Matrix Mastery → Run workflow → Run workflow.
- You should see 5 jobs (4 regular + 1 experimental).
-
Watch the grid while it runs
- Only 2 jobs run at the same time (
max-parallel: 2). - The experimental job fails, but the workflow still passes (
continue-on-error).
- Only 2 jobs run at the same time (
-
Edit ① – Exclude a combo
- In
matrix.yml, find theexclude:section and add:exclude: - os: ubuntu-latest node: 20
- Commit the file.
You just removed the ubuntu + Node 20 permutation.
- In
-
Edit ② – Add a new axis value
- Still in
matrix.yml, changetoexperimental: [false]
experimental: [false, true]
- Commit.
This doubles the matrix by adding a second value to theexperimentalaxis.
- Still in
-
Edit ③ – Turn on fail-fast and force a real failure
- Set
fail-fast: truein thestrategysection. - At the top of your
steps:list, insert a temporary failing step:- name: Temporary failure run: exit 1 # intentional break
- Commit and run the workflow again.
Watch: one job fails immediately and the rest cancel, saving time.
- Set
-
Undo the temporary breakage
- Delete the
Temporary failurestep (or changeexit 1back toecho OK). - Commit so the workflow is green again.
- Delete the