Skip to content

Commit

Permalink
Merge branch 'trunk' into fix/block-registration
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Oct 17, 2023
2 parents 3f96fd8 + 1455e76 commit f2feb9f
Show file tree
Hide file tree
Showing 478 changed files with 49,912 additions and 8,767 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,6 @@ jobs:
contents: read
timeout-minutes: 20
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
env:
PUPPETEER_SKIP_DOWNLOAD: ${{ true }}

steps:
- name: Checkout repository
Expand Down
29 changes: 27 additions & 2 deletions .github/workflows/end-to-end-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ jobs:
# - Sets up Node.js.
# - Logs debug information about the GitHub Action runner.
# - Installs npm dependencies.
# - Install Playwright browsers.
# - Builds WordPress to run from the `build` directory.
# - Starts the WordPress Docker container.
# - Logs the running Docker containers.
# - Logs Docker debug information (about both the Docker installation within the runner and the WordPress container).
# - Install WordPress within the Docker container.
# - Install Gutenberg.
# - Run the E2E tests.
# - Ensures version-controlled files are not modified or deleted.
e2e-tests:
Expand Down Expand Up @@ -90,6 +92,9 @@ jobs:
- name: Install npm Dependencies
run: npm ci

- name: Install Playwright browsers
run: npx playwright install --with-deps

- name: Build WordPress
run: npm run build

Expand All @@ -115,6 +120,9 @@ jobs:
LOCAL_SCRIPT_DEBUG: ${{ matrix.LOCAL_SCRIPT_DEBUG }}
run: npm run env:install

- name: Install Gutenberg
run: npm run env:cli -- plugin install gutenberg --path=/var/www/${{ env.LOCAL_DIR }}

- name: Run E2E tests
run: npm run test:e2e

Expand All @@ -129,19 +137,36 @@ jobs:
- name: Ensure version-controlled files are not modified or deleted
run: git diff --exit-code

slack-notifications:
name: Slack Notifications
uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
permissions:
actions: read
contents: read
needs: [ e2e-tests ]
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
with:
calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }}
secrets:
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}

failed-workflow:
name: Failed workflow tasks
runs-on: ubuntu-latest
permissions:
actions: write
needs: [ e2e-tests ]
needs: [ e2e-tests, slack-notifications ]
if: |
always() &&
github.repository == 'WordPress/wordpress-develop' &&
github.event_name != 'pull_request' &&
github.run_attempt < 2 &&
(
needs.e2e-tests.result == 'cancelled' || needs.e2e-tests.result == 'failure'
contains( needs.*.result, 'cancelled' ) ||
contains( needs.*.result, 'failure' )
)
steps:
- name: Dispatch workflow run
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/failed-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ jobs:
runs-on: ubuntu-latest
permissions:
actions: write
timeout-minutes: 5
timeout-minutes: 20

steps:
- name: Rerun a workflow
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
with:
retries: 2
retries: 10
retry-exempt-status-codes: 418
script: |
const workflow_run = await github.rest.actions.getWorkflowRun({
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/install-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
# - Creates a `wp-config.php` file.
# - Installs WordPress.
install-tests-mysql:
name: WP ${{ inputs.new-version || 'latest' }} / PHP ${{ matrix.php }} / ${{ 'mariadb' == matrix.db-type && 'MariaDB' || 'MySQL' }} ${{ matrix.db-version }}${{ matrix.multisite && ' multisite' || '' }}
name: WP ${{ inputs.wp-version || 'latest' }} / PHP ${{ matrix.php }} / ${{ 'mariadb' == matrix.db-type && 'MariaDB' || 'MySQL' }} ${{ matrix.db-version }}${{ matrix.multisite && ' multisite' || '' }}
permissions:
contents: read
runs-on: ubuntu-latest
Expand Down
32 changes: 24 additions & 8 deletions .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ permissions: {}

env:
# Performance testing should be performed in an environment reflecting a standard production environment.
WP_DEBUG: false
SCRIPT_DEBUG: false
SAVEQUERIES : false
WP_DEVELOPMENT_MODE: ''
LOCAL_WP_DEBUG: false
LOCAL_SCRIPT_DEBUG: false
LOCAL_SAVEQUERIES: false
LOCAL_WP_DEVELOPMENT_MODE: "''"

# This workflow takes two sets of measurements — one for the current commit,
# and another against a consistent version that is used as a baseline measurement.
Expand All @@ -56,6 +56,7 @@ jobs:
# - Set up Node.js.
# - Log debug information.
# - Install npm dependencies.
# - Install Playwright browsers.
# - Build WordPress.
# - Start Docker environment.
# - Log running Docker containers.
Expand All @@ -73,6 +74,7 @@ jobs:
# - Run performance tests (previous/target commit).
# - Print target performance tests results.
# - Reset to original commit.
# - Install npm dependencies.
# - Set the environment to the baseline version.
# - Run baseline performance tests.
# - Print baseline performance tests results.
Expand Down Expand Up @@ -119,6 +121,9 @@ jobs:
- name: Install npm dependencies
run: npm ci

- name: Install Playwright browsers
run: npx playwright install --with-deps

- name: Build WordPress
run: npm run build

Expand Down Expand Up @@ -182,24 +187,35 @@ jobs:
run: npm run build

- name: Run target performance tests (base/previous commit)
run: npm run test:performance -- --prefix=before
env:
TEST_RESULTS_PREFIX: before
run: npm run test:performance

- name: Print target performance tests results
run: node ./tests/performance/results.js --prefix=before
env:
TEST_RESULTS_PREFIX: before
run: node ./tests/performance/results.js

- name: Reset to original commit
run: git reset --hard $GITHUB_SHA

- name: Install npm dependencies
run: npm ci

- name: Set the environment to the baseline version
run: |
npm run env:cli -- core update --version=${{ env.BASE_TAG }} --force --path=/var/www/${{ env.LOCAL_DIR }}
npm run env:cli -- core version --path=/var/www/${{ env.LOCAL_DIR }}
- name: Run baseline performance tests
run: npm run test:performance -- --prefix=base
env:
TEST_RESULTS_PREFIX: base
run: npm run test:performance

- name: Print baseline performance tests results
run: node ./tests/performance/results.js --prefix=base
env:
TEST_RESULTS_PREFIX: base
run: node ./tests/performance/results.js

- name: Compare results with base
run: node ./tests/performance/compare-results.js ${{ runner.temp }}/summary.md
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/phpunit-tests-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ env:
LOCAL_DB_VERSION: ${{ inputs.db-version }}
LOCAL_PHP_MEMCACHED: ${{ inputs.memcached }}
PHPUNIT_CONFIG: ${{ inputs.phpunit-config }}
PUPPETEER_SKIP_DOWNLOAD: ${{ true }}

jobs:
# Runs the PHPUnit tests for WordPress.
Expand Down Expand Up @@ -159,11 +158,11 @@ jobs:

- name: Run ms-files tests as a multisite install
if: ${{ inputs.multisite }}
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c tests/phpunit/multisite.xml --group ms-files
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ms-files

- name: Run external HTTP tests
if: ${{ ! inputs.multisite }}
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c phpunit.xml.dist --group external-http
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group external-http

# __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
- name: Run (Xdebug) tests
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/slack-notifications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,14 @@ jobs:
run_id: ${{ github.run_id }},
});
// When a workflow has been restarted to fix a failure, check the previous run attempt.
if ( workflow_run.data.run_attempt > 1 ) {
if ( '${{ inputs.calling_status }}' == 'failure' && workflow_run.data.run_attempt == 1 ) {
return 'first-failure';
}
// When a workflow has been restarted, check the previous run attempt. Because workflows are automatically
// restarted once and a failure on the first run is not reported, failures on the second run should not be
// considered.
if ( workflow_run.data.run_attempt > 2 ) {
const previous_run = await github.rest.actions.getWorkflowRunAttempt({
owner: context.repo.owner,
repo: context.repo.repo,
Expand Down Expand Up @@ -157,7 +163,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [ prepare ]
if: ${{ inputs.calling_status == 'failure' || failure() }}
if: ${{ needs.prepare.outputs.previous_conclusion != 'first-failure' && inputs.calling_status == 'failure' || failure() }}

steps:
- name: Post failure notifications to Slack
Expand Down
51 changes: 49 additions & 2 deletions .github/workflows/test-and-zip-default-themes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,52 @@ concurrency:
permissions: {}

jobs:
# Checks for zero-byte files.
#
# Occasionally, binary files such as images and fonts are added to themes incorrectly.
# This checks that all files contain contents.
#
# Performs the following steps:
# - Checks out the repository.
# - Checks for zero-byte (empty) files.
check-for-empty-files:
name: ${{ matrix.theme }} empty file check
runs-on: ubuntu-latest
permissions:
contents: read
timeout-minutes: 10
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
strategy:
fail-fast: false
matrix:
theme: [
'twentytwentyfour',
'twentytwentythree',
'twentytwentytwo',
'twentytwentyone',
'twentytwenty',
'twentynineteen',
'twentyseventeen',
'twentysixteen',
'twentyfifteen',
'twentyfourteen',
'twentythirteen',
'twentytwelve',
'twentyeleven',
'twentyten'
]

steps:
- name: Checkout repository
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.branch || github.ref }}
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}

- name: Check for zero-byte (empty) files
run: |
[[ ! $(find src/wp-content/themes/${{ matrix.theme }} -empty) ]]
# Tests the build script for themes that have one.
#
# Performs the following steps:
Expand Down Expand Up @@ -110,13 +156,14 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: read
needs: [ test-build-scripts ]
needs: [ check-for-empty-files, test-build-scripts ]
timeout-minutes: 10
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
strategy:
fail-fast: false
matrix:
theme: [
'twentytwentyfour',
'twentytwentythree',
'twentytwentytwo',
'twentytwentyone',
Expand Down Expand Up @@ -152,7 +199,7 @@ jobs:
permissions:
actions: read
contents: read
needs: [ bundle-theme, test-build-scripts ]
needs: [ check-for-empty-files, bundle-theme, test-build-scripts ]
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
with:
calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }}
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/test-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ on:
permissions: {}

env:
PUPPETEER_SKIP_DOWNLOAD: ${{ true }}
LOCAL_PHP: '7.4-fpm'
LOCAL_PHP_XDEBUG: true
LOCAL_PHP_XDEBUG_MODE: 'coverage'
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/test-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ concurrency:
# Any needed permissions should be configured at the job level.
permissions: {}

env:
PUPPETEER_SKIP_DOWNLOAD: ${{ true }}

jobs:
# Verifies that installing npm dependencies and building WordPress works as expected.
#
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ wp-tests-config.php
!/src/wp-content/themes/twentytwentyone
!/src/wp-content/themes/twentytwentytwo
!/src/wp-content/themes/twentytwentythree
!/src/wp-content/themes/twentytwentyfour
/src/wp-content/upgrade
/src/wp-content/uploads
/src/wp-content/advanced-cache.php
Expand Down Expand Up @@ -99,4 +100,4 @@ wp-tests-config.php
/docker-compose.override.yml

# Visual regression test diffs
tests/visual-regression/specs/__image_snapshots__
tests/visual-regression/specs/__snapshots__
5 changes: 5 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ module.exports = function(grunt) {
'webpack-assets': webpackFiles.map( function( file ) {
return setFilePath( WORKING_DIR, file );
} ),
'interactivity-assets': [
WORKING_DIR + 'wp-includes/js/dist/interactivity.asset.php',
WORKING_DIR + 'wp-includes/js/dist/interactivity.min.asset.php',
],
dynamic: {
dot: true,
expand: true,
Expand Down Expand Up @@ -1458,6 +1462,7 @@ module.exports = function(grunt) {
'clean:webpack-assets',
'webpack:prod',
'webpack:dev',
'clean:interactivity-assets',
] );

grunt.registerTask( 'build:js', [
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"require-dev": {
"squizlabs/php_codesniffer": "3.7.2",
"wp-coding-standards/wpcs": "~3.0.0",
"wp-coding-standards/wpcs": "~3.0.1",
"phpcompatibility/phpcompatibility-wp": "~2.1.3",
"yoast/phpunit-polyfills": "^1.1.0"
},
Expand Down
Loading

0 comments on commit f2feb9f

Please sign in to comment.