Skip to content

Commit

Permalink
Merge pull request #98 from Automattic/add/increase-php-wp-minimum-su…
Browse files Browse the repository at this point in the history
…pported-versions
  • Loading branch information
GaryJones authored Aug 9, 2024
2 parents baeef55 + f024d21 commit 62d4e33
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cs-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "7.4"
php-version: "8.3"
coverage: none
tools: cs2pr

Expand Down
67 changes: 28 additions & 39 deletions .github/workflows/integrations.yml
Original file line number Diff line number Diff line change
@@ -1,86 +1,75 @@
name: Run PHPUnit

on:
# Run on all pushes and on all pull requests.
# Prevent the "push" build from running when there are only irrelevant changes.
push:
paths-ignore:
- "**.md"
pull_request:
# Allow manually triggering the workflow.
workflow_dispatch:

jobs:
test:
name: WP ${{ matrix.wordpress }} on PHP ${{ matrix.php }}
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.allowed_failure }}

env:
WP_VERSION: ${{ matrix.wordpress }}

strategy:
matrix:
wordpress: ["5.5", "5.6", "5.7"]
php: ["5.6", "7.0", "7.1", "7.2", "7.3", "7.4"]
include:
- php: "8.0"
# Ignore platform requirements, so that PHPUnit 7.5 can be installed on PHP 8.0 (and above).
composer-options: "--ignore-platform-reqs"
extensions: pcov
ini-values: pcov.directory=., "pcov.exclude=\"~(vendor|tests)~\""
coverage: pcov
exclude:
- php: "8.0"
wordpress: "5.5"
# Check lowest supported WP version, with the lowest supported PHP.
- wordpress: '5.9'
php: '7.4'
allowed_failure: false
# Check latest WP with the highest supported PHP.
- wordpress: 'latest'
php: 'latest'
allowed_failure: false
# Check upcoming WP.
- wordpress: 'trunk'
php: 'latest'
allowed_failure: true
# Check upcoming PHP - only needed when a new version has been forked (typically Sep-Nov)
# - wordpress: 'trunk'
# php: 'nightly'
# allowed_failure: true
fail-fast: false

steps:

- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ matrix.extensions }}
ini-values: ${{ matrix.ini-values }}
coverage: ${{ matrix.coverage }}

- name: Install Composer dependencies
uses: ramsey/composer-install@v3
with:
composer-options: "${{ matrix.composer-options }}"

- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"

# Setup PCOV since we're using PHPUnit < 8 which has it integrated. Requires PHP 7.1.
# Ignore platform reqs to make it install on PHP 8.
# https://github.com/krakjoe/pcov-clobber
- name: Setup PCOV
if: ${{ matrix.php == 8.0 }}
run: |
composer require pcov/clobber --ignore-platform-reqs
vendor/bin/pcov clobber
- name: Setup Problem Matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Install Composer dependencies
uses: ramsey/composer-install@v3
with:
composer-options: "${{ matrix.composer-options }}"
- name: Show PHP and PHPUnit version info
run: |
php --version
./vendor/bin/phpunit --version
- name: Start MySQL Service
run: sudo systemctl start mysql.service

- name: Setting mysql_native_password for PHP <= 7.3
if: ${{ matrix.php <= 7.3 }}
run: mysql -u root -proot -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root'";

- name: Prepare environment for integration tests
run: composer prepare-ci ${{ matrix.wordpress }}

- name: Run integration tests (single site)
if: ${{ matrix.php != 8.0 }}
run: composer test
- name: Run integration tests (single site with code coverage)
if: ${{ matrix.php == 8.0 }}
run: composer coverage-ci

- name: Run integration tests (multisite)
run: composer test-ms
4 changes: 2 additions & 2 deletions .phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<rule ref="PHPCompatibilityWP"/>
<!-- For help in understanding this testVersion:
https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions -->
<config name="testVersion" value="5.6-"/>
<config name="testVersion" value="7.4-"/>

<!-- Rules: WordPress Coding Standards - see
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards -->
Expand All @@ -40,7 +40,7 @@
<rule ref="WordPress-Docs"/>
<!-- For help in understanding these custom sniff properties:
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties -->
<config name="minimum_supported_wp_version" value="5.5"/>
<config name="minimum_supported_wp_version" value="5.9"/>

<!-- Rules: WordPress VIP - see
https://github.com/Automattic/VIP-Coding-Standards -->
Expand Down
12 changes: 5 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,16 @@
}
],
"require": {
"php": ">=5.6",
"php": ">=7.4",
"composer/installers": "~1.0"
},
"require-dev": {
"automattic/vipwpcs": "^2.2",
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7",
"automattic/vipwpcs": "^3",
"php-parallel-lint/php-parallel-lint": "^1.0",
"phpcompatibility/phpcompatibility-wp": "^2.1",
"phpunit/phpunit": "^4 || ^5 || ^6 || ^7",
"squizlabs/php_codesniffer": "^3.5",
"wp-coding-standards/wpcs": "^2.3.0",
"yoast/phpunit-polyfills": "^0.2.0 || ^1"
"phpunit/phpunit": "^9",
"wp-coding-standards/wpcs": "^3",
"yoast/phpunit-polyfills": "^1"
},
"scripts": {
"cbf": [
Expand Down
5 changes: 3 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
=== Zone Manager (Zoninator) ===
Contributors: batmoo, automattic, wpcomvip, pkevan, matthumphreys, potatomaster, jblz, nickdaugherty, betzster
Tags: zones, post order, post list, posts, order, zonination, content curation, curation, content management
Requires at least: 3.5
Tested up to: 5.7
Requires at least: 5.9
Tested up to: 6.6
Requires PHP: 7.4
Stable tag: 0.9
License: GPLv2

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/class-zoninator-api-controller-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ function delete( $endpoint, $args = array() ) {
/**
* Setup
*/
function setUp() {
function setUp(): void {
parent::setUp();
/**
*The global
Expand Down

0 comments on commit 62d4e33

Please sign in to comment.