Skip to content

Commit d8b0cba

Browse files
westonrutergemini-code-assist[bot]felixarntzJasonTheAdamsjustlevine
committed
Add Plugin Check workflow and remove local plugin-check dependency
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>
1 parent a512d98 commit d8b0cba

File tree

4 files changed

+78
-189
lines changed

4 files changed

+78
-189
lines changed

.github/workflows/plugin-check.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Plugin Check
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- develop
8+
- trunk
9+
pull_request:
10+
types:
11+
- opened
12+
- synchronize
13+
- ready_for_review
14+
15+
# Cancels all previous workflow runs for pull requests that have not completed.
16+
concurrency:
17+
# The concurrency group contains the workflow name and the branch name for pull requests
18+
# or the commit hash for any other events.
19+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
20+
cancel-in-progress: true
21+
22+
# Disable permissions for all available scopes by default.
23+
# Any needed permissions should be configured at the job level.
24+
permissions: {}
25+
26+
jobs:
27+
plugin-check:
28+
name: PHP ${{ matrix.php }} - WP ${{ matrix.wordpress }}
29+
runs-on: 'ubuntu-24.04'
30+
permissions:
31+
contents: read
32+
timeout-minutes: 20
33+
strategy:
34+
fail-fast: true
35+
matrix:
36+
php:
37+
- '8.3' # Currently the wordpress/plugin-check-action always uses the latest PHP version anyway.
38+
wordpress: ['latest'] # Currently the wordpress/plugin-check-action only supports 'latest' or 'trunk'.
39+
steps:
40+
- uses: actions/checkout@v4
41+
42+
- uses: shivammathur/setup-php@v2
43+
with:
44+
php-version: ${{ matrix.php }}
45+
46+
- name: Install Composer dependencies
47+
run: composer install
48+
49+
- name: Setup Node.js (.nvmrc)
50+
uses: actions/setup-node@v4
51+
with:
52+
node-version-file: '.nvmrc'
53+
cache: npm
54+
55+
- name: npm install
56+
run: npm ci
57+
58+
- name: Build assets
59+
run: npm run build
60+
61+
- name: Run plugin check
62+
uses: wordpress/plugin-check-action@v1
63+
with:
64+
wp-version: ${{ matrix.wordpress }}
65+
# Exclude file_type because of the dev files present in the repository.
66+
exclude-checks: |
67+
file_type
68+
exclude-directories: |
69+
.github
70+
docs
71+
tests

composer.json

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,7 @@
2020
"ext-gd": "Required to use Modern Image Format's Dominant_Color_Image_Editor_GD class",
2121
"ext-zlib": "Required for compression of URL Metric data submitted to the REST API for storage in Optimization Detective"
2222
},
23-
"repositories":[
24-
{
25-
"type":"composer",
26-
"url":"https://wpackagist.org",
27-
"only": [
28-
"wpackagist-plugin/*",
29-
"wpackagist-theme/*"
30-
]
31-
}
32-
],
3323
"extra": {
34-
"installer-paths": {
35-
"vendor/{$vendor}/{$name}/": [
36-
"wpackagist-plugin/plugin-check"
37-
]
38-
}
3924
},
4025
"require-dev": {
4126
"phpcompatibility/php-compatibility": "^9.3",
@@ -50,8 +35,7 @@
5035
"wp-phpunit/wp-phpunit": "^6.5",
5136
"yoast/phpunit-polyfills": "^4.0",
5237
"phpstan/php-8-stubs": "^0.4.0",
53-
"phpstan/phpstan-strict-rules": "^1.6",
54-
"wpackagist-plugin/plugin-check": "^1.6"
38+
"phpstan/phpstan-strict-rules": "^1.6"
5539
},
5640
"config": {
5741
"allow-plugins": {

composer.lock

Lines changed: 2 additions & 166 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tools/phpcs/phpcs.ruleset.xml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
<ruleset name="WPP-Base" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
33
<description>Sniffs for WordPress plugins</description>
44

5-
<rule ref="../../vendor/wpackagist-plugin/plugin-check/vendor/plugin-check/phpcs-sniffs/PluginCheck/ruleset.xml" />
6-
<rule ref="../../vendor/wpackagist-plugin/plugin-check/phpcs-rulesets/plugin-check.ruleset.xml"/>
7-
85
<rule ref="PHPCompatibility"/>
96
<config name="testVersion" value="7.2-"/>
107

@@ -73,6 +70,10 @@
7370
<exclude-pattern>./plugins/*/tests/**</exclude-pattern>
7471
</rule>
7572

73+
<rule ref="WordPress.Files.FileName.NotHyphenatedLowercase">
74+
<exclude-pattern>plugins/performance-lab/includes/server-timing/object-cache.copy.php</exclude-pattern>
75+
</rule>
76+
7677
<!-- Exceptions for variable name casing. -->
7778
<rule ref="WordPress.NamingConventions.ValidVariableName">
7879
<properties>
@@ -122,9 +123,6 @@
122123
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingTraversableTypeHintSpecification" /><!-- TODO: Investigate this -->
123124
</rule>
124125

125-
<rule ref="PluginCheck.CodeAnalysis.Offloading.OffloadedContent">
126-
<exclude-pattern>./plugins/*/tests/**</exclude-pattern>
127-
</rule>
128126
<rule ref="Squiz.PHP.DiscouragedFunctions.Discouraged">
129127
<exclude-pattern>./plugins/*/tests/**</exclude-pattern>
130128
</rule>

0 commit comments

Comments
 (0)