Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge trunk into auto-sizes #970

Merged
merged 109 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
4f02311
Run PHP unit tests in different versions of PHP
mukeshpanchal27 Sep 23, 2022
c3898bd
Use LOCAL_PHP
mukeshpanchal27 Sep 23, 2022
ebbc526
Update ENV
mukeshpanchal27 Sep 23, 2022
734f83a
Add composer update
mukeshpanchal27 Dec 9, 2022
25921be
Update php-test.yml
mukeshpanchal27 Dec 9, 2022
27f44f6
Merge branch 'trunk' into fix/399-unit-tests-in-php-versions
mukeshpanchal27 Dec 19, 2022
fef535d
Update package.json
mukeshpanchal27 Dec 19, 2022
fb2784f
Merge branch 'trunk' into fix/399-unit-tests-in-php-versions
spacedmonkey Jun 20, 2023
e8b0fa6
Merge branch 'trunk' into fix/399-unit-tests-in-php-versions
mukeshpanchal27 Aug 21, 2023
3a4327e
Merge branch 'trunk' into fix/399-unit-tests-in-php-versions
swissspidy Nov 14, 2023
df016d7
Update matrix
swissspidy Nov 14, 2023
cf83b3b
Merge branch 'trunk' into fix/399-unit-tests-in-php-versions
swissspidy Nov 14, 2023
e8f396d
Remove php 8.3 again
swissspidy Nov 14, 2023
9c13137
Do not test svg upload
swissspidy Nov 27, 2023
48be5bd
Make expected color tests a bit more robust
swissspidy Nov 27, 2023
41d9e80
Add another expected color
swissspidy Nov 27, 2023
b55e06a
Merge branch 'trunk' into fix/399-unit-tests-in-php-versions
swissspidy Dec 5, 2023
b58b08f
Revert "Remove php 8.3 again"
swissspidy Dec 5, 2023
ad1ea1d
Update wp-env and update deps before tests
swissspidy Dec 6, 2023
0b22540
Composer update
swissspidy Dec 6, 2023
c913913
Improve assertions to make tests a bit more robust
swissspidy Dec 6, 2023
fe1ba5b
Split out phpstan into its own composer.json
swissspidy Dec 6, 2023
f214c69
Split out PHPCS as well
swissspidy Dec 6, 2023
65f15b0
Skip tests if extension is missing
swissspidy Dec 7, 2023
96e63dc
Fix typo in class name
swissspidy Dec 7, 2023
68cf970
Add same checks to GD tests
swissspidy Dec 7, 2023
105c1be
Fix construction of translation strings
westonruter Jan 9, 2024
a4180a2
Prevent sending header during test
westonruter Jan 10, 2024
deb090f
Merge pull request #925 from WordPress/fix/translation-string-constru…
felixarntz Jan 10, 2024
4d8989b
Fix plugin deactivation link color.
felixarntz Jan 10, 2024
c76729f
Include missing jQuery dependency.
felixarntz Jan 10, 2024
04ef610
Merge pull request #928 from WordPress/fix/missing-jquery-dependency
felixarntz Jan 10, 2024
82d8b0e
Cherry pick fixes to JS linting from feature/image-loading-optimization
westonruter Jan 10, 2024
c5d4abe
Run format-js on JS files
westonruter Jan 10, 2024
d3a0659
Remove modules/images/webp-uploads/fallback.js from ignorePatterns
westonruter Jan 10, 2024
beb9374
Fix or ignore eslint rules
westonruter Jan 10, 2024
75af59e
Remove scheduler from globals since not yet used
westonruter Jan 10, 2024
a36f6b1
Escape URL to deactivate plugin.
felixarntz Jan 11, 2024
de65940
Merge pull request #930 from WordPress/fix/js-linting
felixarntz Jan 11, 2024
d0ee705
Merge pull request #927 from WordPress/fix/plugin-deactivate-link-color
felixarntz Jan 11, 2024
d4cd401
Merge pull request #926 from WordPress/fix/headers-sent-during-testing
mukeshpanchal27 Jan 11, 2024
461ca6b
Fix PHPStan errors in tests
westonruter Jan 11, 2024
5c009ba
Run composer update
westonruter Jan 11, 2024
c5053f1
Re-run composer update with PHP 8.1
westonruter Jan 12, 2024
e1c05c7
Merge pull request #932 from WordPress/fix/phpstan-errors
mukeshpanchal27 Jan 12, 2024
eebb6b1
Bump version number.
felixarntz Jan 16, 2024
f005a13
Update readme.
felixarntz Jan 16, 2024
c68ca52
Remove unnecessary changelog entry.
felixarntz Jan 16, 2024
135e93f
Merge pull request #941 from WordPress/publish/2.8.0
felixarntz Jan 16, 2024
9d2b238
Merge pull request #942 from WordPress/release/2.8.0
felixarntz Jan 16, 2024
ff92e78
Fix weird user experience
mukeshpanchal27 Jan 17, 2024
e694fc0
late escaping
mukeshpanchal27 Jan 17, 2024
e973fcc
Update variable
mukeshpanchal27 Jan 17, 2024
6743ca1
Remove unuse variable
mukeshpanchal27 Jan 17, 2024
fd23971
Merge pull request #944 from WordPress/fix/943-weird-user-experience
felixarntz Jan 17, 2024
c52d759
Include standalone plugin slugs in generator tag.
felixarntz Jan 18, 2024
ccf3220
Update additional test.
felixarntz Jan 18, 2024
62b8937
Merge branch 'trunk' into fix/399-unit-tests-in-php-versions
swissspidy Jan 22, 2024
ead22c8
Use more precise type doc.
felixarntz Jan 22, 2024
8181c68
Introduce new function instead of trying to reuse old one, and add mo…
felixarntz Jan 23, 2024
7145497
Remove hardcoded `phpVersion`
swissspidy Jan 23, 2024
baf7ce3
Temp: Remove filter and adjust test
mukeshpanchal27 Jan 23, 2024
533e371
Correct Dominant Color tests
mukeshpanchal27 Jan 24, 2024
e2872b8
Add color option for PHP7.2
mukeshpanchal27 Jan 24, 2024
705add6
Skip WebP tests if there is no WebP support
swissspidy Jan 24, 2024
bd54d04
Update more tests
swissspidy Jan 24, 2024
b664cae
Use matrix for standalone plugin tests
swissspidy Jan 24, 2024
9e7dc5b
Update configs
swissspidy Jan 24, 2024
901a62e
Replace n.e.x.t with 2.9.0.
felixarntz Jan 24, 2024
0e7f285
Merge pull request #949 from WordPress/add/standalone-plugin-generato…
felixarntz Jan 24, 2024
a3044dd
Skip unsupported WebP tests
mukeshpanchal27 Jan 25, 2024
7449075
Fix test-plugins command
mukeshpanchal27 Jan 25, 2024
879647b
Add error log
mukeshpanchal27 Jan 25, 2024
55ab81f
Merge branch 'trunk' into fix/399-unit-tests-in-php-versions
swissspidy Jan 25, 2024
5bed5a9
Composer update before running plugin tests
swissspidy Jan 25, 2024
7d560ae
Move script to test-plugins.js
swissspidy Jan 25, 2024
18dfefa
Move step
swissspidy Jan 25, 2024
6324c63
Adjust step for composer update
mukeshpanchal27 Jan 26, 2024
20155d5
Add missing php setup step in workflow
mukeshpanchal27 Jan 26, 2024
99f4262
Sanitize slashes for `Server-Timing` header
swissspidy Jan 29, 2024
1819c2b
Lint fix
swissspidy Jan 29, 2024
00efe96
Move to `format_metric_header_value` actually
swissspidy Jan 29, 2024
cd7a746
Add standalone plugin version constants for auto-sizes and speculatio…
westonruter Jan 29, 2024
f1aac48
Update server-timing/class-perflab-server-timing.php
swissspidy Jan 29, 2024
fc9ddfb
Merge pull request #544 from WordPress/fix/399-unit-tests-in-php-vers…
swissspidy Jan 29, 2024
3a366e3
Merge pull request #957 from WordPress/fix/955-slashes
swissspidy Jan 29, 2024
4396a84
Merge pull request #958 from WordPress/add/standalone-plugin-version-…
swissspidy Jan 29, 2024
36b9d57
Run build-cs composer install/update via post-install/update-cmd scripts
westonruter Jan 30, 2024
3df9c5d
Only run composer install/update for build-cs in PHP 8+
westonruter Jan 30, 2024
2591052
Remove redundant composer install/update
westonruter Jan 31, 2024
cfd3276
Align workflows for testing and use composer install in php-test
westonruter Jan 31, 2024
e7c31a7
Revert "Align workflows for testing and use composer install in php-t…
westonruter Jan 31, 2024
1783ec2
Run composer install in container for php-test workflow
westonruter Jan 31, 2024
9e926dd
Fix passing --env-cwd arg by preceding with --
westonruter Jan 31, 2024
a67bfcd
Use double quotes for string interpolation
westonruter Jan 31, 2024
776ea67
Run composer update instead of composer install
westonruter Jan 31, 2024
36fe543
Add note explaining why composer update is used
westonruter Jan 31, 2024
260e22e
Dump current PHP version when bailing to install/update for build-cs
westonruter Jan 31, 2024
1193606
Use better PHP version comparison to bail if less than 8.1
westonruter Jan 31, 2024
aad3002
Add missing period and indicate at least PHP 8.1
westonruter Jan 31, 2024
a4a8060
Merge pull request #962 from WordPress/fix/lint-staged
swissspidy Feb 1, 2024
7142b0e
Introduce Props Bot workflow.
aaronjorbin Feb 1, 2024
4be732e
Merge pull request #964 from WordPress/add/props-bot-action
westonruter Feb 1, 2024
dc33992
Replace leafs with leaves to appease Spell Check with Typos workflow
westonruter Feb 1, 2024
4a95c47
Merge pull request #965 from WordPress/fix/leafs-typo
mukeshpanchal27 Feb 2, 2024
83e754d
Improve conditions Props Bot runs under.
desrosj Feb 2, 2024
537d482
Update test to use non-AVIF format since now supported
westonruter Feb 2, 2024
6b3494c
Merge pull request #966 from WordPress/improve/props-bot
westonruter Feb 2, 2024
9cc0c2f
Merge pull request #967 from WordPress/fix/tests-for-wp65
westonruter Feb 2, 2024
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
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ const config = {
...( wpConfig?.rules || {} ),
'jsdoc/valid-types': 'off',
},
env: {
browser: true,
},
ignorePatterns: [ '/vendor', '/node_modules' ],
};

module.exports = config;
22 changes: 22 additions & 0 deletions .github/workflows/php-test-standalone-plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,38 @@ jobs:
name: PHP Integration Tests for Standalone Plugins
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
php: [ '8.2', '8.1', '8.0', '7.4', '7.3', '7.2', '7.1', '7.0' ]
wp: [ 'latest' ]
include:
- php: '7.4'
wp: '6.3'
- php: '8.3'
wp: 'trunk'
env:
WP_ENV_PHP_VERSION: ${{ matrix.php }}
WP_ENV_CORE: ${{ matrix.wp == 'trunk' && 'WordPress/WordPress' || format( 'https://wordpress.org/wordpress-{0}.zip', matrix.wp ) }}
steps:
- uses: styfle/[email protected]
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Setup Node.js (.nvmrc)
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: npm
- name: npm install
run: npm ci
- name: General debug information
run: |
npm --version
node --version
composer --version
php -v
- name: Building standalone plugins
run: npm run build-plugins
- name: Running single site standalone plugin integration tests
Expand Down
20 changes: 19 additions & 1 deletion .github/workflows/php-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,22 @@ on:

jobs:
php-test:
name: PHP
name: "PHP ${{ matrix.php }} / WP ${{ matrix.wp }}"
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
php: ['8.2', '8.1', '8.0', '7.4', '7.3', '7.2', '7.1', '7.0']
wp: [ 'latest' ]
include:
- php: '7.4'
wp: '6.3'
- php: '8.3'
wp: 'trunk'
env:
WP_ENV_PHP_VERSION: ${{ matrix.php }}
WP_ENV_CORE: ${{ matrix.wp == 'trunk' && 'WordPress/WordPress' || format( 'https://wordpress.org/wordpress-{0}.zip', matrix.wp ) }}
steps:
- uses: styfle/[email protected]
- uses: actions/checkout@v3
Expand All @@ -54,6 +67,11 @@ jobs:
run: npm ci
- name: Install WordPress
run: npm run wp-env start
# Note that `composer update` is required instead of `composer install`
# for the sake of PHP versions older than 8.1, which is the version of
# PHP that the composer.lock was created for.
- name: Composer update
run: npm run wp-env run tests-cli -- --env-cwd="wp-content/plugins/$(basename $(pwd))" composer update --no-interaction
- name: Running single site unit tests
run: npm run test-php
- name: Running multisite unit tests
Expand Down
88 changes: 88 additions & 0 deletions .github/workflows/props-bot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Props Bot

on:
# This event runs anytime a PR is (re)opened, updated, marked ready for review, or labeled.
# GitHub does not allow filtering the `labeled` event by a specific label.
# However, the logic below will short-circuit the workflow when the `props-bot` label is not the one being added.
# Note: The pull_request_target event is used instead of pull_request because this workflow needs permission to comment
# on the pull request. Because this event grants extra permissions to `GITHUB_TOKEN`, any code changes within the PR
# should be considered untrusted. See https://securitylab.github.com/research/github-actions-preventing-pwn-requests/.
pull_request_target:
types:
- opened
- synchronize
- reopened
- labeled
- ready_for_review
# This event runs anytime a comment is added or deleted.
# You cannot filter this event for PR comments only.
# However, the logic below does short-circuit the workflow for issues.
issue_comment:
type:
- created
# This event will run everytime a new PR review is initially submitted.
pull_request_review:
types:
- submitted
# This event runs anytime a PR review comment is created or deleted.
pull_request_review_comment:
types:
- created

# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ contains( fromJSON( '["pull_request_target", "pull_request_review", "pull_request_review_comment"]' ), github.event_name ) && github.head_ref || github.sha }}
cancel-in-progress: true

# Disable permissions for all available scopes by default.
# Any needed permissions should be configured at the job level.
permissions: {}

jobs:
# Compiles a list of props for a pull request.
#
# Performs the following steps:
# - Collects a list of contributor props and leaves a comment.
# - Removes the props-bot label, if necessary.
props-bot:
name: Generate a list of props
runs-on: ubuntu-latest
permissions:
# The action needs permission `write` permission for PRs in order to add a comment.
pull-requests: write
contents: read
timeout-minutes: 20
# The job will run when pull requests are open, ready for review and:
#
# - A comment is added to the pull request.
# - A review is created or commented on.
# - The pull request is opened, synchronized, marked ready for review, or reopened.
# - The `props-bot` label is added to the pull request.
if: |
(
github.event_name == 'issue_comment' && github.event.issue.pull_request ||
contains( fromJSON( '["pull_request_review", "pull_request_review_comment"]' ), github.event_name ) ||
github.event_name == 'pull_request_target' && github.event.action != 'labeled' ||
'props-bot' == github.event.label.name
) &&
( ! github.event.pull_request.draft && github.event.pull_request.state == 'open' || ! github.event.issue.draft && github.event.issue.state == 'open' )

steps:
- name: Gather a list of contributors
uses: WordPress/props-bot-action@trunk

- name: Remove the props-bot label
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
if: ${{ github.event.action == 'labeled' && 'props-bot' == github.event.label.name }}
with:
retries: 2
retry-exempt-status-codes: 418
script: |
github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: '${{ github.event.number }}',
name: 'props-bot'
});
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ nbproject/

build
.wp-env.override.json
build-cs/vendor/
build-cs/composer.lock

############
## Vendor
Expand Down
3 changes: 1 addition & 2 deletions .wp-env.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"tests": {
"config": {
"FS_METHOD": "direct"
},
"phpVersion": "7.4"
}
}
}
}
8 changes: 7 additions & 1 deletion admin/js/perflab-module-migration-notice.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* eslint camelcase: "off", no-alert: "off" */
/* global perflab_module_migration_notice:false */

( function ( document ) {
document.addEventListener( 'DOMContentLoaded', function () {
document.addEventListener( 'click', function ( event ) {
Expand Down Expand Up @@ -26,7 +29,10 @@
.then( function ( response ) {
if ( ! response.ok ) {
throw new Error(
wp.i18n.__( 'Network response was not ok.', 'performance-lab' )
wp.i18n.__(
'Network response was not ok.',
'performance-lab'
)
);
}
return response.json();
Expand Down
23 changes: 17 additions & 6 deletions admin/js/perflab-plugin-management.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
/* eslint no-var: "off", camelcase: "off" */
/* global jQuery:false */

( function ( $, document ) {
$( document ).ajaxComplete( function( event, xhr, settings ) {
$( document ).ajaxComplete( function ( event, xhr, settings ) {
// Check if this is the 'install-plugin' request.
if ( settings.data && typeof settings.data === 'string' && settings.data.includes( 'action=install-plugin' ) ) {
if (
settings.data &&
typeof settings.data === 'string' &&
settings.data.includes( 'action=install-plugin' )
) {
var params = new URLSearchParams( settings.data );
var slug = params.get('slug');
var slug = params.get( 'slug' );

// Check if 'slug' was found and output the value.
if ( ! slug ) {
return;
}

var target_element = $( '.wpp-standalone-plugins a[data-slug="' + slug + '"]' );
var target_element = $(
'.wpp-standalone-plugins a[data-slug="' + slug + '"]'
);
if ( ! target_element ) {
return;
}
Expand All @@ -20,12 +29,14 @@
* so we set a 1.5 timeout here to ensure our changes get updated after
* the core changes have taken place.
*/
setTimeout( function() {
setTimeout( function () {
var plugin_url = target_element.attr( 'href' );
if ( ! plugin_url ) {
return;
}
var nonce = target_element.attr( 'data-plugin-activation-nonce' );
var nonce = target_element.attr(
'data-plugin-activation-nonce'
);
var plugin_slug = target_element.attr( 'data-slug' );
var url = new URL( plugin_url );
url.searchParams.set( 'action', 'perflab_activate_plugin' );
Expand Down
Loading
Loading