Skip to content

Commit

Permalink
CI: Refresh minimum PHP and WP versions
Browse files Browse the repository at this point in the history
Update dev dependencies.
  • Loading branch information
GaryJones committed Nov 23, 2024
1 parent 0b6513d commit 9aeef26
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 57 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/cs-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@ jobs:
env:
XMLLINT_INDENT: " "

strategy:
matrix:
php: ['7.4', 'latest', '8.5']
fail-fast: false

continue-on-error: ${{ matrix.php == '8.5' }}

steps:
- name: Setup PHP
- name: Setup PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: "7.4"
php-version: ${{ matrix.php }}
coverage: none
tools: cs2pr

Expand All @@ -37,7 +44,7 @@ jobs:
uses: korelstar/xmllint-problem-matcher@v1

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

# Validate the composer.json file.
# @link https://getcomposer.org/doc/03-cli.md#validate
Expand All @@ -47,7 +54,7 @@ jobs:
# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: Install Composer dependencies
uses: ramsey/composer-install@v1
uses: ramsey/composer-install@v3

# Lint PHP.
- name: Lint PHP against parse errors
Expand Down
69 changes: 31 additions & 38 deletions .github/workflows/integrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,76 +10,69 @@ on:
# Allow manually triggering the workflow.
workflow_dispatch:

# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: WP ${{ matrix.wordpress }} on PHP ${{ matrix.php }}
# Ubuntu-20.x includes MySQL 8.0, which causes `caching_sha2_password` issues with PHP < 7.4
# https://www.php.net/manual/en/mysqli.requirements.php
# TODO: change to ubuntu-latest when we no longer support PHP < 7.4
runs-on: ubuntu-18.04
runs-on: ubuntu-latest

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@v2
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: --ignore-platform-req=php+

- 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@v1
with:
composer-options: "${{ matrix.composer-options }}"

- name: Start MySQL Service
run: sudo systemctl start mysql.service

- name: Prepare environment for integration tests
run: composer prepare-ci
run: composer prepare ${{ 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
20 changes: 6 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,21 @@
}
],
"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"
"phpunit/phpunit": "^9",
"wp-coding-standards/wpcs": "^3",
"yoast/phpunit-polyfills": "^1.1"
},
"scripts": {
"cbf": [
"@php ./vendor/bin/phpcbf"
],
"coverage": [
"@php ./vendor/bin/phpunit --coverage-html ./build/coverage-html"
],
"coverage-ci": [
"@php ./vendor/bin/phpunit"
],
"cs": [
"@php ./vendor/bin/phpcs"
],
Expand All @@ -43,7 +35,7 @@
"lint-ci": [
"@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . -e php --exclude vendor --exclude .git --checkstyle"
],
"prepare-ci": [
"prepare": [
"bash bin/install-wp-tests.sh wordpress_test root root localhost"
],
"test": [
Expand Down
2 changes: 1 addition & 1 deletion tests/maintenance-mode-testcase.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Base unit test class for Maintenance Mode
*/
class MaintenanceMode_TestCase extends WP_UnitTestCase {
public function setUp() {
public function set_up() {
parent::setUp();

global $maintenance_mode;
Expand Down

0 comments on commit 9aeef26

Please sign in to comment.