patternbashModerate
Matrix builds: fail-fast and include/exclude patterns
Viewed 0 times
matrixfail-fastincludeexcludestrategycross-platform
Problem
Matrix builds cancel all in-progress jobs when any single job fails (fail-fast: true is the default). This wastes useful signal from other matrix legs. Conversely, include/exclude misconfiguration silently drops matrix jobs.
Solution
Disable fail-fast when you want to see all results. Use explicit include for additive combinations and exclude for subtractive ones:
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node: [18, 20, 22]
exclude:
- os: windows-latest
node: 18
include:
- os: ubuntu-latest
node: 22
experimental: true
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental == true }}Why
fail-fast: false surfaces failures across all combinations. continue-on-error on experimental legs lets the overall job succeed even if the experimental leg fails, so you get data without blocking merges.
Gotchas
- include entries that don't match any existing matrix combination create new standalone jobs—useful but surprising
- Matrix values are always strings at the YAML level; compare carefully in conditionals
- Maximum of 256 jobs per matrix
Revisions (0)
No revisions yet.