Skip to content

[SOFT-4410] Add wp-test-matrix: the newest WordPress releases for a test matrix - #42

Open
sdokus wants to merge 1 commit into
mainfrom
soft-4410-wp-version-matrix
Open

sdokus wants to merge 1 commit into
mainfrom
soft-4410-wp-version-matrix

Conversation

@sdokus

@sdokus sdokus commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Related

Part of SOFT-4410, under SOFT-4409. Also part of SOFT-4411, SOFT-4412, SOFT-4413, SOFT-4414 and SOFT-4415.

Summary

Adds wp-test-matrix, an action that lists the newest WordPress X.Y releases, each at its latest patch, as a JSON array for a test workflow's strategy.matrix. With the default count of 3 that is ["7.1.5","7.0.9","6.9.12"] today. Each version goes to setup-slic's existing wp-version input, so the suites run once per release.

Why

Plugin test workflows usually pin one WordPress version (wp core update --force --version=6.8), so a break in a new WordPress release shows up in support before it shows up in CI. Testing against the latest few releases catches it first. The version lookup is the same for every plugin, so it lives here for any brand to use.

Change

  • wp-test-matrix: asks api.wordpress.org/core/version-check/1.7/, keeps the highest patch of each X.Y, skips betas and RCs, and returns the newest count releases. It runs on github-script like the other toolbox actions, so there's nothing to build.
  • How it behaves:
    • It groups by X.Y and keeps the highest patch, so duplicates or a different order in the answer change nothing.
    • Three attempts with a 10s timeout each. Fewer releases offered than asked for fails the step instead of quietly shrinking the matrix.
    • The README example gives the job permissions: {}, since it needs no token.
    • Consumers pin @v1, not @main.
    • The README shows a count expression for workflows that only want the full matrix on some runs (for example, only on PRs into main). The default is 3 on every run.
  • test.yml gets a wp-test-matrix job that runs the action against the real endpoint and fans a matrix out from its output, so a change in WordPress.org's answer fails here first.
  • README: the action is listed under composite actions, in the Slic section, and ticked in Phase 2.

Using it

jobs:
  wp-versions:
    runs-on: ubuntu-latest
    permissions: {}
    outputs:
      versions: ${{ steps.matrix.outputs.versions }}
    steps:
      - id: matrix
        uses: stellarwp/plugin-toolbox/.github/actions/wp-test-matrix@v1

  test:
    needs: wp-versions
    name: ${{ matrix.suite }} (WP ${{ matrix.wp }})
    strategy:
      fail-fast: false
      matrix:
        suite: [unit, wpunit]
        wp: ${{ fromJSON(needs.wp-versions.outputs.versions) }}
    # setup-slic: wp-version: ${{ matrix.wp }}

Testing

  • node --test: all tests pass, 14 of them new in tests/actions/wp-test-matrix/. They cover the count input, duplicates, order, 7.10 above 7.9, betas and RCs, retries, and failing when too few releases come back.
  • actionlint 1.7.12 with the flags test.yml uses: clean.
  • Ran the action locally against the live endpoint: ["7.1.5","7.0.9","6.9.12"].
  • The wp-test-matrix jobs on this PR run it on a real runner and fan out one job per version.

Summary by CodeRabbit

  • New Features
    • Added a WordPress test matrix action that selects the newest eligible releases and outputs them as a JSON list. You can set how many versions to include.
    • Added workflow support for running tests across the selected WordPress versions.
  • Documentation
    • Added guidance on configuring and using the WordPress test matrix in workflows.

…T-4410]

- Why: plugin test workflows pin one WordPress version, so a regression in a
  new WordPress release reaches support before CI. The six TEC repo PRs for
  SOFT-4410 to SOFT-4415 each wired the same lookup in by hand.
- What: a github-script action that lists the newest X.Y releases from the
  WordPress.org version check, each at its latest patch, as a JSON array for
  strategy.matrix. count picks how many (default 3); fewer offered fails.
  Unit tests, a live job in test.yml, README entries.
- Impact: any plugin feeds the output into its matrix and passes each
  version to setup-slic's wp-version; new WordPress releases rotate in
  without editing a workflow.
@linear

linear Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

@coderabbitai

coderabbitai Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The new composite action selects recent WordPress releases and exposes them as a JSON output. A workflow uses that output as a matrix and validates each version. Documentation and tests cover the action and its integration.

Changes: WordPress test matrix

Layer / File(s) Summary
Action contract and version selection
.github/actions/wp-test-matrix/action.yml, .github/actions/wp-test-matrix/wp-test-matrix.js, tests/actions/wp-test-matrix/wp-test-matrix.test.js, .github/actions/wp-test-matrix/README.md
The action accepts a count and outputs selected full WordPress versions as JSON. Its script validates the count, retries requests, selects the highest patch per X.Y branch, and fails when fewer releases are available than requested. Tests cover selection, errors, retries, and output. The action README documents its inputs, output, and usage.
Workflow matrix integration
.github/workflows/test.yml, README.md
The test workflow runs the action and uses its output to create version-specific matrix legs. Each leg validates its WordPress version. The repository README documents the action in Slic instructions and the composite-action inventory.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Workflow as GitHub Actions workflow
  participant Action as wp-test-matrix action
  participant Script as wp-test-matrix.js
  participant WordPress as WordPress.org
  participant Leg as wp-test-matrix-leg
  Workflow->>Action: Run local action with count
  Action->>Script: Invoke runWpTestMatrix
  Script->>WordPress: Request version offers
  WordPress-->>Script: Return offers
  Script-->>Action: Write versions JSON output
  Action-->>Workflow: Publish versions output
  Workflow->>Leg: Expand matrix with versions
  Leg->>Leg: Validate each version
Loading

Suggested labels: enhancement

Suggested reviewers: larodiel, pauloiankoski, d4mation

Merge Risk: Minimal · up to 8b45c

This change adds a new opt-in action with documentation and tests, plus a CI job that uses it. No concrete merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the ticket ID and the main change: adding the wp-test-matrix action that returns the newest WordPress releases for a test matrix. The changeset adds that action, its README, its tests,…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title names the ticket ID and the main change: adding the wp-test-matrix action that returns the newest WordPress releases for a test matrix. The changeset adds that action, its README, its tests, a test.yml job, and root README updates, so the title matches the primary change. The ticket prefix is extra context but does not make the title misleading.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: c9e5de3f-edcb-4880-9a98-ca37f4a29b38
Commits

Reviewing files that changed from the base of the PR and between 235050a and 8b45c66.

Files selected for processing: 6

  • .github/actions/wp-test-matrix/README.md
  • .github/actions/wp-test-matrix/action.yml
  • .github/actions/wp-test-matrix/wp-test-matrix.js
  • .github/workflows/test.yml
  • README.md
  • tests/actions/wp-test-matrix/wp-test-matrix.test.js

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

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