Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,40 @@ on:
push:
branches: [main]
pull_request:
schedule:
# Weekly, so new WordPress releases and trunk get exercised even when the repo is quiet.
- cron: '0 6 * * 1'
workflow_dispatch:

jobs:
wp-versions:
name: Resolve WordPress versions
runs-on: ubuntu-latest
outputs:
branches: ${{ steps.resolve.outputs.branches }}
steps:
- name: Fetch supported branches from wordpress.org
id: resolve
run: |
# stable-check lists every x.y.z release. Reduce to x.y branches and keep the newest five,
# so the matrix picks up new majors automatically and drops old ones. Trunk rides along
# as "nightly" so the next release is tested before it ships.
branches=$(curl -sf https://api.wordpress.org/core/stable-check/1.0/ | python3 -c '
import json, sys
versions = json.load(sys.stdin)
branches = {".".join(v.split(".")[:2]) for v in versions}
branches = sorted(branches, key=lambda b: tuple(int(n) for n in b.split(".")))
print(json.dumps(branches[-5:] + ["nightly"]))
')
echo "Testing against WordPress: $branches"
echo "branches=$branches" >> "$GITHUB_OUTPUT"

phpunit:
name: PHP ${{ matrix.php }} / WP ${{ matrix.wp }}
runs-on: ubuntu-latest
needs: wp-versions
# Trunk is allowed to fail without failing the run.
continue-on-error: ${{ matrix.wp == 'nightly' }}

services:
mysql:
Expand All @@ -28,7 +57,7 @@ jobs:
fail-fast: false
matrix:
php: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
wp: ['6.5', '6.6', '6.7', '6.8', '6.9']
wp: ${{ fromJSON(needs.wp-versions.outputs.branches) }}

steps:
- uses: actions/checkout@v7
Expand Down
Loading