Skip to content

Add Plugin Check workflow and remove local plugin-check dependency#2320

Merged
westonruter merged 24 commits intotrunkfrom
add/plugin-check-workflow
Jan 7, 2026
Merged

Add Plugin Check workflow and remove local plugin-check dependency#2320
westonruter merged 24 commits intotrunkfrom
add/plugin-check-workflow

Conversation

@westonruter
Copy link
Copy Markdown
Member

@westonruter westonruter commented Jan 3, 2026

Summary

Closes #2257
Closes #2323

Provided by Gemini 3 in gemini-cli:

Port changes from WordPress/ai#139 to transition from the local wpackagist-plugin/plugin-check dependency to the official wordpress/plugin-check-action GitHub Action.

  • Add .github/workflows/plugin-check.yml.
  • Remove wpackagist-plugin/plugin-check from composer.json.
  • Remove related rules from tools/phpcs/phpcs.ruleset.xml.
  • Add PHPCS exclusion for object-cache.copy.php filename to allow drop-in naming.

Additionally, the plugins have been updated to address various issues that Plugin Check identified.

To do

Use of AI Tools

Given that I'm adapting a PR from the AI experiments plugin, it felt especially appropriate to use AI to prepare this PR. I used gemini-cli with these key prompts:

  • Take a look at the changes introduced in the WordPress AI Experiments plugin and implement the same changes here in the Performance Lab plugin: Use plugin-check GitHub workflow in favor of brittle plugin-check PHPCS checks ai#139
  • Changing "phpcompatibility/php-compatibility": "^9.3" to "phpcompatibility/phpcompatibility-wp": "^3.0.0-alpha" seems out of scope. I think that should be undone. The same goes for replacing PHPCompatibility with PHPCompatibilityWP in phpcs.ruleset.xml
  • The .github/workflows/plugin-check.yml isn't working right. It needs to run do the Run plugin check for each of the subdirectories inside of build not on the entire root directory.
  • There's a problem with .github/workflows/plugin-check.yml where it seems to be re-building all plugins multiple times and maybe even running composer install and npm ci. Should these be moved to steps under prepare-matrix?

I've provided attribution to the original authors of that AI Experiments PR via Co-authored-by trailers in the commit message. I've also prop'ed Gemini.

Port changes from WordPress/ai#139 to transition from the local
wpackagist-plugin/plugin-check dependency to the official
wordpress/plugin-check-action GitHub Action.

- Add .github/workflows/plugin-check.yml.
- Remove wpackagist-plugin/plugin-check from composer.json.
- Remove related rules from tools/phpcs/phpcs.ruleset.xml.
- Add PHPCS exclusion for object-cache.copy.php filename to allow drop-in naming.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: felixarntz <flixos90@git.wordpress.org>
Co-authored-by: JasonTheAdams <jason_the_adams@git.wordpress.org>
Co-authored-by: justlevine <justlevine@git.wordpress.org>
Co-authored-by: dkotter <dkotter@git.wordpress.org>
Co-authored-by: westonruter <westonruter@git.wordpress.org>
Co-authored-by: jeffpaul <jeffpaul@git.wordpress.org>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 3, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: westonruter <westonruter@git.wordpress.org>
Co-authored-by: swissspidy <swissspidy@git.wordpress.org>
Co-authored-by: felixarntz <flixos90@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@westonruter westonruter added no milestone PRs that do not have a defined milestone for release skip changelog PRs that should not be mentioned in changelogs [Type] Enhancement A suggestion for improvement of an existing feature labels Jan 3, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 3, 2026

Codecov Report

❌ Patch coverage is 26.66667% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.87%. Comparing base (1510693) to head (9c28ac2).
⚠️ Report is 25 commits behind head on trunk.

Files with missing lines Patch % Lines
plugins/view-transitions/uninstall.php 0.00% 3 Missing ⚠️
plugins/webp-uploads/uninstall.php 0.00% 3 Missing ⚠️
plugins/embed-optimizer/load.php 0.00% 2 Missing ⚠️
plugins/image-prioritizer/load.php 0.00% 2 Missing ⚠️
plugins/optimization-detective/load.php 0.00% 2 Missing ⚠️
...ce-lab/includes/site-health/avif-headers/hooks.php 0.00% 2 Missing ⚠️
...ce-lab/includes/site-health/avif-support/hooks.php 0.00% 2 Missing ⚠️
...ce-lab/includes/site-health/webp-support/hooks.php 0.00% 2 Missing ⚠️
plugins/optimization-detective/uninstall.php 80.00% 1 Missing ⚠️
plugins/performance-lab/includes/admin/load.php 0.00% 1 Missing ⚠️
... and 2 more
Additional details and impacted files
@@           Coverage Diff           @@
##            trunk    #2320   +/-   ##
=======================================
  Coverage   68.87%   68.87%           
=======================================
  Files          90       90           
  Lines        7618     7618           
=======================================
  Hits         5247     5247           
  Misses       2371     2371           
Flag Coverage Δ
multisite 68.87% <26.66%> (ø)
single 35.41% <3.33%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

westonruter and others added 3 commits January 2, 2026 16:13
This introduces a 'prepare-matrix' job to dynamically extract the list of plugins from 'plugins.json'. The 'plugin-check' job then uses this list to run checks in parallel via a matrix strategy, building and checking each plugin separately from its own directory in 'build/'.

This fixes an issue where the check was being run on the entire root directory instead of the specific plugin build artifacts.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@westonruter
Copy link
Copy Markdown
Member Author

It doesn't seem that the plugin-check action is set up to work in a monorepo of multiple plugins.

Specifically the last step of the action is:

    - name: Upload artifact
      uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
      if: ${{ always() }}
      with:
        name: plugin-check-results
        path: ${{ runner.temp }}/plugin-check-results.txt
        if-no-files-found: ignore

This is causing problems when plugin-check is running in parallel for multiple plugins. Most of the jobs fail here with:

Error: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run

For the last job in the matrix, it succeeds with:

Beginning upload of artifact content to blob storage
Uploaded bytes 725
Finished uploading artifact content to blob storage!
SHA256 digest of uploaded artifact zip is a2c7f351e3461aa88eb08f62be32cc322274e3f8a8956c52e0be3c19ff9cdd89
Finalizing artifact upload
Artifact plugin-check-results.zip successfully finalized. Artifact ID 5011597738
Artifact plugin-check-results has been successfully uploaded! Final size is 725 bytes. Artifact ID is 5011597738
Artifact download URL: https://github.com/WordPress/performance/actions/runs/20669373255/artifacts/5011597738

It seems like the slug should be incorporated into the name? So like:

-         name: plugin-check-results
+         name: plugin-check-results${{ inputs.slug ? '-' + inputs.slug : '' }}

@westonruter westonruter marked this pull request as draft January 3, 2026 00:41
westonruter and others added 2 commits January 2, 2026 18:05
Move the dependency installation and build process to the preparatory job and share the results via artifacts. This avoids redundant `npm ci` and build steps for every plugin in the matrix, significantly reducing workflow execution time and resource usage.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@felixarntz
Copy link
Copy Markdown
Member

felixarntz commented Jan 7, 2026

Maybe @swissspidy you can advise here since you implemented the GitHub action?

@westonruter westonruter marked this pull request as ready for review January 7, 2026 17:40
@westonruter
Copy link
Copy Markdown
Member Author

Yay! The Plugin Check jobs are now all passing. 🎉

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR transitions from using a local wpackagist-plugin/plugin-check dependency to the official wordpress/plugin-check-action GitHub Action. This change resolves issues with Plugin Check 1.7.0+ compatibility and modernizes the plugin checking workflow.

Key Changes:

  • Added a new Plugin Check GitHub Actions workflow that builds plugins and runs checks in a matrix strategy
  • Removed the wpackagist-plugin/plugin-check Composer dependency and related PHPCS rules
  • Updated multiple plugins to address Plugin Check compliance issues including function prefixing, ABSPATH guards, and PHPCS annotations

Reviewed changes

Copilot reviewed 26 out of 27 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
.github/workflows/plugin-check.yml New workflow that builds plugins and runs Plugin Check action for each plugin in a matrix
.github/workflows/deploy-plugins.yml Updated artifact download action version comment from v5 to v7.0.0
composer.json Removed wpackagist-plugin/plugin-check dependency and related repository configuration
composer.lock Removed composer/installers and plugin-check package entries
tools/phpcs/phpcs.ruleset.xml Removed Plugin Check PHPCS rule references and added exclusion for object-cache.copy.php filename
plugins/webp-uploads/uninstall.php Refactored multisite cleanup to use array_map instead of foreach
plugins/webp-uploads/picture-element.php Added ABSPATH security guard
plugins/webp-uploads/image-edit.php Added PHPCS ignore comment for core filter usage
plugins/view-transitions/uninstall.php Refactored multisite cleanup to use array_map instead of foreach
plugins/speculation-rules/uninstall.php Refactored multisite cleanup to use array_map instead of foreach
plugins/speculation-rules/load.php Added PHPCS ignore comments for prefixed global variables
plugins/performance-lab/includes/site-health/webp-support/hooks.php Renamed function to add perflab_ prefix
plugins/performance-lab/includes/site-health/webp-support/helper.php Renamed function to add perflab_ prefix
plugins/performance-lab/includes/site-health/avif-support/hooks.php Renamed function to add perflab_ prefix
plugins/performance-lab/includes/site-health/avif-support/helper.php Renamed function to add perflab_ prefix
plugins/performance-lab/includes/site-health/avif-headers/hooks.php Renamed function to add perflab_ prefix
plugins/performance-lab/includes/site-health/avif-headers/helper.php Renamed functions to add perflab_ prefix
plugins/performance-lab/includes/server-timing/class-perflab-server-timing.php Added ABSPATH security guard
plugins/performance-lab/includes/admin/plugins.php Added PHPCS ignore comment for core filter usage
plugins/performance-lab/includes/admin/load.php Added PHPCS ignore comment for core filter usage
plugins/optimization-detective/uninstall.php Renamed variables to add od_ prefix for global scope clarity
plugins/optimization-detective/readme.txt Updated stable tag version
plugins/optimization-detective/load.php Added PHPCS ignore comments for prefixed global variables
plugins/image-prioritizer/load.php Added PHPCS ignore comments for prefixed global variables
plugins/embed-optimizer/load.php Added PHPCS ignore comments for prefixed global variables
plugins/dominant-color-images/helper.php Added ABSPATH security guard
plugins/auto-sizes/includes/improve-calculate-sizes.php Added ABSPATH security guard

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

westonruter and others added 2 commits January 7, 2026 09:56
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 26 out of 27 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@westonruter westonruter merged commit 6837f4a into trunk Jan 7, 2026
30 checks passed
@westonruter westonruter deleted the add/plugin-check-workflow branch January 7, 2026 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked no milestone PRs that do not have a defined milestone for release skip changelog PRs that should not be mentioned in changelogs [Type] Enhancement A suggestion for improvement of an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants