How to Build a Matrix Across Different Runner Types
Put runner labels in strategy.matrix and set runs-on to the matrix value to fan one job out across several runner types at once.
A matrix keyed on the runner lets you cover OS, architecture, and size combinations without duplicating the job. Use include to attach per-runner settings and exclude to drop combinations you do not need.
Matrix over runner labels
.github/workflows/ci.yml
jobs:
test:
strategy:
fail-fast: false
matrix:
runner: [ubuntu-latest, ubuntu-24.04-arm, windows-latest]
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- run: npm ci && npm testAttach size per leg with include
.github/workflows/ci.yml
strategy:
matrix:
include:
- runner: ubuntu-latest
suite: unit
- runner: ubuntu-latest-8-cores
suite: e2eWatch the cost
Every matrix leg bills at its runner rate, and a macOS or 8-core leg costs a multiple of a standard Linux leg. Keep the matrix as small as the coverage you actually need.
Related guides
How to Account for macOS and Windows Runner Cost MultipliersUnderstand why GitHub bills macOS and Windows runner minutes at a multiple of Linux, and choose the cheapest…
How to Choose Between ARM and x86 CI RunnersChoose ARM64 or x86-64 GitHub runners based on your deployment target and cost, and learn how to run both in…