What is a matrix job?
Matrix jobs provide a way to run a job multiple times with different arguments. Arguments are supplied using parameters.
Prerequisites
In order to be able to utilize matrix jobs, you will need to have a version:
2.1
.circleci/config.yml
file and use parameterized jobs.
Setting up matrix jobs
You can create matrix jobs by adding the matrix
key and the arguments as parameters to your workflow in your config.yml file:
workflows:
workflow:
jobs:
- build:
matrix:
parameters:
version:["0.1","0.2","0.3"]
platform:["macos","windows","linux"]
This will run the parameterized job with every combination of the arguments, equivalent to the following:
workflows:
workflow:
jobs:
- build:
name: build-macos-0.1
version: 0.1
platform: macos
- build:
name: build-macos-0.2
version: 0.2
platform: macos
- build:
name: build-macos-0.3
version: 0.3
platform: macos
- build:
name: build-windows-0.1
version: 0.1
platform: windows
- ...
Additional Resources
Comments
Article is closed for comments.