CICD-041 · Cap concurrent matrix jobs
Encyclopedia · Matrices and sharding · All snippets
Previous · CICD-040 · Next · CICD-042
1. Where it fits
- Placement .github/workflows/ci.yml, inside the relevant job.
- Prerequisites workspace whose runtime dependencies match the chosen target combinations.
- Platforms github-actions, gitea-actions.
2. Copy the snippet
yaml
strategy:
max-parallel: 2
matrix:
shard: [0, 1, 2, 3]3. How it works
max-parallel limits the number of rows running at one time for this job. Runner capacity can reduce concurrency even further.
4. Verify the result
Observe a maximum of two running rows per job strategy.
Validation syntax-validated (YAML parse). Status definitions.