Skip to content

Commit

Permalink
Merge branch 'WordPress:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
circlecube authored Apr 21, 2022
2 parents a1cb9bc + d088e31 commit dbbfaf2
Show file tree
Hide file tree
Showing 717 changed files with 16,076 additions and 8,341 deletions.
22 changes: 0 additions & 22 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#
# Below, the following substitutions can be made:
# - '{version}': any major.minor PHP version from 5.2 onwards.
# - '{phpunit_version}': any major PHPUnit version starting with 4.
##

# The site will be available at http://localhost:LOCAL_PORT
Expand All @@ -18,27 +17,6 @@ LOCAL_DIR=src
# The PHP version to use. Valid options are 'latest', and '{version}-fpm'.
LOCAL_PHP=latest

##
# The PHPUnit version to use when running tests.
#
# Support for new PHPUnit versions is not backported to past versions, so some old WordPress branches require an older
# version to run tests.
#
# Valid versions are:
# - 'latest' for the highest version of PHPUnit supported on the highest version of PHP supported.
# - '{version}-fpm' for the highest version of PHPUnit supported on the specified version of PHP.
# - '{phpunit_version}-php-{version}-fpm' for a specific version of PHPUnit on the specified version of PHP. This format
# is only available for PHP versions 5.6 and higher.
#
# For the full list of available options, see https://hub.docker.com/r/wordpressdevelop/phpunit/tags.
#
# For full documentation on PHPUnit compatibility and WordPress versions, see
# https://make.wordpress.org/core/handbook/references/phpunit-compatibility-and-wordpress-versions/.
#
# This defaults to the value assigned to the value of LOCAL_PHP.
##
LOCAL_PHPUNIT=${LOCAL_PHP}

# Whether or not to enable XDebug.
LOCAL_PHP_XDEBUG=false

Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,16 @@ 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@master
needs: [ phpcs, jshint ]
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
with:
calling_status: ${{ needs.phpcs.result == 'success' && needs.jshint.result == 'success' && 'success' || ( needs.phpcs.result == 'cancelled' || needs.jshint.result == 'cancelled' ) && 'cancelled' || 'failure' }}
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 }}
13 changes: 13 additions & 0 deletions .github/workflows/end-to-end-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,16 @@ 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@master
needs: [ e2e-tests ]
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
with:
calling_status: ${{ needs.e2e-tests.result == 'success' && 'success' || needs.e2e-tests.result == 'cancelled' && 'cancelled' || 'failure' }}
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 }}
13 changes: 13 additions & 0 deletions .github/workflows/javascript-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,16 @@ 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@master
needs: [ test-js ]
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
with:
calling_status: ${{ needs.test-js.result == 'success' && 'success' || needs.test-js.result == 'cancelled' && 'cancelled' || 'failure' }}
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 }}
13 changes: 13 additions & 0 deletions .github/workflows/php-compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,16 @@ 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@master
needs: [ php-compatibility ]
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
with:
calling_status: ${{ needs.php-compatibility.result == 'success' && 'success' || needs.php-compatibility.result == 'cancelled' && 'cancelled' || 'failure' }}
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 }}
35 changes: 24 additions & 11 deletions .github/workflows/phpunit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,19 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ '5.6.20', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1' ]
php: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1' ]
os: [ ubuntu-latest ]
memcached: [ false ]
split_slow: [ false ]
multisite: [ false, true ]
include:
# Additional "slow" jobs for PHP 5.6.
- php: '5.6.20'
- php: '5.6'
os: ubuntu-latest
memcached: false
multisite: false
split_slow: true
- php: '5.6.20'
- php: '5.6'
os: ubuntu-latest
memcached: false
multisite: true
Expand Down Expand Up @@ -191,41 +191,41 @@ jobs:

- name: Run slow PHPUnit tests
if: ${{ matrix.split_slow }}
run: npm run test:php-composer -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }}
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }}

- name: Run PHPUnit tests for single site excluding slow tests
if: ${{ matrix.php < '7.0' && ! matrix.split_slow && ! matrix.multisite }}
run: npm run test:php-composer -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-required
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-required

- name: Run PHPUnit tests for Multisite excluding slow tests
if: ${{ matrix.php < '7.0' && ! matrix.split_slow && matrix.multisite }}
run: npm run test:php-composer -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-excluded,oembed-headers
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-excluded,oembed-headers

- name: Run PHPUnit tests
if: ${{ matrix.php >= '7.0' }}
continue-on-error: ${{ matrix.php == '8.1' }}
run: npm run test:php-composer -- --verbose -c ${{ env.PHPUNIT_CONFIG }}
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }}

- name: Run AJAX tests
if: ${{ ! matrix.split_slow }}
continue-on-error: ${{ matrix.php == '8.1' }}
run: npm run test:php-composer -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax

- name: Run ms-files tests as a multisite install
if: ${{ matrix.multisite && ! matrix.split_slow }}
continue-on-error: ${{ matrix.php == '8.1' }}
run: npm run test:php-composer -- --verbose -c tests/phpunit/multisite.xml --group ms-files
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c tests/phpunit/multisite.xml --group ms-files

- name: Run external HTTP tests
if: ${{ ! matrix.multisite && ! matrix.split_slow }}
continue-on-error: ${{ matrix.php == '8.1' }}
run: npm run test:php-composer -- --verbose -c phpunit.xml.dist --group external-http
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c phpunit.xml.dist --group external-http

# __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
- name: Run (xDebug) tests
if: ${{ ! matrix.split_slow }}
continue-on-error: ${{ matrix.php == '8.1' }}
run: LOCAL_PHP_XDEBUG=true npm run test:php-composer -- -v --group xdebug --exclude-group __fakegroup__
run: LOCAL_PHP_XDEBUG=true node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit -v --group xdebug --exclude-group __fakegroup__

- name: Ensure version-controlled files are not modified or deleted
run: git diff --exit-code
Expand All @@ -242,3 +242,16 @@ jobs:
env:
WPT_REPORT_API_KEY: "${{ secrets.WPT_REPORT_API_KEY }}"
run: docker-compose run --rm -e WPT_REPORT_API_KEY -e WPT_PREPARE_DIR=/var/www -e WPT_TEST_DIR=/var/www php php test-runner/report.php

slack-notifications:
name: Slack Notifications
uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@master
needs: [ test-php ]
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
with:
calling_status: ${{ needs.test-php.result == 'success' && 'success' || needs.test-php.result == 'cancelled' && 'cancelled' || 'failure' }}
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 }}
86 changes: 69 additions & 17 deletions .github/workflows/slack-notifications.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
##
# Posts messages to the Making WordPress Core Slack Instance by
# submitting data to Slack webhook URLs received by Slack Workflows.
# A reusable workflow for posting messages to the Making WordPress
# Core Slack Instance by submitting data to Slack webhook URLs
# received by Slack Workflows.
##
name: Slack Notifications

Expand All @@ -18,9 +19,31 @@ on:
types:
- completed
branches:
- master
- trunk
- '[3-9].[0-9]'
- '[3-4].[0-9]'
- '5.[0-8]'

workflow_call:
inputs:
calling_status:
description: 'The status of the calling workflow'
type: string
required: true
secrets:
SLACK_GHA_SUCCESS_WEBHOOK:
description: 'The Slack webhook URL for a successful build.'
required: true
SLACK_GHA_CANCELLED_WEBHOOK:
description: 'The Slack webhook URL for a cancelled build.'
required: true
SLACK_GHA_FIXED_WEBHOOK:
description: 'The Slack webhook URL for a fixed build.'
required: true
SLACK_GHA_FAILURE_WEBHOOK:
description: 'The Slack webhook URL for a failed build.'
required: true

env:
CURRENT_BRANCH: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_branch || github.ref_name }}

jobs:
# Gathers the details needed for Slack notifications.
Expand All @@ -29,8 +52,11 @@ jobs:
# submit data to Slack webhook URLs configured to post messages.
#
# Performs the following steps:
# - Retrieves the workflow ID (if necessary).
# - Retrieves the workflow URL (if necessary).
# - Retrieves the previous workflow run and stores its conclusion.
# - Sets the previous conclusion as an output.
# - Prepares the commit message.
# - Constructs and stores a message payload as an output.
prepare:
name: Prepare notifications
Expand All @@ -41,44 +67,70 @@ jobs:
payload: ${{ steps.create-payload.outputs.payload }}

steps:
- name: Get the workflow ID
id: current-workflow-id
if: ${{ github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
uses: actions/github-script@441359b1a30438de65712c2fbca0abe4816fa667 # v5.0.0
with:
script: |
const workflow_run = await github.rest.actions.getWorkflowRun({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ github.run_id }},
});
return workflow_run.data.workflow_id;
- name: Get details about the previous workflow run
id: previous-result
uses: actions/github-script@a3e7071a34d7e1f219a8a4de9a5e0a34d1ee1293 # v4.0.2
uses: actions/github-script@441359b1a30438de65712c2fbca0abe4816fa667 # v5.0.0
with:
script: |
const workflow_runs = await github.actions.listWorkflowRuns({
const previous_runs = await github.rest.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: ${{ github.event.workflow_run.workflow_id }},
branch: '${{ github.event.workflow_run.head_branch }}',
workflow_id: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.workflow_id || steps.current-workflow-id.outputs.result }},
branch: '${{ env.CURRENT_BRANCH }}',
per_page: 1,
page: 2,
});
return workflow_runs.data.workflow_runs[0].conclusion;
return previous_runs.data.workflow_runs[0].conclusion;
- name: Store previous conclusion as an output
id: previous-conclusion
run: echo "::set-output name=previous_conclusion::${{ steps.previous-result.outputs.result }}"

- name: Get the commit message
id: current-commit-message
uses: actions/github-script@441359b1a30438de65712c2fbca0abe4816fa667 # v5.0.0
if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }}
with:
script: |
const commit_details = await github.rest.repos.getCommit({
owner: context.repo.owner,
repo: context.repo.repo,
ref: '${{ github.sha }}'
});
return commit_details.data.commit.message;
- name: Prepare commit message.
id: commit-message
run: |
COMMIT_MESSAGE=$(cat <<'EOF' | awk 'NR==1' | sed 's/`/\\`/g' | sed 's/\"/\\\\"/g'
${{ github.event.workflow_run.head_commit.message }}
COMMIT_MESSAGE=$(cat <<'EOF' | awk 'NR==1' | sed 's/`/\\`/g' | sed 's/\"/\\\\\\"/g' | sed 's/\$/\\$/g'
${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_commit.message || ( github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) && fromJson( steps.current-commit-message.outputs.result ) || github.event.head_commit.message }}
EOF
)
echo "::set-output name=commit_message_escaped::${COMMIT_MESSAGE}"
- name: Construct payload and store as an output
id: create-payload
run: echo "::set-output name=payload::{\"workflow_name\":\"${{ github.event.workflow_run.name }}\",\"ref_name\":\"${{ github.event.workflow_run.head_branch }}\",\"run_url\":\"${{ github.event.workflow_run.html_url }}\",\"commit_message\":\"${{ steps.commit-message.outputs.commit_message_escaped }}\"}"
run: echo "::set-output name=payload::{\"workflow_name\":\"${{ github.event_name == 'workflow_run' && github.event.workflow_run.name || github.workflow }}\",\"ref_name\":\"${{ env.CURRENT_BRANCH }}\",\"run_url\":\"https://github.com/WordPress/wordpress-develop/actions/runs/${{ github.event_name == 'workflow_run' && github.event.workflow_run.id || github.run_id }}\",\"commit_message\":\"${{ steps.commit-message.outputs.commit_message_escaped }}\"}"

# Posts notifications when a workflow fails.
failure:
name: Failure notifications
runs-on: ubuntu-latest
needs: [ prepare ]
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'failure' || inputs.calling_status == 'failure' || failure() }}

steps:
- name: Post failure notifications to Slack
Expand All @@ -93,7 +145,7 @@ jobs:
name: Fixed notifications
runs-on: ubuntu-latest
needs: [ prepare ]
if: ${{ needs.prepare.outputs.previous_conclusion == 'failure' && github.event.workflow_run.conclusion == 'success' }}
if: ${{ needs.prepare.outputs.previous_conclusion == 'failure' && ( github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' || inputs.calling_status == 'success' ) && success() }}

steps:
- name: Post failure notifications to Slack
Expand All @@ -108,7 +160,7 @@ jobs:
name: Success notifications
runs-on: ubuntu-latest
needs: [ prepare ]
if: ${{ github.event.workflow_run.conclusion == 'success' }}
if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' || inputs.calling_status == 'success' && success() }}

steps:
- name: Post success notifications to Slack
Expand All @@ -123,7 +175,7 @@ jobs:
name: Cancelled notifications
runs-on: ubuntu-latest
needs: [ prepare ]
if: ${{ github.event.workflow_run.conclusion == 'cancelled' }}
if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'cancelled' || inputs.calling_status == 'cancelled' || cancelled() }}

steps:
- name: Post cancelled notifications to Slack
Expand Down
17 changes: 15 additions & 2 deletions .github/workflows/test-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ jobs:

- name: Run tests as a single site
if: ${{ ! matrix.multisite }}
run: npm run test:php-composer -- --verbose -c phpunit.xml.dist --coverage-clover wp-code-coverage-single-clover-${{ github.sha }}.xml
run: npm run test:php -- --verbose -c phpunit.xml.dist --coverage-clover wp-code-coverage-single-clover-${{ github.sha }}.xml

- name: Ensure version-controlled files are not modified during the tests
run: git diff --exit-code
Expand All @@ -157,7 +157,7 @@ jobs:

- name: Run tests as a multisite install
if: ${{ matrix.multisite }}
run: npm run test:php-composer -- --verbose -c tests/phpunit/multisite.xml --coverage-clover wp-code-coverage-multisite-clover-${{ github.sha }}.xml
run: npm run test:php -- --verbose -c tests/phpunit/multisite.xml --coverage-clover wp-code-coverage-multisite-clover-${{ github.sha }}.xml

- name: Ensure version-controlled files are not modified during the tests
run: git diff --exit-code
Expand All @@ -168,3 +168,16 @@ jobs:
with:
file: wp-code-coverage-multisite-clover-${{ github.sha }}.xml
flags: multisite,php

slack-notifications:
name: Slack Notifications
uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@master
needs: [ test-coverage-report ]
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
with:
calling_status: ${{ needs.test-coverage-report.result == 'success' && 'success' || needs.test-coverage-report.result == 'cancelled' && 'cancelled' || 'failure' }}
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 }}
Loading

0 comments on commit dbbfaf2

Please sign in to comment.