Skip to content

feat: Matrix sharding support (v1.3.0)#4

Merged
Desperado merged 1 commit into
mainfrom
feat/matrix-sharding
Apr 10, 2026
Merged

feat: Matrix sharding support (v1.3.0)#4
Desperado merged 1 commit into
mainfrom
feat/matrix-sharding

Conversation

@Desperado
Copy link
Copy Markdown
Contributor

Summary

Adds matrix sharding so large test suites can be split across parallel GitHub runners. Turns a 30-minute job into ~5 minutes with a simple matrix strategy.

Usage

```yaml
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
steps:
- uses: Quality-Max/qualitymax-github-action@v1
with:
api-key: ${{ secrets.QUALITYMAX_API_KEY }}
project-name: 'My Web App'
shard: ${{ matrix.shard }}
shards-total: 4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

Changes

  • action.yml — two new optional inputs (`shard`, `shards-total`)
  • src/types.ts — `shard` / `shardsTotal` on ActionInputs
  • src/index.ts
    • Parse inputs with validation (both must be positive ints, shard ≤ shardsTotal)
    • Append `--shard=N/M` to `npx playwright test` when sharding is active
    • Fix `totalTests` count — was using `scripts.length` (full suite) even for sharded runs. Now derived from actual parsed test results, so a shard running 25/100 tests reports 25, not 100.
    • Don't fabricate per-script result rows from exit code when sharded (we can't know which tests the shard actually ran without Playwright's JSON output)
  • README — new "Matrix Sharding" example, inputs table updated
  • Version — 1.2.1 → 1.3.0

Test plan

  • Merge, cut v1.3.0 tag, update `v1` floating tag
  • Trigger matrix workflow in qualitymax-demo-playground
  • Verify each shard reports its own slice correctly

🤖 Generated with Claude Code

Adds two new inputs, `shard` and `shards-total`, so large test suites
can be split across parallel GitHub runners using Playwright's native
--shard=N/M flag. Turns a 30-minute job into ~5 minutes with a simple
GitHub Actions matrix.

Example workflow:
    strategy:
      matrix:
        shard: [1, 2, 3, 4]
    steps:
      - uses: Quality-Max/qualitymax-github-action@v1
        with:
          shard: ${{ matrix.shard }}
          shards-total: 4

How it works:
- Each shard fetches the full suite from the QualityMax API
- Passes --shard=N/M to `npx playwright test`, which deterministically
  partitions the files
- Reports its own slice's pass/fail back as a separate execution

Internal changes:
- action.yml: two new optional inputs
- src/types.ts: shard/shardsTotal on ActionInputs
- src/index.ts:
  - Parse inputs with validation (both must be positive ints,
    shard <= shardsTotal, else warn and run full suite)
  - Append --shard=N/M to playwright args when sharding is active
  - totalTests now derived from actual parsed results (not scripts.length)
    so a shard running 25/100 tests reports 25, not 100
  - Don't fabricate per-script rows from exit code when sharded (we
    can't know which tests the shard ran without Playwright output)
- README: new "Matrix Sharding" example, inputs table updated
- Version: 1.2.1 → 1.3.0

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Desperado Desperado merged commit f4263b9 into main Apr 10, 2026
3 checks passed
@Desperado Desperado deleted the feat/matrix-sharding branch April 10, 2026 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant