Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
69 changes: 69 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,72 @@ jobs:
path: artifacts/test-results
retention-days: 7
if-no-files-found: ignore

phpunit:
name: PHP ${{ matrix.php }} / WP ${{ matrix.wp }}${{ matrix.multisite && ' multisite' || '' }}
runs-on: ubuntu-24.04
permissions:
contents: read
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ]
wp: [ '6.9', latest, trunk ]
multisite: [ false ]
include:
- { php: '8.5', wp: '6.9', multisite: true }
- { php: '8.5', wp: latest, multisite: true }
- { php: '8.5', wp: trunk, multisite: true }
env:
WP_ENV_PHP_VERSION: ${{ matrix.php }}
WP_ENV_CORE: ${{ matrix.wp == 'trunk' && 'WordPress/WordPress' || format( 'https://wordpress.org/wordpress-{0}.zip', matrix.wp ) }}

steps:
# Lets the container write files the runner user owns.
- name: Configure environment variables
run: |
echo "PHP_FPM_UID=$(id -u)" >> "$GITHUB_ENV"
echo "PHP_FPM_GID=$(id -g)" >> "$GITHUB_ENV"

- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

# Same PHP on the runner as in the container, so Composer resolves for it.
- name: Set up PHP
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
with:
php-version: ${{ matrix.php }}
coverage: none

- name: Install Composer dependencies
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0

- name: Set up Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: '.nvmrc'
cache: npm

- name: Install npm dependencies
run: npm ci

- name: Build assets
run: npm run build

- name: Start the test environment
uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0
with:
timeout_minutes: 10
max_attempts: 3
command: npm run wp-env:test start

- name: Log versions
run: |
npm run wp-env:test -- run cli php -- -v
npm run wp-env:test -- run cli wp core version

- name: Run PHPUnit
run: npm run ${{ matrix.multisite && 'test:php:multisite' || 'test:php' }}
8 changes: 7 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,17 @@
"minimum-stability": "dev",
"prefer-stable": true,
"require-dev": {
"10up/phpcs-composer": "dev-master"
"10up/phpcs-composer": "dev-master",
"phpunit/phpunit": "^9.6",
"yoast/phpunit-polyfills": "^4.0",
"wp-phpunit/wp-phpunit": "^7.1"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
},
"platform": {
"php": "7.4"
}
}
}
Loading
Loading