Skip to content

Commit d6358ff

Browse files
committed
prep build 04/05
2 parents b7541d2 + ac60335 commit d6358ff

File tree

79 files changed

+2191
-4307
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+2191
-4307
lines changed

.github/workflows/end2end-test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
env:
5050
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
5151
run: |
52-
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test:e2e:playwright -- --shard=${{ matrix.part }}/${{ matrix.totalParts }}
52+
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test:e2e -- --shard=${{ matrix.part }}/${{ matrix.totalParts }}
5353
5454
- name: Archive debug artifacts (screenshots, traces)
5555
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1

.github/workflows/php-changes-detection.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717

1818
- name: Get changed PHP files
1919
id: changed-files-php
20-
uses: tj-actions/changed-files@20576b4b9ed46d41e2d45a2256e5e2316dde6834 # v43.0.1
20+
uses: tj-actions/changed-files@2d756ea4c53f7f6b397767d8723b3a10a9f35bf2 # v44.0.0
2121
with:
2222
files: |
2323
**.{php}

.github/workflows/rnmobile-android-runner.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
2929

3030
- name: Use desired version of Java
31-
uses: actions/setup-java@9704b39bf258b59bc04b50fa2dd55e9ed76b47a8 # v4.1.0
31+
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
3232
with:
3333
distribution: 'corretto'
3434
java-version: '17'

.github/workflows/unit-test.yml

+77-16
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,18 @@ concurrency:
2121

2222
jobs:
2323
unit-js:
24-
name: JavaScript (Node.js ${{ matrix.node }})
24+
name: JavaScript (Node.js ${{ matrix.node }}) ${{ matrix.shard }}
2525
runs-on: ubuntu-latest
2626
if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }}
2727
strategy:
2828
fail-fast: false
2929
matrix:
3030
node: ['20', '21']
31+
shard: ['1/4', '2/4', '3/4', '4/4']
3132

3233
steps:
33-
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
34+
- name: Checkout repository
35+
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
3436
with:
3537
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
3638

@@ -39,20 +41,55 @@ jobs:
3941
with:
4042
node-version: ${{ matrix.node }}
4143

42-
- name: Get number of CPU cores
44+
- name: Determine the number of CPU cores
4345
uses: SimenB/github-actions-cpu-cores@97ba232459a8e02ff6121db9362b09661c875ab8 # v2.0.0
4446
id: cpu-cores
4547

46-
- name: npm build
48+
- name: Run build scripts
4749
# It's not necessary to run the full build, since Jest can interpret
4850
# source files with `babel-jest`. Some packages have their own custom
4951
# build tasks, however. These must be run.
5052
run: npx lerna run build
5153

5254
- name: Running the tests
53-
run: npm run test:unit -- --ci --maxWorkers=${{ steps.cpu-cores.outputs.count }} --cacheDirectory="$HOME/.jest-cache"
55+
run: |
56+
npm run test:unit -- \
57+
--ci \
58+
--maxWorkers="${{ steps.cpu-cores.outputs.count }}" \
59+
--shard="${{ matrix.shard }}" \
60+
--cacheDirectory="$HOME/.jest-cache"
61+
62+
unit-js-date:
63+
name: JavaScript Date Tests (Node.js ${{ matrix.node }})
64+
runs-on: ubuntu-latest
65+
if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }}
66+
strategy:
67+
fail-fast: false
68+
matrix:
69+
node: ['20', '21']
70+
71+
steps:
72+
- name: Checkout repository
73+
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
74+
with:
75+
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
76+
77+
- name: Setup Node.js and install dependencies
78+
uses: ./.github/setup-node
79+
with:
80+
node-version: ${{ matrix.node }}
81+
82+
- name: Determine the number of CPU cores
83+
uses: SimenB/github-actions-cpu-cores@97ba232459a8e02ff6121db9362b09661c875ab8 # v2.0.0
84+
id: cpu-cores
85+
86+
- name: Run build scripts
87+
# It's not necessary to run the full build, since Jest can interpret
88+
# source files with `babel-jest`. Some packages have their own custom
89+
# build tasks, however. These must be run.
90+
run: npx lerna run build
5491

55-
- name: Running the date tests
92+
- name: Run the date tests
5693
run: npm run test:unit:date -- --ci --maxWorkers=${{ steps.cpu-cores.outputs.count }} --cacheDirectory="$HOME/.jest-cache"
5794

5895
compute-previous-wordpress-version:
@@ -80,9 +117,29 @@ jobs:
80117
echo "previous-wordpress-version=${PREVIOUS_WP_VERSION}" >> $GITHUB_OUTPUT
81118
rm versions.json
82119
120+
build-assets:
121+
name: Build JavaScript assets for PHP unit tests
122+
runs-on: ubuntu-latest
123+
steps:
124+
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
125+
with:
126+
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
127+
128+
- name: Setup Node.js and install dependencies
129+
uses: ./.github/setup-node
130+
131+
- name: Run build scripts
132+
run: npm run build
133+
134+
- name: Upload built JavaScript assets
135+
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
136+
with:
137+
name: build-assets
138+
path: ./build/
139+
83140
test-php:
84141
name: PHP ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.wordpress != '' && format( ' (WP {0}) ', matrix.wordpress ) || '' }} on ubuntu-latest
85-
needs: compute-previous-wordpress-version
142+
needs: [compute-previous-wordpress-version, build-assets]
86143
runs-on: ubuntu-latest
87144
timeout-minutes: 20
88145
if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }}
@@ -114,7 +171,8 @@ jobs:
114171
WP_ENV_CORE: ${{ matrix.wordpress == '' && 'WordPress/WordPress' || format( 'https://wordpress.org/wordpress-{0}.zip', matrix.wordpress ) }}
115172

116173
steps:
117-
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
174+
- name: Checkout repository
175+
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
118176
with:
119177
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
120178

@@ -129,7 +187,7 @@ jobs:
129187
# dependency versions are installed and cached.
130188
##
131189
- name: Set up PHP
132-
uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2.30.0
190+
uses: shivammathur/setup-php@8872c784b04a1420e81191df5d64fbd59d3d3033 # v2.30.2
133191
with:
134192
php-version: '${{ matrix.php }}'
135193
ini-file: development
@@ -152,8 +210,11 @@ jobs:
152210
with:
153211
custom-cache-suffix: $(/bin/date -u --date='last Mon' "+%F")
154212

155-
- name: Npm build
156-
run: npm run build
213+
- name: Download built JavaScript assets
214+
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
215+
with:
216+
name: build-assets
217+
path: ./build
157218

158219
- name: Docker debug information
159220
run: |
@@ -165,7 +226,6 @@ jobs:
165226
node --version
166227
curl --version
167228
git --version
168-
svn --version
169229
locale -a
170230
171231
- name: Start Docker environment
@@ -228,7 +288,7 @@ jobs:
228288
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
229289

230290
- name: Set up PHP
231-
uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2.30.0
291+
uses: shivammathur/setup-php@8872c784b04a1420e81191df5d64fbd59d3d3033 # v2.30.2
232292
with:
233293
php-version: '7.4'
234294
coverage: none
@@ -292,18 +352,19 @@ jobs:
292352
if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }}
293353

294354
steps:
295-
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
355+
- name: Checkout repository
356+
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
296357
with:
297358
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
298359

299-
- name: Get number of CPU cores
360+
- name: Determine the number of CPU cores
300361
uses: SimenB/github-actions-cpu-cores@97ba232459a8e02ff6121db9362b09661c875ab8 # v2.0.0
301362
id: cpu-cores
302363

303364
- name: Setup Node.js and install dependencies
304365
uses: ./.github/setup-node
305366

306-
- name: Npm build
367+
- name: Run build scripts
307368
# It's not necessary to run the full build, since Jest can interpret
308369
# source files with `babel-jest`. Some packages have their own custom
309370
# build tasks, however. These must be run.

docs/contributors/code/e2e/README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,29 @@ See the dedicated guide if you're working with the previous Jest + Puppeteer fra
1212

1313
```bash
1414
# Run all available tests.
15-
npm run test:e2e:playwright
15+
npm run test:e2e
1616

1717
# Run in headed mode.
18-
npm run test:e2e:playwright -- --headed
18+
npm run test:e2e -- --headed
1919

2020
# Run tests with specific browsers (`chromium`, `firefox`, or `webkit`).
21-
npm run test:e2e:playwright -- --project=webkit --project=firefox
21+
npm run test:e2e -- --project=webkit --project=firefox
2222

2323
# Run a single test file.
24-
npm run test:e2e:playwright -- <path_to_test_file> # E.g., npm run test:e2e:playwright -- site-editor/title.spec.js
24+
npm run test:e2e -- <path_to_test_file> # E.g., npm run test:e2e -- site-editor/title.spec.js
2525

2626
# Debugging.
27-
npm run test:e2e:playwright -- --debug
27+
npm run test:e2e -- --debug
2828
```
2929

3030
If you're developing in Linux, it currently requires testing Webkit browsers in headed mode. If you don't want to or can't run it with the GUI (e.g. if you don't have a graphic interface), prepend the command with [`xvfb-run`](https://manpages.ubuntu.com/manpages/xenial/man1/xvfb-run.1.html) to run it in a virtual environment.
3131

3232
```bash
3333
# Run all available tests.
34-
xvfb-run npm run test:e2e:playwright
34+
xvfb-run npm run test:e2e
3535

3636
# Only run webkit tests.
37-
xvfb-run -- npm run test:e2e:playwright -- --project=webkit
37+
xvfb-run -- npm run test:e2e -- --project=webkit
3838
```
3939

4040
## Best practices

docs/contributors/code/testing-overview.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -327,10 +327,7 @@ However, if the change was intentional, follow these steps to update the snapsho
327327
npm run test:unit -- --updateSnapshot --testPathPattern path/to/tests
328328

329329
# Update snapshot for e2e tests
330-
npm run test:e2e -- --updateSnapshot --testPathPattern path/to/e2e-tests
331-
332-
# Update snapshot for Playwright
333-
npm run test:e2e:playwright -- --update-snapshots path/to/spec
330+
npm run test:e2e -- --update-snapshots path/to/spec
334331
```
335332
336333
1. Review the diff and ensure the changes are expected and intentional.

docs/getting-started/glossary.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ This refers to a collection of features that ultimately allows users to edit the
7070

7171
The CSS styles generated by WordPress and enqueued as an embedded stylesheet in the front end of the site. The stylesheet ID is `global-styles-inline-css`. The contents of this stylesheet come from the default `theme.json` of WordPress, the theme's `theme.json`, and the styles provided by the user via the global styles sidebar in the site editor.
7272

73-
See [theme.json reference docs](/docs/reference-guides/theme-json-reference.md)</a>, the [how to guide](/docs/how-to-guides/themes/global-settings-and-styles.md), and an introduction to [styles in the block editor](/docs/explanations/architecture/styles.md).
73+
See [theme.json reference docs](/docs/reference-guides/theme-json-reference/README.md)</a>, the [how to guide](/docs/how-to-guides/themes/global-settings-and-styles.md), and an introduction to [styles in the block editor](/docs/explanations/architecture/styles.md).
7474

7575
Compare to <a href="#block-styles">block styles</a>.
7676

lib/class-wp-theme-json-gutenberg.php

+10
Original file line numberDiff line numberDiff line change
@@ -1614,6 +1614,16 @@ protected function get_layout_styles( $block_metadata ) {
16141614
! empty( $base_style_rule['rules'] )
16151615
) {
16161616
foreach ( $base_style_rule['rules'] as $css_property => $css_value ) {
1617+
// Skip rules that reference content size or wide size if they are not defined in the theme.json.
1618+
if (
1619+
is_string( $css_value ) &&
1620+
( str_contains( $css_value, '--global--content-size' ) || str_contains( $css_value, '--global--wide-size' ) ) &&
1621+
! isset( $this->theme_json['settings']['layout']['contentSize'] ) &&
1622+
! isset( $this->theme_json['settings']['layout']['wideSize'] )
1623+
) {
1624+
continue;
1625+
}
1626+
16171627
if ( static::is_safe_css_declaration( $css_property, $css_value ) ) {
16181628
$declarations[] = array(
16191629
'name' => $css_property,

0 commit comments

Comments
 (0)