Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/trunk' into update/protect/icon-…
Browse files Browse the repository at this point in the history
…tooltip-use
  • Loading branch information
nateweller committed Nov 14, 2024
2 parents 74fba6a + bbb0564 commit 879fdff
Show file tree
Hide file tree
Showing 871 changed files with 9,509 additions and 8,322 deletions.
52 changes: 32 additions & 20 deletions .github/files/coverage-munger/process-coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,39 @@ echo '::endgroup::'
TMP_DIR=$( mktemp -d )
trap 'rm -rf "$TMP_DIR"' exit

echo "::group::Combining PHP coverage"
composer --working-dir="$BASE" update
"$BASE"/vendor/bin/phpcov merge --php artifacts/php-combined.cov coverage
perl -i -pwe 'BEGIN { $prefix = shift; $prefix=~s!/*$!/!; $re = qr/\Q$prefix\E/; $l = length( $prefix ); } s!s:(\d+):"$re! sprintf( qq(s:%d:"), $1 - $l ) !ge' "$GITHUB_WORKSPACE" artifacts/php-combined.cov
echo '::endgroup::'

echo "::group::Combining JS coverage"
pnpm --filter=jetpack-gh-config-munger exec istanbul-merge --out "$PWD"/artifacts/js-combined.json $( find "$PWD/coverage" -name '*.json' )
perl -i -pwe 'BEGIN { $prefix = shift; $prefix=~s!/*$!/!; $re = qr/\Q$prefix\E/; } s!"$re!"!g' "$GITHUB_WORKSPACE" artifacts/js-combined.json
echo '::endgroup::'

echo "::group::Creating PHP coverage summary"
"$BASE"/extract-php-summary-data.php artifacts/php-combined.cov > "$TMP_DIR/php-summary.tsv"
echo '::endgroup::'
TMP=$( find "$PWD/coverage" -name '*.cov' )
if [[ -n "$TMP" ]]; then
echo "::group::Combining PHP coverage"
composer --working-dir="$BASE" update
"$BASE"/vendor/bin/phpcov merge --php artifacts/php-combined.cov coverage
perl -i -pwe 'BEGIN { $prefix = shift; $prefix=~s!/*$!/!; $re = qr/\Q$prefix\E/; $l = length( $prefix ); } s!s:(\d+):"$re! sprintf( qq(s:%d:"), $1 - $l ) !ge' "$GITHUB_WORKSPACE" artifacts/php-combined.cov
echo '::endgroup::'

echo "::group::Creating PHP coverage summary"
"$BASE"/extract-php-summary-data.php artifacts/php-combined.cov > "$TMP_DIR/php-summary.tsv"
echo '::endgroup::'
else
echo "No PHP coverage files found!"
touch "$TMP_DIR/php-summary.tsv"
fi

echo "::group::Creating JS coverage summary"
mkdir "$TMP_DIR/js"
cp artifacts/js-combined.json "$TMP_DIR/js"
pnpm --filter=jetpack-gh-config-munger exec nyc report --no-exclude-after-remap --report-dir="$TMP_DIR" --temp-dir="$TMP_DIR/js" --reporter=json-summary
jq -r 'to_entries[] | select( .key != "total" ) | [ .key, .value.lines.total, .value.lines.covered ] | @tsv' "$TMP_DIR/coverage-summary.json" > "$TMP_DIR/js-summary.tsv"
echo '::endgroup::'
TMP=$( find "$PWD/coverage" -name '*.json' )
if [[ -n "$TMP" ]]; then
echo "::group::Combining JS coverage"
pnpm --filter=jetpack-gh-config-munger exec istanbul-merge --out "$PWD"/artifacts/js-combined.json $TMP
perl -i -pwe 'BEGIN { $prefix = shift; $prefix=~s!/*$!/!; $re = qr/\Q$prefix\E/; } s!"$re!"!g' "$GITHUB_WORKSPACE" artifacts/js-combined.json
echo '::endgroup::'

echo "::group::Creating JS coverage summary"
mkdir "$TMP_DIR/js"
cp artifacts/js-combined.json "$TMP_DIR/js"
pnpm --filter=jetpack-gh-config-munger exec nyc report --no-exclude-after-remap --report-dir="$TMP_DIR" --temp-dir="$TMP_DIR/js" --reporter=json-summary
jq -r 'to_entries[] | select( .key != "total" ) | [ .key, .value.lines.total, .value.lines.covered ] | @tsv' "$TMP_DIR/coverage-summary.json" > "$TMP_DIR/js-summary.tsv"
echo '::endgroup::'
else
echo "No JS coverage files found!"
touch "$TMP_DIR/js-summary.tsv"
fi

echo "::group::Combining coverage summaries"
sort "$TMP_DIR/php-summary.tsv" "$TMP_DIR/js-summary.tsv" > artifacts/summary.tsv
Expand Down
19 changes: 4 additions & 15 deletions .github/files/generate-ci-matrix.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,29 +65,18 @@
'script' => 'test-php',
'php' => $php,
'wp' => 'latest',
'timeout' => 20, // 2023-08-17: Successful runs seem to take up to ~12 minutes.
'timeout' => 20, // 2024-11-12: Successful runs seem to take up to ~7 minutes.
);
}

// TODO: When WordPress 6.5 is no longer supported, this can be removed. Runs too slow on ubuntu-24.04 (ubuntu-latest).
$matrix[] = array(
'name' => 'PHP tests: PHP 7.0 WP previous',
'runner' => 'ubuntu-22.04',
'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(
'name' => "PHP tests: PHP {$phpver} WP $wp",
'script' => 'test-php',
'php' => $phpver,
'wp' => $wp,
'timeout' => 15, // 2021-01-18: Successful runs seem to take ~8 minutes for the 7.4 trunk run, ~5.5-6 for 7.x and 8.0.
'timeout' => 15, // 2024-11-12: Successful runs seem to take ~7 minutes with PHP 8.2.
);
}

Expand Down Expand Up @@ -115,15 +104,15 @@
$matrix[] = array(
'name' => 'JS tests',
'script' => 'test-js',
'timeout' => 15, // 2021-01-18: Successful runs seem to take ~5 minutes.
'timeout' => 15, // 2024-11-12: Successful runs seem to take ~5 minutes.
);

// Add Coverage tests.
$matrix[] = array(
'name' => 'Code coverage',
'script' => 'test-coverage',
'wp' => 'latest',
'timeout' => 40, // 2024-10-30: Successful runs seem to take ~30 minutes. We'll need to improve that.
'timeout' => 40, // 2024-11-12: Successful runs seem to take ~14 minutes.
);

// END matrix definitions.
Expand Down
3 changes: 0 additions & 3 deletions .github/files/phpcompatibility-dev-phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,5 @@
<rule ref="PHPCompatibilityWP">
<!-- Doesn't hurt anything, earlier versions ignore attributes. -->
<exclude name="PHPCompatibility.Attributes.NewAttributes.Found" />

<!-- We're not ready for 8.4 yet. Hopefully https://core.trac.wordpress.org/ticket/58719 will happen before we are. -->
<exclude name="PHPCompatibility.FunctionDeclarations.RemovedImplicitlyNullableParam.Deprecated" />
</rule>
</ruleset>
2 changes: 1 addition & 1 deletion .github/files/select-wordpress-tag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ case "$WP_BRANCH" in
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'
WORDPRESS_TAG=6.5
WORDPRESS_TAG=6.6
;;
*)
echo "Unrecognized value for WP_BRANCH: $WP_BRANCH" >&2
Expand Down
2 changes: 1 addition & 1 deletion .github/versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ NODE_VERSION=22.9.0
PNPM_VERSION=9.3.0

# Other useful version numbers.
MIN_PHP_VERSION=7.0
MIN_PHP_VERSION=7.2
MAX_PHP_VERSION=8.3
2 changes: 1 addition & 1 deletion .github/workflows/gardening.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
with:
# Split issues and issue_comment triggers from the rest. Otherwise a lot of issue work can result in pushes to trunk timing out.
events: ${{ ( github.event_name == 'issues' || github.event_name == 'issue_comment' ) && 'issues issue_comment' || '' }}
ignore-events: ${{ ( github.event_name == 'issues' || github.event_name == 'issue_comment' ) && '' || 'issues issue_comment' }}
ignore-events: ${{ ( github.event_name != 'issues' && github.event_name != 'issue_comment' ) && 'issues issue_comment' || '' }}

- name: "Run the action (assign, manage milestones, for issues and PRs)"
uses: ./projects/github-actions/repo-gardening
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: [ '7.0', '7.2', '7.4', '8.0', '8.1', '8.2', '8.3' ]
php-versions: [ '7.2', '7.4', '8.0', '8.1', '8.2', '8.3' ]
experimental: [ false ]

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ jobs:
- name: Process coverage results
env:
CHANGED: ${{ steps.changed.outputs.projects }}
if: matrix.script == 'test-coverage'
if: matrix.script == 'test-coverage' && always()
run: .github/files/coverage-munger/process-coverage.sh

- name: Check for artifacts
Expand Down
6 changes: 0 additions & 6 deletions .phan/config.base.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,5 @@ function make_phan_config( $dir, $options = array() ) {
$config['minimum_target_php_version'] = $m[1];
}

// Disable PhanDeprecatedImplicitNullableParam if still supporting PHP 7.0
// @todo Remove this once we drop PHP 7.0 support everywhere.
if ( isset( $config['minimum_target_php_version'] ) && version_compare( $config['minimum_target_php_version'], '7.1.0', '<' ) ) {
$config['suppress_issue_types'][] = 'PhanDeprecatedImplicitNullableParam';
}

return $config;
}
2 changes: 1 addition & 1 deletion .phan/stubs/amp-stubs.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Stubs automatically generated from AMP 2.5.4 and AMP for WP 1.0.99.1
* Stubs automatically generated from AMP 2.5.4 and AMP for WP 1.0.99.2
* using the definition file `tools/stubs/amp-stub-defs.php` in the Jetpack monorepo.
*
* Do not edit this directly! Run tools/stubs/update-stubs.sh to regenerate it.
Expand Down
2 changes: 1 addition & 1 deletion .phan/stubs/woocommerce-payments-stubs.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Stubs automatically generated from WooPayments 8.2.2
* Stubs automatically generated from WooPayments 8.4.0
* using the definition file `tools/stubs/woocommerce-payments-stub-defs.php` in the Jetpack monorepo.
*
* Do not edit this directly! Run tools/stubs/update-stubs.sh to regenerate it.
Expand Down
4 changes: 3 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 3c8fddd7c282f57efb896f1fc60bba6e2e6aea69.
* Stubs automatically generated from WordPress.com commit 18f60b6a23f80b9b8951920c646527604af34854.
*/

namespace {
\define('WPCOM_PERSONAL_BUNDLE', 1009);
\define('WPCOM_VALUE_BUNDLE', 1003);
\define('TRANSLATE_BLOG_ID', 101407);
/**
Expand Down Expand Up @@ -1236,6 +1237,7 @@ function has_any_blog_stickers(array $stickers, $_blog_id = \NULL, $bust_the_cac
}
class WPCOM_Feature_Flags
{
const GLOBAL_STYLES_ON_PERSONAL_PLAN = 'GLOBAL_STYLES_ON_PERSONAL_PLAN';
public static function get_features(): array
{
}
Expand Down
4 changes: 2 additions & 2 deletions .phpcs.config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<!-- 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.5" />
<config name="testVersion" value="7.0-"/>
<config name="minimum_supported_wp_version" value="6.6" />
<config name="testVersion" value="7.2-"/>

<!-- Use our custom filter for `.phpcsignore` and `.phpcs.dir.xml` support. -->
<arg name="filter" value="vendor/automattic/jetpack-phpcs-filter/src/PhpcsFilter.php" />
Expand Down
9 changes: 9 additions & 0 deletions .pnpmfile.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ function fixDeps( pkg ) {
}
}

// Unnecessarily explicit deps. I don't think we really even need @wordpress/babel-preset-default at all.
if ( pkg.name === '@wordpress/babel-preset-default' || pkg.name === '@wordpress/eslint-plugin' ) {
for ( const [ dep, ver ] of Object.entries( pkg.dependencies ) ) {
if ( dep.startsWith( '@babel/' ) && ! ver.startsWith( '^' ) && ! ver.startsWith( '>' ) ) {
pkg.dependencies[ dep ] = '^' + ver;
}
}
}

// Update localtunnel axios dep to avoid CVE
// https://github.com/localtunnel/localtunnel/issues/632
if ( pkg.name === 'localtunnel' && pkg.dependencies.axios === '0.21.4' ) {
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.5",
"php-stubs/wordpress-tests-stubs": ">=6.5",
"php-stubs/wordpress-stubs": ">=6.6",
"php-stubs/wordpress-tests-stubs": ">=6.6",
"php-stubs/wp-cli-stubs": "^2.10",
"sirbrillig/phpcs-changed": "^2.11.5",
"squizlabs/php_codesniffer": "^3.6.2"
Expand Down
Loading

0 comments on commit 879fdff

Please sign in to comment.