Parallel Jobs and Matrix Builds for Faster CI
Run checks concurrently and use build matrices to test many configurations without exploding your pipeline.
Netbay Infrastructure Team
Netbay Engineering
On this page
The simplest way to make a slow pipeline faster is to do more of it at once. Independent checks should run in parallel on separate runners, and when you support many combinations of runtime and operating system, a matrix turns one workflow definition into many executions. This post shows how to parallelize without making your pipeline harder to read or its failures harder to triage.
Parallel Jobs: The Easy Win
By default, separate jobs in a workflow run concurrently. If your lint and test jobs have no dependency, they already overlap. Explicitly expressing that intent with needs and a clear naming scheme keeps the workflow readable.
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm run lint
unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npm test -- --ci
build:
runs-on: ubuntu-latest
needs: [lint, unit]
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npm run buildHere lint and unit run side by side, and build waits for both. Total time is roughly the slower of lint and unit, plus the build — not their sum.
What Parallelizes Well
Parallelize stages that do not depend on each other's outputs. Common pairs:
- Unit tests split by module or directory — each job runs its slice.
- Lint and type-check jobs, both stateless and fast.
- Builds for different target platforms.
- Independent integration suites against separate fixtures.
Parallelize by *parts that can fail independently*, not just for the sake of it. If two jobs always pass together, a single job is simpler to read and debug.
Matrix Builds: One Definition, Many Runs
A matrix expands a single job template into several executions, one per combination in the strategy.matrix map. This is the idiomatic way to say "test on these three node versions" or "build for these two platforms" without writing each job by hand.
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: [18, 20, 22]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: npm
- run: npm ci
- run: npm testThis produces three concurrent jobs, each pinning a different Node major version. Because fail-fast: false, if one version fails, the others still run to completion — you see the full picture rather than a cancelled batch.
Keep the Matrix Productive
A matrix multiplies not just runs but cost and noise. Apply these guardrails:
- Limit the matrix to combinations users actually run. Testing Node 20 is usually enough; Node 18 and 22 are for real compatibility concerns.
- Use fail-fast: false so one failure does not hide the others.
- Fail the whole suite fast when findings are duplicates — fix one drift and re-run.
- Share expensive setup so the matrix does not repeat it per combo.
If every matrix cell does the same expensive work, the matrix stops being a win. Cache dependencies once per key, then each cell reuses it.
Cost and Runner Sizing
Parallelism trades wall-clock time for compute. Running four jobs in parallel costs roughly four runner-hours. That is a deliberate trade, not a free lunch. Where a single build dominates, split it rather than multiplying it; where many small checks exist, pack them onto one high-core runner to stay fast without extra runner instances.
On your own infrastructure you control this balance. A multi-core VPS can run several matrix cells concurrently on one machine, or you can spin up a few VPS to handle a heavy matrix in parallel.
Takeaway
Run independent jobs in parallel by default, gate dependent jobs with needs, and use a matrix to sweep supported versions and platforms from one definition. Keep matrices honest and let fail-fast: false show you the full failure picture.
Netbay VPS plans scale in cores and RAM, so you can size runners to your matrix — provision one in seconds at netbayhosts.in.
Keep reading
Follow along on a real VPS
Deploy Linux in under 60 seconds
These guides are written against Ubuntu, Debian, and RHEL-family images — the same ones on NetBay.
Deploy an instance