Skip to content
Back to skills

Github Actions Matrix

ASecurity

Run test/config combos in parallel with matrix strategy.

  • 2 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added September 10, 2026
ai-agentspythonrustgobashnodegit

Works with

  • cli

Security analysis

A100/100

Scanned September 10, 2026

npx -y skills add LoopyLuci/Skills --skill github-actions-matrix --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Github Actions Matrix?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Github Actions Matrix
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/loopyluci-github-actions-matrix/badge)](https://www.skillsdirectory.com/skills/loopyluci-github-actions-matrix)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: github-actions-matrix
description: Run test/config combos in parallel with matrix strategy.
---

# GitHub Actions Matrix Builds

**Trigger**: Use when running tests across multiple OS, language versions, or configurations in parallel.

## Basic Matrix

```yaml
jobs:
  test:
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        node: [18, 20, 22]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node }}
      - run: npm test
```

This creates 3 × 3 = 9 parallel runners.

## Controlling the Matrix

### Include
```yaml
include:
  - os: macos
    node: 22         # Extra combo not in main grid
  - os: ubuntu
    node: 18
    coverage: true   # Extra variable
```

### Exclude
```yaml
exclude:
  - os: windows
    node: 22
  - os: macos
    node: 18
```

### Fail Fast & Concurrency
```yaml
strategy:
  fail-fast: false      # Continue other jobs even if one fails
  max-parallel: 4       # Max concurrent runners
  matrix: ...
```

## Real-World Examples

### Rust — Multiple Checks
```yaml
strategy:
  matrix:
    job:
      - {cmd: "cargo test", os: ubuntu-latest}
      - {cmd: "cargo clippy", os: ubuntu-latest}
      - {cmd: "cargo fmt --check", os: ubuntu-latest}
      - {cmd: "cargo test", os: macos-latest}
      - {cmd: "cargo test", os: windows-latest}
```

### Python — Versions + OS
```yaml
matrix:
  os: [ubuntu-latest, macos-latest]
  python: ['3.10', '3.11', '3.12']
  include:
    - os: windows-latest
      python: '3.12'
```

## Dynamic Matrix

```yaml
jobs:
  setup:
    runs-on: ubuntu-latest
    outputs:
      matrix: ${{ steps.m.outputs.matrix }}
    steps:
      - id: m
        run: |
          echo 'matrix={"os":["ubuntu","macos"],"node":["18","20"]}' >> $GITHUB_OUTPUT
  build:
    needs: setup
    strategy:
      matrix: ${{ fromJson(needs.setup.outputs.matrix) }}
```

## Pitfalls
- **Matrix explosion**: 4 OS × 5 versions × 3 configs = 60 runners — use `exclude` and `max-parallel`
- **Cost**: Each job is a separate runner minute
- **Cache per combo**: Each matrix combo gets its own cache key

## Verification
```bash
gh run view <run-id> --json jobs --jq '.jobs[].name'
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.