Matrix is more than a Cartesian product
The matrix expands every combination of the listed dimensions, but you usually want to shape the result, not run the full product. Three controls:
include:— append specific cells (with extra fields) on top of the Cartesian product.exclude:— remove specific cells from the Cartesian product.fail-fast: false— keep all cells running even if one fails (default is true).
Patterns you'll reach for
- Add an experimental cell with a flag. Run Python 3.13 in addition to 3.10–3.12 with
continue-on-error: trueso it doesn't block PRs. - Skip combinations that don't apply. Postgres 16 + Python 3.10 may not be supported by your driver — exclude it.
- Inject extra config per cell. Different DB connection strings, different timeouts, different test markers.
- Dynamic matrix. Generate the matrix from a
jobs.outputsin a previous job (covered in the reuse track).
fail-fast tradeoff
fail-fast: true (default) cancels remaining cells the moment any cell fails. Saves minutes; loses information. fail-fast: false runs everything to completion. Pick true on PRs (fast feedback), false on main (full visibility).