Build Matrix variations

Hello,

I was looking at the Build Matrix documentation and have a question on dimensions

So for example I have a step which I want to use matrix on which should run on Chrome, Firefox, Edge so the dimension will be browser. However I want to add also a version and each of the browser to use a different version. Is this possibile, with the adjustments part?

So pretty much I don’t want all the variantions based on the dimensions but I would like to have the step generate three times for each browser dimension value but each of those to run on separate version. So in the end there should be 3 steps generated.

Thanks

Hey @UnknownTester404

Thanks for getting in touch and using the community forums!

What you have described is possible to do with adjustments in the build matrix and here is an example of it, which would generate 9 Jobs in total:

steps:
  - label: "browser: {{matrix.browser}} - version: {{matrix.version}}"
    command: exit 0
    matrix:
      setup:
        browser:
          - firefox
          - chrome
          - edge
        version:
         - 1
         - 2
         - 3
      adjustments:
      # remove combination
      - with:
          browser: firefox
          version: 1
        skip: true
      # add combination
      - with:
          browser: firefox
          version: 4

But this is based on the browsers sharing common version(s) between them.

If the browsers do not share common version(s), or the amount of versions or adjustments required is significant; we would recommend having 3 separate Steps with individual build matrices for the different browsers and their versions. This is due to the limits of a build matrix:

Each build matrix has a limit of 6 dimensions, 20 elements in each dimension, and a total of 12 adjustments.

Hope that helps, but let us know!

Cheers,

Tom

Wouldn’t it be possibile to add in the adjustments the variantions and just use the skip?

So for example I have for os 1 2 3 4 but if I want to run firefox only with os 3 to add in the adjustments all the other three with skip key?

Thanks

Hey @UnknownTester404

Yes, it is possible to achieve this by using the adjustments with the skip key in your build matrix configuration. You can define all the possible variations for each dimension and then use the skip adjustment to exclude the combinations you don’t want to run.

In your example, if you want Firefox to only run with os: 3 and skip all other combinations, you can configure it like this:

steps:
  - label: "browser: {{matrix.browser}} - os: {{matrix.os}}"
    command: exit 0
    matrix:
      setup:
        browser:
          - firefox
          - chrome
          - edge
        os:
          - 1
          - 2
          - 3
          - 4
      adjustments:
        # Skip Firefox with OS 1, 2, and 4
        - with:
            browser: firefox
            os: 1
          skip: true
        - with:
            browser: firefox
            os: 2
          skip: true
        - with:
            browser: firefox
            os: 4
          skip: true

However, keep in mind the limits of the build matrix: each build matrix can have up to 6 dimensions, 20 elements per dimension, and a total of 12 adjustments.

Thank you,