guides/using-githubs-security-features-to-secure-your-use-of-github-actions)
    * [ Automatic token authentication  ](/en/actions/security-guides/automatic-token-authentication)

  * Creating actions 

    * [ About custom actions  ](/en/actions/creating-actions/about-custom-actions)
    * [ Create a Docker container action  ](/en/actions/creating-actions/creating-a-docker-container-action)
    * [ Create a JavaScript action  ](/en/actions/creating-actions/creating-a-javascript-action)
    * [ Create a composite action  ](/en/actions/creating-actions/creating-a-composite-action)
    * [ Metadata syntax  ](/en/actions/creating-actions/metadata-syntax-for-github-actions)
    * [ Dockerfile support  ](/en/actions/creating-actions/dockerfile-support-for-github-actions)
    * [ Set exit codes  ](/en/actions/creating-actions/setting-exit-codes-for-actions)
    * [ Publish in GitHub Marketplace  ](/en/actions/creating-actions/publishing-actions-in-github-marketplace)
    * [ Share from your private repository  ](/en/actions/creating-actions/sharing-actions-and-workflows-from-your-private-repository)
    * [ Share with your organization  ](/en/actions/creating-actions/sharing-actions-and-workflows-with-your-organization)
    * [ Release and maintain actions  ](/en/actions/creating-actions/releasing-and-maintaining-actions)
    * [ CLI setup action  ](/en/actions/creating-actions/developing-a-third-party-cli-action)

  * [ Guides for GitHub Actions  ](/en/actions/guides)

  * [ GitHub Actions ](/en/actions "GitHub Actions") / 
  * [ Using jobs ](/en/actions/using-jobs "Using jobs") / 
  * [ Matrices ](/en/actions/using-jobs/using-a-matrix-for-your-jobs "Matrices")

#  Using a matrix for your jobs

Create a matrix to define variations for each job.

##  In this article

  * About matrix strategies 
  * Using a matrix strategy 
  * Expanding or adding matrix configurations 
  * Excluding matrix configurations 
  * Handling failures 
  * Defining the maximum number of concurrent jobs 

##  About matrix strategies

A matrix strategy lets you use variables in a single job definition to
automatically create multiple job runs that are based on the combinations of
the variables. For example, you can use a matrix strategy to test your code in
multiple versions of a language or on multiple operating systems.

##  Using a matrix strategy

Use ` jobs.<job_id>.strategy.matrix ` to define a matrix of different job
configurations. Within your matrix, define one or more variables followed by
an array of values. For example, the following matrix has a variable called `
version ` with the value ` [10, 12, 14] ` and a variable called ` os ` with
the value ` [ubuntu-latest, windows-latest] ` :

    
    
    jobs:
      example_matrix:
        strategy:
          matrix:
            version: [10, 12, 14]
            os: [ubuntu-latest, windows-latest]
    

A job will run for each possible combination of the variables. In this
example, the workflow will run six jobs, one for each combination of the ` os
` and ` version ` variables.

By default, GitHub will maximize the number of jobs run in parallel depending
on runner availability. The order of the variables in the matrix determines
the order in which the jobs are created. The first variable you define will be
the first job that is created in your workflow run. For example, the above
matrix will create the jobs in the following order:

  * ` {version: 10, os: ubuntu-latest} `
  * ` {version: 10, os: windows-latest} `
  * ` {version: 12, os: ubuntu-latest} `
  * ` {version: 12, os: windows-latest} `
  * ` {version: 14, os: ubuntu-latest} `
  * ` {version: 14, os: windows-latest} `

A matrix will generate a maximum of 256 jobs per workflow run. This limit
applies to both GitHub-hosted and self-hosted runners.

The variables that you define become properties in the ` matrix ` context, and
you can reference the property in other areas of your workflow file. In this
example, you can use ` matrix.version ` an