Skip to main content
InterviewHubPRO
Section Overview
Q13

Question 13 of 50

Part 2: Advanced Workflows, Security & Containerization (Mid-Level)

26%
CI/CD & GitHub Actions (50 Qs)•Part 2: Advanced Workflows, Security & Containerization (Mid-Level)

How do Matrix Builds work and how do you customize them?

mid LevelCode ExampleSecurity & AuthDocker & Containers

In Simple Words: A matrix strategy spawns multiple jobs in parallel across combinations of operating systems, language versions, and environments.

yaml
jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false # Do not abort other matrix jobs if one fails
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        node-version: [18, 20, 22]
        exclude:
          - os: windows-latest
            node-version: 18 # Exclude unsupported combo
        include:
          - os: ubuntu-latest
            node-version: 22
            experimental: true # Add custom variable
    steps:
      - uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node-version }}