Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,25 @@ jobs:
matrix:
# Lint against the highest/lowest supported versions of each PHP major.
# And also do a run against "nightly" (the current dev version of PHP).
php_version: ['8.2', '8.3', '8.4', '8.5']
php_version: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']

name: "Lint: PHP ${{ matrix.php_version }}"

steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Install PHP
# The locked dev tools (PHP-CS-Fixer and friends) need a newer PHP than the
# plugin itself supports, so install with a recent PHP first.
- name: Install PHP for the composer install
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
with:
php-version: ${{ matrix.php_version }}
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
php-version: '8.3'
coverage: none
tools: cs2pr

# Without this, vendor/autoload.php refuses to load on the older PHP versions in the matrix.
- name: 'Composer: disable the platform check'
run: composer config platform-check false

# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
Expand All @@ -50,5 +54,13 @@ jobs:
# Bust the cache at least once a month - output format: YYYY-MM-DD.
custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F")

- name: Install PHP for the actual lint
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
with:
php-version: ${{ matrix.php_version }}
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
coverage: none
tools: cs2pr

- name: Lint against parse errors
run: composer lint -- --checkstyle | cs2pr
22 changes: 19 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ jobs:
strategy:
matrix:
include:
# The lowest PHP version the plugin header declares.
- php_version: '7.4'
wp_version: '6.6'
multisite: false

- php_version: '8.2'
wp_version: '6.6'
multisite: false
Expand Down Expand Up @@ -71,13 +76,24 @@ jobs:
- name: "Composer: remove the PHP platform requirement"
run: composer config --unset platform.php

# The code style and static analysis tools are not needed here and do not install on older PHP versions.
- name: "Composer: remove the dev tools that are not needed for the tests"
run: >
composer remove --dev --no-update --no-scripts --no-interaction
friendsofphp/php-cs-fixer
php-parallel-lint/php-parallel-lint
phpcompatibility/phpcompatibility-wp
phpstan/extension-installer
phpstan/phpstan
szepeviktor/phpstan-wordpress
wp-coding-standards/wpcs
yoast/yoastcs

- name: "Install Composer dependencies"
uses: ramsey/composer-install@26d8a556604053a9612623447203a691f406fbe6 # v4
with:
# Force a `composer update` run.
# Force a `composer update` run, so the test tooling matches the PHP version.
dependency-versions: "highest"
# But make it selective.
composer-options: "yoast/wp-test-utils --with-dependencies"
# Bust the cache at least once a month - output format: YYYY-MM-DD.
custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F")

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"source": "https://github.com/emilia-capital/comment-hacks"
},
"require": {
"php": ">=8.2",
"php": ">=7.4",
"composer/installers": "^2.3.0"
},
"require-dev": {
Expand Down
4 changes: 2 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading