Skip to content

Commit f1c8c3e

Browse files
authored
Merge branch 'main' into fix/undefined-language-property
2 parents 5b1b51f + 90caba9 commit f1c8c3e

10 files changed

Lines changed: 198 additions & 68 deletions

‎.github/actionlint.yml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,12 @@ paths:
1111
# catching genuine typos in permission names.
1212
# See https://docs.github.com/en/copilot/how-tos/copilot-cli/use-copilot-cli-in-actions
1313
- 'unknown permission scope "copilot-requests"'
14+
# Steps can run in parallel through the `background`, `wait`, `wait-all`,
15+
# `cancel` and `parallel` keywords, but actionlint does not know them yet:
16+
# it rejects `background` as an unexpected key, and a `wait-all` or
17+
# `parallel` step as one that has neither `run` nor `uses`. Drop these
18+
# entries once actionlint supports the keywords. Until then, a step that is
19+
# genuinely missing both `run` and `uses` is no longer reported.
20+
# See https://docs.github.com/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsparallel
21+
- 'unexpected key "background" for step'
22+
- 'step must run script with "run" section or run action with "uses" section'

‎.github/dependabot.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ updates:
99
- scope:distribution
1010
cooldown:
1111
default-days: 7
12+
# Packages from our own org are trusted, so they are updated immediately.
13+
exclude:
14+
- "wp-cli/*"
1215
# Only wp-cli-tests carries a package.json, holding the pinned version of the
1316
# Gherkin linter. This is a no-op in every other repository.
1417
- package-ecosystem: npm

‎.github/workflows/copilot-setup-steps.yml‎

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,40 +39,44 @@ jobs:
3939
id: check_composer_file
4040
run: echo "files_exists=$(test -f composer.json && echo true || echo false)" >> "$GITHUB_OUTPUT"
4141

42-
- name: Set up PHP environment
43-
if: steps.check_composer_file.outputs.files_exists == 'true'
44-
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
45-
with:
46-
php-version: 'latest'
47-
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
48-
coverage: 'none'
49-
tools: composer,cs2pr
50-
env:
51-
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52-
53-
- name: Install Composer dependencies & cache dependencies
54-
if: steps.check_composer_file.outputs.files_exists == 'true'
55-
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
56-
env:
57-
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
58-
5942
# Without a database the Behat runner silently falls back to SQLite, so the
6043
# agent's test runs are not the ones CI will do. Mirrors the setup in
6144
# reusable-functional.yml.
6245
- name: Check existence of behat.yml file
6346
id: check_behat_file
6447
run: echo "files_exists=$(test -f behat.yml && echo true || echo false)" >> "$GITHUB_OUTPUT"
6548

49+
# Not run in the background: Copilot code review builds its workflow from
50+
# these steps and failed validation while they used `background` and
51+
# `wait-all`. Also, the action unpacks its binaries with the system `tar`,
52+
# which fails to load libpcre2 while setup-php upgrades it with apt.
6653
- name: Setup MySQL Server
6754
if: steps.check_behat_file.outputs.files_exists == 'true'
68-
uses: shogo82148/actions-setup-mysql@62da9377d83991fce27b6ed2a397d3306121e41d # v1
55+
uses: shogo82148/actions-setup-mysql@13a38f2af408e58a0c80168fc620a63a15357339 # v1
6956
with:
7057
mysql-version: '8.0' # Standard MySQL version for these tests
7158
auto-start: true
7259
root-password: ${{ env.WP_CLI_TEST_DBROOTPASS }}
7360
user: ${{ env.WP_CLI_TEST_DBUSER }}
7461
password: ${{ env.WP_CLI_TEST_DBPASS }}
7562

63+
- name: Set up PHP environment
64+
if: steps.check_composer_file.outputs.files_exists == 'true'
65+
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # v2
66+
with:
67+
php-version: 'latest'
68+
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
69+
coverage: 'none'
70+
tools: composer,cs2pr
71+
env:
72+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
74+
- name: Install Composer dependencies & cache dependencies
75+
if: steps.check_composer_file.outputs.files_exists == 'true'
76+
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
77+
env:
78+
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
79+
7680
- name: Remove system MySQL binary
7781
if: steps.check_behat_file.outputs.files_exists == 'true'
7882
run: sudo rm -f /usr/bin/mysql /usr/bin/mysqldump
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Milestone Merged Pull Requests
3+
4+
'on':
5+
pull_request_target:
6+
types: [closed]
7+
branches:
8+
- main
9+
- master
10+
11+
permissions:
12+
issues: write
13+
pull-requests: write
14+
15+
jobs:
16+
milestone:
17+
uses: wp-cli/.github/.github/workflows/reusable-milestone-merged-prs.yml@main

‎AGENTS.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
This package is part of WP-CLI, the official command line interface for WordPress. For a detailed explanation of the project structure and development workflow, please refer to the main @README.md file.
44

5+
If the repository contains an @AGENTS.local.md file, read it as well. It holds instructions specific to this repository and takes precedence over this file where the two disagree.
6+
57
## Best Practices for Code Contributions
68

79
When contributing to this package, please adhere to the following guidelines:

‎composer.json‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"wp-cli/db-command": "^1.3 || ^2 || ^3",
1919
"wp-cli/entity-command": "^1.3 || ^2 || ^3",
2020
"wp-cli/extension-command": "^1.2 || ^2 || ^3",
21-
"wp-cli/wp-cli-tests": "^5"
21+
"wp-cli/wp-cli-tests": "^5.4.0"
2222
},
2323
"config": {
2424
"process-timeout": 7200,
@@ -73,13 +73,15 @@
7373
"behat": "run-behat-tests",
7474
"behat-rerun": "rerun-behat-tests",
7575
"lint": "run-linter-tests",
76+
"lint-gherkin": "run-gherkin-lint-tests",
7677
"phpcs": "run-phpcs-tests",
7778
"phpstan": "run-phpstan-tests",
7879
"phpcbf": "run-phpcbf-cleanup",
7980
"phpunit": "run-php-unit-tests",
8081
"prepare-tests": "install-package-tests",
8182
"test": [
8283
"@lint",
84+
"@lint-gherkin",
8385
"@phpcs",
8486
"@phpstan",
8587
"@phpunit",

‎features/language-core.feature‎

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,36 @@ Feature: Manage core translation files for a WordPress install
220220
"""
221221
And the return code should be 0
222222

223+
@require-wp-4.0
224+
Scenario: Use cached language file when available
225+
Given a WP install
226+
And an empty cache
227+
228+
When I run `wp language core install en_GB`
229+
Then STDOUT should contain:
230+
"""
231+
Success: Installed 1 of 1 languages.
232+
"""
233+
And STDERR should be empty
234+
235+
When I run `wp language core uninstall en_GB`
236+
Then STDOUT should be:
237+
"""
238+
Success: Language uninstalled.
239+
"""
240+
And STDERR should be empty
241+
242+
When I run `wp language core install en_GB`
243+
Then STDOUT should contain:
244+
"""
245+
Using cached file
246+
"""
247+
And STDOUT should contain:
248+
"""
249+
Success: Installed 1 of 1 languages.
250+
"""
251+
And STDERR should be empty
252+
223253
@require-wp-6.0 @require-php-7.2
224254
Scenario Outline: Core translation update in newer versions
225255
Given an empty directory
@@ -313,7 +343,10 @@ Feature: Manage core translation files for a WordPress install
313343
@require-wp-5.7 @require-mysql
314344
Scenario: Ensure correct language is installed for WP version
315345
Given a WP install
316-
And I try `wp theme install twentytwentyone`
346+
And these installed themes:
347+
"""
348+
twentytwentyone
349+
"""
317350
And I run `wp theme activate twentytwentyone`
318351
And an empty cache
319352
And I run `wp core download --version=5.6.14 --force`
@@ -334,16 +367,22 @@ Feature: Manage core translation files for a WordPress install
334367
@require-wp-4.0 @require-mysql
335368
Scenario: Ensure upgrader output is in English
336369
Given a WP install
337-
And I try `wp theme install twentytwentyone`
370+
And these installed themes:
371+
"""
372+
twentytwentyone
373+
"""
338374
And I run `wp theme activate twentytwentyone`
339375
And an empty cache
340376
And I run `wp core download --version=5.4.1 --force`
341377
And a disable_sidebar_check.php file:
342378
"""
343379
<?php
344-
WP_CLI::add_wp_hook( 'init', static function () {
345-
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
346-
} );
380+
WP_CLI::add_wp_hook(
381+
'init',
382+
static function () {
383+
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
384+
}
385+
);
347386
"""
348387

349388
When I run `wp language core install de_DE --activate --require=disable_sidebar_check.php`

‎features/language-plugin.feature‎

Lines changed: 53 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,6 @@ Feature: Manage plugin translation files for a WordPress install
222222
@require-wp-4.0
223223
Scenario: Not providing plugin slugs should throw an error unless --all given
224224
Given a WP install
225-
And I run `wp plugin path`
226-
And save STDOUT as {PLUGIN_DIR}
227225

228226
When I try `wp language plugin list`
229227
Then the return code should be 1
@@ -272,8 +270,11 @@ Feature: Manage plugin translation files for a WordPress install
272270
Scenario: Ensure correct language is installed for plugin version
273271
Given a WP install
274272
And an empty cache
275-
And I run `wp plugin install akismet --version=3.2 --force`
276-
And I run `wp plugin install jetpack --version=6.0 --force`
273+
And these installed plugins:
274+
"""
275+
akismet --version=3.2 --force
276+
jetpack --version=6.0 --force
277+
"""
277278

278279
When I run `wp language plugin install akismet de_DE_formal`
279280
Then STDOUT should contain:
@@ -309,9 +310,12 @@ Feature: Manage plugin translation files for a WordPress install
309310
| akismet | de_DE_formal | none | installed |
310311
| jetpack | de_DE | none | installed |
311312

312-
When I run `wp plugin install akismet --version=4.0 --force`
313-
And I run `wp plugin install jetpack --version=6.4 --force`
314-
And I run `wp language plugin list --all --fields=plugin,language,update,status`
313+
Given these installed plugins:
314+
"""
315+
akismet --version=4.0 --force
316+
jetpack --version=6.4 --force
317+
"""
318+
When I run `wp language plugin list --all --fields=plugin,language,update,status`
315319
Then STDOUT should be a table containing rows:
316320
| plugin | language | update | status |
317321
| akismet | de_DE_formal | available | installed |
@@ -351,8 +355,11 @@ Feature: Manage plugin translation files for a WordPress install
351355
Scenario: Ensure availability status is correct for each plugin
352356
Given a WP install
353357
And an empty cache
354-
And I run `wp plugin install akismet --version=3.2 --force`
355-
And I run `wp plugin install jetpack --version=6.0 --force`
358+
And these installed plugins:
359+
"""
360+
akismet --version=3.2 --force
361+
jetpack --version=6.0 --force
362+
"""
356363

357364
When I run `wp language plugin install akismet de_DE`
358365
Then STDOUT should contain:
@@ -367,9 +374,12 @@ Feature: Manage plugin translation files for a WordPress install
367374
"""
368375
And STDERR should be empty
369376

370-
When I run `wp plugin install akismet --version=4.0 --force`
371-
And I run `wp plugin install jetpack --version=6.4 --force`
372-
And I run `wp language plugin update jetpack`
377+
Given these installed plugins:
378+
"""
379+
akismet --version=4.0 --force
380+
jetpack --version=6.4 --force
381+
"""
382+
When I run `wp language plugin update jetpack`
373383
Then STDOUT should contain:
374384
"""
375385
Downloading translation from https://downloads.wordpress.org/translation/plugin/jetpack/6.4/de_DE.zip
@@ -385,11 +395,12 @@ Feature: Manage plugin translation files for a WordPress install
385395
@require-wp-4.0
386396
Scenario: Install translations for all installed plugins
387397
Given a WP install
388-
And I run `wp plugin path`
389-
And save STDOUT as {PLUGIN_DIR}
390398
And an empty {PLUGIN_DIR} directory
391-
And I run `wp plugin install akismet --version=4.0 --force`
392-
And I run `wp plugin install jetpack --version=6.4 --force`
399+
And these installed plugins:
400+
"""
401+
akismet --version=4.0 --force
402+
jetpack --version=6.4 --force
403+
"""
393404

394405
When I try `wp language plugin install de_DE`
395406
Then the return code should be 1
@@ -478,8 +489,11 @@ Feature: Manage plugin translation files for a WordPress install
478489
When I run `wp language plugin install akismet de_DE`
479490
Then STDERR should be empty
480491

481-
When I run `wp plugin install akismet --version=4.0 --force`
482-
And I run `wp language plugin list akismet --fields=plugin,language,update,status`
492+
Given these installed plugins:
493+
"""
494+
akismet --version=4.0 --force
495+
"""
496+
When I run `wp language plugin list akismet --fields=plugin,language,update,status`
483497
Then STDOUT should be a table containing rows:
484498
| plugin | language | update | status |
485499
| akismet | de_DE | available | installed |
@@ -492,9 +506,15 @@ Feature: Manage plugin translation files for a WordPress install
492506
And STDERR should be empty
493507

494508
When I run `wp language plugin uninstall akismet de_DE`
495-
And I run `wp plugin install akismet --version=3.2 --force`
509+
And these installed plugins:
510+
"""
511+
akismet --version=3.2 --force
512+
"""
496513
And I run `wp language plugin install akismet de_DE`
497-
And I run `wp plugin install akismet --version=4.0 --force`
514+
And these installed plugins:
515+
"""
516+
akismet --version=4.0 --force
517+
"""
498518
And I run `wp language plugin update akismet --format=csv`
499519
Then STDOUT should contain:
500520
"""
@@ -507,9 +527,15 @@ Feature: Manage plugin translation files for a WordPress install
507527
And STDERR should be empty
508528

509529
When I run `wp language plugin uninstall akismet de_DE`
510-
And I run `wp plugin install akismet --version=3.2 --force`
530+
And these installed plugins:
531+
"""
532+
akismet --version=3.2 --force
533+
"""
511534
And I run `wp language plugin install akismet de_DE`
512-
And I run `wp plugin install akismet --version=4.0 --force`
535+
And these installed plugins:
536+
"""
537+
akismet --version=4.0 --force
538+
"""
513539
And I run `wp language plugin update akismet --format=summary`
514540
Then STDOUT should contain:
515541
"""
@@ -528,8 +554,11 @@ Feature: Manage plugin translation files for a WordPress install
528554
When I run `wp language plugin install akismet de_DE`
529555
Then STDERR should be empty
530556

531-
When I run `wp plugin install akismet --version=4.0 --force`
532-
And I run `wp language plugin list akismet --fields=plugin,language,update,status`
557+
Given these installed plugins:
558+
"""
559+
akismet --version=4.0 --force
560+
"""
561+
When I run `wp language plugin list akismet --fields=plugin,language,update,status`
533562
Then STDOUT should be a table containing rows:
534563
| plugin | language | update | status |
535564
| akismet | de_DE | available | installed |

0 commit comments

Comments
 (0)