Skip to content

Commit

Permalink
Merge pull request #724 from Automattic/add/lint-step-php
Browse files Browse the repository at this point in the history
Set WordPress minimum version to 5.9 & update PHPUnit
  • Loading branch information
alecgeatches authored May 22, 2024
2 parents a884b37 + 4f10d99 commit e1ee3a2
Show file tree
Hide file tree
Showing 17 changed files with 876 additions and 1,024 deletions.
31 changes: 0 additions & 31 deletions .github/workflows/behat-test.yml

This file was deleted.

54 changes: 32 additions & 22 deletions .github/workflows/php-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,57 +8,67 @@ concurrency:

jobs:
test:
name: WP ${{ matrix.wp }} and PHP ${{ matrix.php }}
# Alias 'master' to 'latest'
name: WP ${{ matrix.wp == 'master' && 'latest' || matrix.wp }} and PHP ${{ matrix.php }}
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.allowed_failure }}

strategy:
fail-fast: true
fail-fast: false
matrix:
php: [ '7.4' ]
wp: [ '5.6', '5.7' ]
allowed_failure: [ false ]
include:
- php: '8.0'
wp: '5.6'
allowed_failure: true
- php: '8.0'
wp: '5.7'
allowed_failure: true
# Check lowest supported WP version, with the lowest supported PHP.
- php: '7.4'
wp: '5.9'
allowed_failure: false
# Check latest WP with the highest supported PHP.
- php: 'latest'
wp: 'master'
allowed_failure: false

steps:
- name: Checkout code
uses: actions/checkout@master

- name: Install wordpress environment
run: npm -g install @wordpress/env

- name: Setup PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: pcov
# https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions
extensions: curl, dom, exif, fileinfo, hash, json, mbstring, mysqli, libsodium, openssl, pcre, imagick, xml, zip
tools: composer

- name: Install Composer dependencies (PHP < 8.0 )
if: ${{ matrix.php < 8.0 }}
uses: ramsey/composer-install@v1

- name: Install Composer dependencies (PHP >= 8.0)
if: ${{ matrix.php >= 8.0 }}
if: ${{ matrix.php >= 8.0 || matrix.php == 'latest' }}
uses: ramsey/composer-install@v1
with:
composer-options: --ignore-platform-reqs

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

- name: Install WordPress test site
run: bash bin/install-wp-tests.sh wordpress_test root root localhost ${{ matrix.wp }}
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Run PHPCS diff tests
run: bash bin/phpcs-diff.sh
- name: Setup wp-env
run: wp-env start
env:
WP_ENV_CORE: WordPress/WordPress#${{ matrix.wp }}

- name: Run PHPUnit tests (single site)
run: composer integration

- name: Run PHPUnit tests (multisite)
run: composer integration-ms

# (previously before "Run PHPUnit tests (single site)")
- name: Run PHPCS diff tests
run: bash bin/phpcs-diff.sh
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
node_modules
wordpress
vendor

# Test files
.phpunit.result.cache
3 changes: 3 additions & 0 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"plugins": [ "." ]
}
13 changes: 0 additions & 13 deletions bin/docker-compose.override.yml.template

This file was deleted.

127 changes: 0 additions & 127 deletions bin/install-wp-tests.sh

This file was deleted.

75 changes: 35 additions & 40 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,38 @@
{
"name" : "automattic/edit-flow",
"description": "WordPress plugin to accelerate your editorial workflow.",
"homepage" : "http://editflow.org/",
"type" : "wordpress-plugin",
"license" : "GPL-2.0+",
"support" : {
"issues": "https://github.com/Automattic/edit-flow/issues",
"forum": "https://wordpress.org/support/plugin/edit-flow",
"source": "https://github.com/Automattic/edit-flow"
},
"require" : {
"composer/installers": "~1.0",
"php": ">=7.4"
},
"require-dev": {
"automattic/vipwpcs": "^3.0",
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7",
"exussum12/coverage-checker": "^0.11.2 || ^1.0.0",
"phpunit/phpunit": "^4 || ^5 || ^6 || ^7"
},
"scripts": {
"cs": [
"@php ./vendor/bin/phpcs -p -s -v -n . --standard=\"WordPress-VIP-Go\" --extensions=php --ignore=\"/vendor/*,/node_modules/*,/tests/*\""
],
"cbf": [
"@php ./vendor/bin/phpcbf -p -s -v -n . --standard=\"WordPress-VIP-Go\" --extensions=php --ignore=\"/vendor/*,/node_modules/*,/tests/*\""
],
"integration": [
"@php ./vendor/bin/phpunit --testsuite WP_Tests"
],
"integration-ms": [
"@putenv WP_MULTISITE=1",
"@composer integration"
]
},
"config": {
"allow-plugins": {
"composer/installers": true,
"dealerdirect/phpcodesniffer-composer-installer": true
}
"name": "automattic/edit-flow",
"description": "WordPress plugin to accelerate your editorial workflow.",
"homepage": "http://editflow.org/",
"type": "wordpress-plugin",
"license": "GPL-2.0+",
"support": {
"issues": "https://github.com/Automattic/edit-flow/issues",
"forum": "https://wordpress.org/support/plugin/edit-flow",
"source": "https://github.com/Automattic/edit-flow"
},
"require": {
"composer/installers": "~1.0",
"php": ">=7.4"
},
"require-dev": {
"automattic/vipwpcs": "^3.0",
"exussum12/coverage-checker": "^1.0.0",
"phpunit/phpunit": "^9.0",
"yoast/phpunit-polyfills": "^2.0"
},
"scripts": {
"cs": [
"@php ./vendor/bin/phpcs -p -s -v -n . --standard=\"WordPress-VIP-Go\" --extensions=php --ignore=\"/vendor/*,/node_modules/*,/tests/*\""
],
"cbf": [
"@php ./vendor/bin/phpcbf -p -s -v -n . --standard=\"WordPress-VIP-Go\" --extensions=php --ignore=\"/vendor/*,/node_modules/*,/tests/*\""
],
"integration": "wp-env run tests-cli --env-cwd=wp-content/plugins/Edit-Flow ./vendor/bin/phpunit",
"integration-ms": "wp-env run tests-cli --env-cwd=wp-content/plugins/Edit-Flow /bin/bash -c 'WP_MULTISITE=1 ./vendor/bin/phpunit'"
},
"config": {
"allow-plugins": {
"composer/installers": true,
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
Loading

0 comments on commit e1ee3a2

Please sign in to comment.