Skip to content

Commit

Permalink
ci: Skip plugin setup with composer.json .require.php (#37803)
Browse files Browse the repository at this point in the history
We moved most other stuff to checking that, but forgot this.
  • Loading branch information
anomiex authored Jun 11, 2024
1 parent 84c8608 commit 06d20fe
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
6 changes: 6 additions & 0 deletions .github/files/setup-wordpress-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ for PLUGIN in projects/plugins/*/composer.json; do

echo "::group::Installing plugin $NAME into WordPress"

if php -r 'exit( preg_match( "/^>=\\s*(\\d+\\.\\d+)$/", $argv[1], $m ) && version_compare( PHP_VERSION, $m[1], "<" ) ? 0 : 1 );' "$( jq -r '.require.php // ""' "$DIR/composer.json" )"; then
echo "::endgroup::"
echo "Skipping install of plugin $NAME, requires PHP $( jq -r '.require.php // ""' "$DIR/composer.json" )"
continue
fi

if jq --arg script "skip-$TEST_SCRIPT" -e '.scripts[$script] // false' "$DIR/composer.json" > /dev/null; then
{ composer --working-dir="$DIR" run "skip-$TEST_SCRIPT"; CODE=$?; } || true
if [[ $CODE -eq 3 ]]; then
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: removed

Remove obsolete PHP version check in `tests/action-skip-test-php.sh`. No change to the plugin itself.
5 changes: 0 additions & 5 deletions projects/plugins/crm/tests/action-skip-test-php.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#!/bin/bash

if php -r 'exit( version_compare( PHP_VERSION, "7.4.0", "<" ) ? 0 : 1 );'; then
echo "PHP version is too old to run tests. 7.4 is required, but $(php -r 'echo PHP_VERSION;') is installed. Skipping.";
exit 3
fi

# Uncomment the below snippet to disable tests on WP trunk
# if [[ "$WP_BRANCH" == 'trunk' ]]; then
# echo "Codeception tests against WP trunk are temporarily disabled."
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: removed

Remove obsolete `skip-test-php` composer script. No change to the plugin itself.
1 change: 0 additions & 1 deletion projects/plugins/inspect/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"phpunit": [
"./vendor/phpunit/phpunit/phpunit --colors=always"
],
"skip-test-php": "tests/action-skip-test-php.sh",
"test-php": [
"@composer phpunit"
],
Expand Down
6 changes: 0 additions & 6 deletions projects/plugins/inspect/tests/action-skip-test-php.sh

This file was deleted.

0 comments on commit 06d20fe

Please sign in to comment.