Skip to content

Commit 7abfeb3

Browse files
dd32claude
andcommitted
Update CI to PHP 8.4/8.5 using wp-env for tests
- Replace custom install-wp-tests.sh CI setup with wp-env - Test against PHP 8.4 and 8.5 (dropping 7.4) - Update wp-env default PHP version to 8.4 - Update coding standards workflow to PHP 8.4 - Widen composer PHPUnit constraint to support 9.6/10/11 - Widen yoast/phpunit-polyfills to ^2.0 || ^3.0 - Remove PHPUnit 10-incompatible XML attributes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0057cf1 commit 7abfeb3

File tree

5 files changed

+19
-30
lines changed

5 files changed

+19
-30
lines changed

.github/workflows/coding-standards.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Install PHP
1717
uses: shivammathur/setup-php@v2
1818
with:
19-
php-version: '8.3'
19+
php-version: '8.4'
2020
coverage: 'none'
2121
tools: composer, cs2pr
2222

.github/workflows/tests.yml

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,48 +9,40 @@ jobs:
99
name: PHPUnit ${{ matrix.php }}
1010
runs-on: ubuntu-latest
1111

12-
services:
13-
mysql:
14-
image: mysql:5.7
15-
ports:
16-
- 3306/tcp
17-
env:
18-
MYSQL_ROOT_PASSWORD: password
19-
# Set health checks to wait until mysql has started
20-
options: >-
21-
--health-cmd "mysqladmin ping"
22-
--health-interval 10s
23-
--health-timeout 5s
24-
--health-retries 3
25-
2612
strategy:
2713
fail-fast: false
2814
matrix:
29-
php: [ '7.4', '8.3' ]
15+
php: [ '8.4', '8.5' ]
3016

3117
steps:
3218
- name: Check out Git repository
3319
uses: actions/checkout@v4
3420

21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: 20
25+
3526
- name: Setup PHP
3627
uses: shivammathur/setup-php@v2
3728
with:
3829
php-version: ${{ matrix.php }}
3930
coverage: 'none'
4031
tools: composer
4132

42-
- name: Install dependencies
33+
- name: Install Composer dependencies
4334
uses: ramsey/composer-install@v2
4435
with:
4536
composer-options: "--no-progress --no-ansi --no-interaction"
4637

47-
- name: Install WordPress test setup
48-
run: bash bin/install-wp-tests.sh wordpress_test root password 127.0.0.1:${{ job.services.mysql.ports[3306] }} latest
38+
- name: Install wp-env
39+
run: npm -g install @wordpress/env
40+
41+
- name: Override PHP version
42+
run: echo '{ "phpVersion":"${{ matrix.php }}" }' > .wp-env.override.json
4943

50-
- name: Setup problem matchers for PHPUnit
51-
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
44+
- name: Start wp-env
45+
run: wp-env start
5246

5347
- name: Run tests
54-
env:
55-
WP_TESTS_DIR: /tmp/wordpress-tests-lib/
56-
run: vendor/bin/phpunit
48+
run: wp-env run tests-cli --env-cwd=wp-content/plugins/wporg-gp-translation-events ./vendor/bin/phpunit

.wp-env.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"core": null,
3-
"phpVersion": "8.3",
3+
"phpVersion": "8.4",
44
"plugins": [
55
"GlotPress/GlotPress",
66
"https://downloads.wordpress.org/plugin/sqlite-object-cache.1.3.7.zip",

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"description": "",
44
"license": "GPL-2.0-only",
55
"require-dev": {
6-
"phpunit/phpunit": "^9.6.16",
7-
"yoast/phpunit-polyfills": "^2.0.0",
6+
"phpunit/phpunit": "^9.6.16 || ^10.0 || ^11.0",
7+
"yoast/phpunit-polyfills": "^2.0.0 || ^3.0",
88
"wp-coding-standards/wpcs": "^3.0"
99
},
1010
"scripts":{

phpunit.xml.dist

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
bootstrap="tests/bootstrap.php"
44
backupGlobals="false"
55
colors="true"
6-
convertErrorsToExceptions="true"
7-
convertNoticesToExceptions="true"
8-
convertWarningsToExceptions="true"
96
>
107
<testsuites>
118
<testsuite name="tests">

0 commit comments

Comments
 (0)