Skip to content

Commit

Permalink
Merge branch 'trunk' into add/protect-firewall-stat-cards
Browse files Browse the repository at this point in the history
  • Loading branch information
dkmyta committed Jul 17, 2024
2 parents f4ad0b5 + 742a6b2 commit 329db63
Show file tree
Hide file tree
Showing 414 changed files with 7,378 additions and 3,829 deletions.
2 changes: 1 addition & 1 deletion .github/files/check-lock-files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ for FILE in $(git -c core.quotepath=off ls-files 'pnpm-lock.yaml' '**/pnpm-lock.
echo "::endgroup::"
if ! git diff --exit-code pnpm-lock.yaml; then
echo "---" # Bracket message containing newlines for better visibility in GH's logs.
echo "::error file=$FILE::$FILE is not up to date!%0AYou can probably fix this by running \`pnpm install\` in the appropriate directory."
echo "::error file=$FILE::$FILE is not up to date!%0AYou can probably fix this by running \`pnpm install\`.%0AIf that doesn't do it, try \`pnpm install --resolution-only\`."
echo "---"
EXIT=1
fi
Expand Down
12 changes: 11 additions & 1 deletion .github/files/generate-ci-matrix.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
$matrix = array();

// Add PHP tests.
foreach ( array( '7.0', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ) as $php ) {
foreach ( array( '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ) as $php ) {
$matrix[] = array(
'name' => "PHP tests: PHP $php WP latest",
'script' => 'test-php',
Expand All @@ -68,6 +68,16 @@
);
}

// TODO: When WordPress 6.5 is no longer supported, this can be removed.
$matrix[] = array(
'name' => 'PHP tests: PHP 7.0 WP previous',
'script' => 'test-php',
'php' => '7.0',
'wp' => 'previous',
'timeout' => 20, // 2023-08-17: Successful runs seem to take up to ~12 minutes.
'force-package-tests' => true,
);

foreach ( array( 'previous', 'trunk' ) as $wp ) {
$phpver = $versions['PHP_VERSION'];
$matrix[] = array(
Expand Down
24 changes: 19 additions & 5 deletions .github/files/setup-wordpress-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,30 +32,31 @@ echo "::endgroup::"
echo "::group::Preparing WordPress from \"$WP_BRANCH\" branch";
case "$WP_BRANCH" in
trunk)
TAG=trunk
WORDPRESS_TAG=trunk
;;
latest)
TAG=$(php ./tools/get-wp-version.php)
WORDPRESS_TAG=$(php ./tools/get-wp-version.php)
;;
previous)
# We hard-code the version here because there's a time near WP releases where
# we've dropped the old 'previous' but WP hasn't actually released the new 'latest'
TAG=6.4
WORDPRESS_TAG=6.5
;;
*)
echo "Unrecognized value for WP_BRANCH: $WP_BRANCH" >&2
exit 1
;;
esac
git clone --depth=1 --branch "$TAG" git://develop.git.wordpress.org/ "/tmp/wordpress-$WP_BRANCH"
git clone --depth=1 --branch "$WORDPRESS_TAG" git://develop.git.wordpress.org/ "/tmp/wordpress-$WP_BRANCH"
# We need a built version of WordPress to test against, so download that into the src directory instead of what's in wordpress-develop.
rm -rf "/tmp/wordpress-$WP_BRANCH/src"
git clone --depth=1 --branch "$TAG" git://core.git.wordpress.org/ "/tmp/wordpress-$WP_BRANCH/src"
git clone --depth=1 --branch "$WORDPRESS_TAG" git://core.git.wordpress.org/ "/tmp/wordpress-$WP_BRANCH/src"
echo "::endgroup::"

if [[ -n "$GITHUB_ENV" ]]; then
echo "WORDPRESS_DEVELOP_DIR=/tmp/wordpress-$WP_BRANCH" >> "$GITHUB_ENV"
echo "WORDPRESS_DIR=/tmp/wordpress-$WP_BRANCH/src" >> "$GITHUB_ENV"
echo "WORDPRESS_TAG=$WORDPRESS_TAG" >> "$GITHUB_ENV"
fi

# Don't symlink, it breaks when copied later.
Expand Down Expand Up @@ -123,6 +124,19 @@ for PLUGIN in projects/plugins/*/composer.json; do
fi
cd "$BASE"

# Upgrade/downgrade WorDBless if necessary.
if [[ ( "$WP_BRANCH" == 'trunk' || "$WP_BRANCH" == 'previous' ) && "$TEST_SCRIPT" == "test-php" ]]; then
VER=$(composer --format=json --working-dir="$DIR" show | jq -r '.installed[] | select( .name == "roots/wordpress" ) | .version')
if [[ -n "$VER" ]]; then
INSVER=$WORDPRESS_TAG
[[ "$WORDPRESS_TAG" == 'trunk' ]] && INSVER="dev-main as $VER"
echo "Supposed to run tests against WordPress $WORDPRESS_TAG, so setting roots/wordpress and roots/wordpress-no-content to \"$INSVER\""
# Composer seems to sometimes have issues with deleting the wordpress dir on its own, so do it manually first.
rm -rf "$DIR/wordpress"
composer --working-dir="$DIR" require --dev roots/wordpress="$INSVER" roots/wordpress-no-content="$INSVER"
fi
fi

cp -r "$DIR" "/tmp/wordpress-$WP_BRANCH/src/wp-content/plugins/$NAME"
# Plugin dir for tests in WP >= 5.6-beta1
ln -s "/tmp/wordpress-$WP_BRANCH/src/wp-content/plugins/$NAME" "/tmp/wordpress-$WP_BRANCH/tests/phpunit/data/plugins/$NAME"
Expand Down
32 changes: 18 additions & 14 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ jobs:
pnpm install
echo "::endgroup::"
# If we're going to be making WorDBless use WP "nightlies", remove the relevant package from Composer's cache to get the latest version.
if [[ "$WP_BRANCH" == 'trunk' && "$TEST_SCRIPT" == "test-php" ]]; then
echo "::group::Clear composer cache for roots/wordpress"
DIR=$(composer config cache-files-dir)
rm -rf "$DIR/roots/wordpress" "$DIR/roots/wordpress-no-content"
echo "::endgroup::"
fi
- name: Detect changed projects
id: changed
run: |
Expand Down Expand Up @@ -105,12 +113,6 @@ jobs:
FORCE_PACKAGE_TESTS: ${{ matrix.force-package-tests && 'true' || 'false' }}
CHANGED: ${{ steps.changed.outputs.projects }}
run: |
# If we're going to be making WorDBless use WP "nightlies", remove the relevant package from Composer's cache to get the latest version.
if [[ "$WP_BRANCH" == 'trunk' && ( "$TEST_SCRIPT" == "test-php" ) ]]; then
DIR=$(composer config cache-files-dir)
rm -rf "$DIR/roots/wordpress"
fi
EXIT=0
mkdir artifacts
for P in composer.json projects/*/*/composer.json; do
Expand Down Expand Up @@ -165,15 +167,17 @@ jobs:
echo 'Platform reqs failed, running `composer update`'
composer --working-dir="$DIR" update
fi
fi
if [[ "$WP_BRANCH" == 'trunk' && "$TEST_SCRIPT" == "test-php" ]]; then
VER=$(composer --format=json --working-dir="$DIR" show | jq -r '.installed[] | select( .name == "roots/wordpress" ) | .version')
if [[ -n "$VER" ]]; then
echo 'Supposed to run tests against WordPress trunk, so upgrading roots/wordpress and roots/wordpress-no-content to dev-main'
# Composer seems to sometimes have issues with deleting the wordpress dir on its own, so do it manually first.
rm -rf "$DIR/wordpress"
composer --working-dir="$DIR" require --dev roots/wordpress="dev-main as $VER" roots/wordpress-no-content="dev-main as $VER"
if [[ "$WP_BRANCH" == 'trunk' || "$WP_BRANCH" == 'previous' ]]; then
VER=$(composer --format=json --working-dir="$DIR" show | jq -r '.installed[] | select( .name == "roots/wordpress" ) | .version')
if [[ -n "$VER" ]]; then
INSVER=$WORDPRESS_TAG
[[ "$WORDPRESS_TAG" == 'trunk' ]] && INSVER="dev-main as $VER"
echo "Supposed to run tests against WordPress $WORDPRESS_TAG, so setting roots/wordpress and roots/wordpress-no-content to \"$INSVER\""
# Composer seems to sometimes have issues with deleting the wordpress dir on its own, so do it manually first.
rm -rf "$DIR/wordpress"
composer --working-dir="$DIR" require --dev roots/wordpress="$INSVER" roots/wordpress-no-content="$INSVER"
fi
fi
fi
Expand Down
22 changes: 21 additions & 1 deletion .phan/stubs/wpcom-stubs.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
* `bin/teamcity-builds/jetpack-stubs/stub-defs.php` and regenerate the stubs
* by triggering the Jetpack Staging → Update WPCOM Stubs job in TeamCity.
*
* Stubs automatically generated from WordPress.com commit a25939eb7a9654c086d1701613a63deaea5c909e.
* Stubs automatically generated from WordPress.com commit e4bff119a0ef34bd626cc234b0f63e0ad9de74a6.
*/

namespace {
\define('WPCOM_VALUE_BUNDLE', 1003);
\define('TRANSLATE_BLOG_ID', 101407);
/**
* @param object $blog
Expand Down Expand Up @@ -45,6 +46,12 @@ function is_wpforteams_site($blog_id)
function localized_wpcom_url($url, $the_locale = \null)
{
}
class WPCom_Languages
{
public static function localize_url($url, $the_locale = \null)
{
}
}
/**
* @return bool
*/
Expand Down Expand Up @@ -172,9 +179,16 @@ public static function api_only_get_active_plans_v1_4($blog_id = \false, $coupon
{
}
}
/**
* @return Store_Product|null
*/
function get_store_product($product_id, $meta = \null, $currency = \null, $blog_id = \null, ?int $usage_quantity = \null, ?string $plan_id = \null)
{
}
class Store_Product
{
public $product_id;
public string $product_name;
}
/**
* @property Store_Transaction $transaction
Expand Down Expand Up @@ -1174,6 +1188,12 @@ public static function enqueue_script($handle)
function wpcom_get_blog_owner($blog_id = \null)
{
}
function add_blog_sticker($sticker, $notes = \NULL, $who = \NULL, $_blog_id = \NULL)
{
}
function remove_blog_sticker($sticker, $notes = \NULL, $who = \null, $_blog_id = \NULL)
{
}
/**
* @param string $sticker
* @param null|string|int $_blog_id
Expand Down
2 changes: 1 addition & 1 deletion .phpcs.config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!-- This file configures everything except the list of rules. -->
<!-- The separation is so .github/files/phpcompatibility-dev-phpcs.xml can use the same config with a different rule set. -->
<ruleset>
<config name="minimum_supported_wp_version" value="6.4" />
<config name="minimum_supported_wp_version" value="6.5" />
<config name="testVersion" value="7.0-"/>

<!-- Use our custom filter for `.phpcsignore` and `.phpcs.dir.xml` support. -->
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"phan/phan": "^5.4",
"php-parallel-lint/php-parallel-lint": "^1.4.0",
"php-stubs/woocommerce-stubs": ">=8.7",
"php-stubs/wordpress-stubs": ">=6.4",
"php-stubs/wordpress-tests-stubs": ">=6.4",
"php-stubs/wordpress-stubs": ">=6.5",
"php-stubs/wordpress-tests-stubs": ">=6.5",
"php-stubs/wp-cli-stubs": "^2.10",
"sirbrillig/phpcs-changed": "2.11.4",
"squizlabs/php_codesniffer": "^3.6.2"
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

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

Loading

0 comments on commit 329db63

Please sign in to comment.