Skip to content

Commit cb0518f

Browse files
committed
Update GitHub Actions and dev dependencies for PHP 7.4+ compatibility
1 parent 47b8bae commit cb0518f

File tree

6 files changed

+64
-120
lines changed

6 files changed

+64
-120
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 0 additions & 72 deletions
This file was deleted.

.github/workflows/cs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121

2222
steps:
2323
- name: Checkout code
24-
uses: actions/checkout@v2
24+
uses: actions/checkout@v4
2525

2626
- name: Install PHP
2727
uses: shivammathur/setup-php@v2
@@ -38,7 +38,7 @@ jobs:
3838
# Install dependencies and handle caching in one go.
3939
# @link https://github.com/marketplace/actions/install-composer-dependencies
4040
- name: Install Composer dependencies
41-
uses: "ramsey/composer-install@v1"
41+
uses: "ramsey/composer-install@v2"
4242

4343
- name: 'Run Composer Update'
4444
run: |

.github/workflows/unit-tests.yml

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,25 @@ jobs:
2323
matrix:
2424
# Notes regarding supported versions in WP:
2525
# The base matrix only contains the PHP versions which are supported on all supported WP versions.
26-
php: ['7.1', '7.2', '7.3', '7.4']
26+
php: ['8.0', '8.1', '7.4']
2727
wp: ['latest']
2828
experimental: [false]
2929

3030
include:
3131
# Complement the builds run via the matrix with high/low WP builds for PHP 7.4 and 8.0.
3232
# PHP 8.0 is sort of supported since WP 5.6.
3333
# PHP 7.4 is supported since WP 5.3.
34-
- php: '8.1'
34+
- php: '8.3'
3535
wp: 'latest'
3636
experimental: true
37-
- php: '8.0'
38-
wp: '5.6'
37+
- php: '8.2'
38+
wp: 'latest'
3939
experimental: true
40-
- php: '7.4'
41-
wp: '5.5'
40+
- php: '8.2'
41+
wp: '6.3'
4242
experimental: true
43-
- php: '7.4'
44-
wp: 'nightly'
43+
- php: '8.0'
44+
wp: '5.9'
4545
experimental: true
4646

4747
name: "PHP ${{ matrix.php }} - WP ${{ matrix.wp }}"
@@ -65,62 +65,61 @@ jobs:
6565

6666
steps:
6767
- name: Checkout code
68-
uses: actions/checkout@v2
68+
uses: actions/checkout@v4
6969

7070
- name: Install PHP
7171
uses: shivammathur/setup-php@v2
7272
with:
7373
php-version: ${{ matrix.php }}
74-
tools: phpunit-polyfills
74+
extensions: mysqli, mysql
7575
coverage: none
76-
# The PHP 5.6 and 7.0 images don't include mysql[i] by default.
77-
extensions: mysqli
78-
79-
- name: Set up WordPress
80-
run: phpunit/install.sh wordpress_test root '' 127.0.0.1:3306 ${{ matrix.wp }}
8176

8277
# On WP 5.2, PHPUnit 5.x, 6.x and 7.x are supported.
8378
# On PHP >= 8.0, PHPUnit 7.5+ is needed, no matter what.
8479
- name: Determine supported PHPUnit version
8580
id: set_phpunit
8681
run: |
8782
if [[ "${{ matrix.php }}" > "8.0" ]]; then
88-
echo '::set-output name=PHPUNIT::9.*'
83+
echo "PHPUNIT=9.*" >> $GITHUB_ENV
8984
else
90-
echo '::set-output name=PHPUNIT::5.7.*||6.*||7.5.*'
85+
echo "PHPUNIT=5.7.*||6.*||7.5.*||8.5.*" >> $GITHUB_ENV
9186
fi
9287
9388
- name: 'Composer: set up PHPUnit'
94-
run: composer require --no-update phpunit/phpunit:"${{ steps.set_phpunit.outputs.PHPUNIT }}"
89+
env:
90+
PHPUNIT: ${{ env.PHPUNIT }}
91+
run: composer require --no-update phpunit/phpunit:"${{ env.PHPUNIT }}"
9592

9693
# Install dependencies and handle caching in one go.
9794
# @link https://github.com/marketplace/actions/install-composer-dependencies
9895
- name: Install Composer dependencies for PHP < 8.0
9996
if: ${{ matrix.php < 8.0 }}
100-
uses: "ramsey/composer-install@v1"
97+
uses: "ramsey/composer-install@v2"
10198

10299
# For the PHP 8.0 and above, we need to install with ignore platform reqs as not all dependencies allow it yet.
103100
- name: Install Composer dependencies for PHP >= 8.0
104101
if: ${{ matrix.php >= 8.0 }}
105-
uses: "ramsey/composer-install@v1"
102+
uses: "ramsey/composer-install@v2"
106103
with:
107104
composer-options: --ignore-platform-reqs
108105

109-
- name: 'Run Composer Update'
110-
run: |
111-
composer update --ignore-platform-reqs
106+
- name: Install Subversion
107+
run: sudo apt-get install subversion
108+
109+
- name: Set up WordPress
110+
run: phpunit/install.sh wordpress_test root '' 127.0.0.1:3306 ${{ matrix.wp }}
112111

113112
- name: Tool versions
114113
run: |
115114
php --version
116115
composer --version
117-
phpunit --version
118-
which phpunit
116+
./vendor/bin/phpunit --version
117+
which ./vendor/bin/phpunit
119118
120119
- name: Run the unit tests - single site
121-
run: vendor/bin/phpunit
120+
run: ./vendor/bin/phpunit
122121

123122
- name: Run the unit tests - multisite
124-
run: vendor/bin/phpunit
125123
env:
126124
WP_MULTISITE: 1
125+
run: ./vendor/bin/phpunit

.github/workflows/zipitup.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,22 @@ jobs:
2222
runs-on: ubuntu-latest
2323
steps:
2424
- name: Checkout code
25-
uses: actions/checkout@v2
25+
uses: actions/checkout@v4
2626
- name: Build project
2727
run: |
2828
mkdir build
2929
- name: Create artifact
30-
uses: montudor/action-zip@v0.1.0
30+
uses: montudor/action-zip@v1
3131
with:
32-
args: zip -X -r build/autoclose.zip . -x *.git* node_modules/\* .* "*/\.*" CODE_OF_CONDUCT.md CONTRIBUTING.md ISSUE_TEMPLATE.md PULL_REQUEST_TEMPLATE.md *.dist *.yml composer.* dev-helpers** build** wporg-assets** phpunit**
32+
args: zip -X -r build/${{ github.event.repository.name }}.zip . -x *.git* node_modules/\* .* "*/\.*" CODE_OF_CONDUCT.md CONTRIBUTING.md ISSUE_TEMPLATE.md PULL_REQUEST_TEMPLATE.md *.dist *.yml *.neon composer.* package.json dev-helpers** build** wporg-assets** phpunit**
3333
- name: Upload artifact
34-
uses: actions/upload-artifact@v2
34+
uses: actions/upload-artifact@v4
3535
with:
36-
name: autoclose
37-
path: build/autoclose.zip
36+
name: ${{ github.event.repository.name }}
37+
path: build/${{ github.event.repository.name }}.zip
3838
- name: Upload to release
3939
uses: JasonEtco/upload-to-release@master
4040
with:
41-
args: build/autoclose.zip application/zip
41+
args: build/${{ github.event.repository.name }}.zip application/zip
4242
env:
4343
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

composer.json

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,33 @@
1313
"authors": [
1414
{
1515
"name": "WebberZone",
16-
"email": "[email protected]",
1716
"role": "Developer"
1817
}
1918
],
20-
"requires": {
21-
"php": ">=7"
19+
"require": {
20+
"php": ">=7.4"
21+
},
22+
"require-dev": {
23+
"szepeviktor/phpstan-wordpress": "^1",
24+
"phpstan/extension-installer": "^1",
25+
"phpstan/phpstan": "^1",
26+
"php-stubs/wordpress-stubs": "^6",
27+
"wp-coding-standards/wpcs": "^3",
28+
"dealerdirect/phpcodesniffer-composer-installer": "^1",
29+
"phpcompatibility/phpcompatibility-wp": "^2",
30+
"yoast/phpunit-polyfills": "^3",
31+
"phpunit/phpunit": "^7.5 || ^8 || ^9 || ^10 || ^11 || ^12"
32+
},
33+
"config": {
34+
"allow-plugins": {
35+
"phpstan/extension-installer": true,
36+
"dealerdirect/phpcodesniffer-composer-installer": true
37+
}
38+
},
39+
"scripts": {
40+
"phpstan": "vendor/bin/phpstan analyse --memory-limit=2048M",
41+
"phpstan-baseline": "vendor/bin/phpstan analyse --generate-baseline --memory-limit=2048M",
42+
"phpcs": "vendor/bin/phpcs -p -v -s --standard=phpcs.xml.dist $(find . -name '*.php')",
43+
"phpcbf": "vendor/bin/phpcbf -p -v -s --standard=phpcs.xml.dist $(find . -name '*.php')"
2244
}
2345
}

phpunit/bootstrap.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
<?php
22
/**
33
* PHPUnit bootstrap file.
4-
*
5-
* @package Better_Search_Plugin
64
*/
7-
require_once dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) ) . '/.composer/vendor/yoast/phpunit-polyfills/phpunitpolyfills-autoload.php';
85

96
$_tests_dir = getenv( 'WP_TESTS_DIR' );
107

@@ -27,14 +24,12 @@
2724
require_once $_tests_dir . '/includes/functions.php';
2825

2926
function _manually_load_plugin() {
30-
require dirname( dirname( __FILE__ ) ) . '/autoclose.php';
27+
require dirname( __DIR__ ) . '/add-to-all.php';
3128
}
3229
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
3330

31+
// Include the PHPUnit Polyfills autoloader.
32+
require dirname( __DIR__ ) . '/vendor/yoast/phpunit-polyfills/phpunitpolyfills-autoload.php';
33+
3434
// Start up the WP testing environment.
3535
require $_tests_dir . '/includes/bootstrap.php';
36-
37-
activate_plugin( 'autoclose/autoclose.php' );
38-
39-
echo "Installing Autoclose...\n";
40-

0 commit comments

Comments
 (0)