Recipes / Event-driven

Test matrix

Fan one test command across N shards via the `matrix-fanout` run — Workflows `createBatch` spawns the children, scale-to-zero between runs.

Fires on Every PR push — wire it any of these ways:

  • Action recommended A ci.yml step dispatches the run — when it must interleave with other CI jobs or gate the PR.
  • Webhook pattern The GitHub App webhook fires the run directly — no .github/workflows file, no GHA minutes. (needs command + shards from config)
Use case
Same command fanned out across N shards
FlareDispatch shape
1 typed run + dispatch
Plain GHA shape
1 workflow · matrix + aggregate job

Source

The recommended FlareDispatch shape is shown first. Toggle to Without FlareDispatch to see the full GitHub Actions workflow a team would maintain to do the same job without it.

Action mode — triggered by a GitHub Actions workflow that calls the shipped run.
recipes/test-matrix/ci.yml
# Recipe: sharded test matrix on Cloudflare
#
# Use case: a unit/integration suite that is fast per-shard but long in total.
# Offload it to the shipped `matrix-fanout` run, which spawns N child
# Workflows (one container per shard) and reports a single parent check-run
# that is green only if every shard passes.
#
# Mode: Action mode, fire-and-forget. See specs/04-gha-integration.md.
# Run:  matrix-fanout — see specs/02-runs.md#2-matrix-fanout.

name: test-matrix
on:
  pull_request:

jobs:
  test-matrix:
    runs-on: ubuntu-latest
    steps:
      - uses: openhackersclub/flare-dispatch-action@v1
        with:
          run: matrix-fanout
          endpoint: ${{ vars.FLAREDISPATCH_ENDPOINT }}
          hmac-secret: ${{ secrets.FLAREDISPATCH_HMAC }}
          inputs: |
            {
              "repo": "${{ github.repository }}",
              "sha": "${{ github.sha }}",
              "command": "pnpm test --shard $SHARD_INDEX/$SHARD_TOTAL",
              "shards": 8,
              "failureBehavior": "wait-all"
            }

# Each shard receives SHARD_INDEX / SHARD_TOTAL in its environment.
# Require the check-run `flare-dispatch/matrix-fanout` in branch protection.