Skip to content

Commit

Permalink
Merge branch 'trunk' into 56791-coding-standards
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyBiryukov authored Dec 8, 2024
2 parents 340c975 + 750f743 commit af9a159
Show file tree
Hide file tree
Showing 891 changed files with 54,487 additions and 51,100 deletions.
File renamed without changes.
5 changes: 3 additions & 2 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ on:
- '.jshintrc'
# This file configures PHPCS. Changes could affect the outcome.
- 'phpcs.xml.dist'
# Changes to workflow files should always verify all workflows are successful.
- '.github/workflows/*.yml'
# Confirm any changes to relevant workflow files.
- '.github/workflows/coding-standards.yml'
- '.github/workflows/reusable-coding-standards-*.yml'
workflow_dispatch:

# Cancels all previous workflow runs for pull requests that have not completed.
Expand Down
100 changes: 32 additions & 68 deletions .github/workflows/install-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ on:
paths:
- '.github/workflows/install-testing.yml'
- '.version-support-*.json'
- '.github/workflows/reusable-support-json-reader-v1.yml'
pull_request:
# Always test the workflow when changes are suggested.
paths:
- '.github/workflows/install-testing.yml'
- '.version-support-*.json'
- '.github/workflows/install-testing.yml'
- '.github/workflows/reusable-support-json-reader-v1.yml'

schedule:
- cron: '0 0 * * 1'
workflow_dispatch:
Expand All @@ -37,65 +40,21 @@ concurrency:
permissions: {}

jobs:
# Determines the appropriate values for PHP and database versions based on the WordPress version being tested.
#
# Performs the following steps:
# - Checks out the repository.
# - Fetches the versions of PHP to test.
# - Fetches the versions of MySQL to test.
build-matrix:
name: Determine PHP Versions to test
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
major-wp-version: ${{ steps.major-wp-version.outputs.version }}
php-versions: ${{ steps.php-versions.outputs.versions }}
mysql-versions: ${{ steps.mysql-versions.outputs.versions }}

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

- name: Determine the major WordPress version
id: major-wp-version
run: |
if [ "${{ inputs.wp-version }}" ] && [ "${{ inputs.wp-version }}" != "nightly" ] && [ "${{ inputs.wp-version }}" != "latest" ]; then
echo "version=$(echo "${{ inputs.wp-version }}" | tr '.' '-' | cut -d '-' -f1-2)" >> $GITHUB_OUTPUT
elif [ "${{ inputs.wp-version }}" ]; then
echo "version=$(echo "${{ inputs.wp-version }}")" >> $GITHUB_OUTPUT
else
echo "version=nightly" >> $GITHUB_OUTPUT
fi
# Look up the major version's specific PHP support policy when a version is provided.
# Otherwise, use the current PHP support policy.
- name: Get supported PHP versions
id: php-versions
run: |
if [ "${{ steps.major-wp-version.outputs.version }}" != "latest" ] && [ "${{ steps.major-wp-version.outputs.version }}" != "nightly" ]; then
echo "versions=$(jq -r '.["${{ steps.major-wp-version.outputs.version }}"] | @json' .version-support-php.json)" >> $GITHUB_OUTPUT
else
echo "versions=$(jq -r '.[ (keys[-1]) ] | @json' .version-support-php.json)" >> $GITHUB_OUTPUT
fi
# Look up the major version's specific MySQL support policy when a version is provided.
# Otherwise, use the current MySQL support policy.
- name: Get supported MySQL versions
id: mysql-versions
run: |
if [ "${{ steps.major-wp-version.outputs.version }}" != "latest" ] && [ "${{ steps.major-wp-version.outputs.version }}" != "nightly" ]; then
echo "versions=$(jq -r '.["${{ steps.major-wp-version.outputs.version }}"] | @json' .version-support-mysql.json)" >> $GITHUB_OUTPUT
else
echo "versions=$(jq -r '.[ (keys[-1]) ] | @json' .version-support-mysql.json)" >> $GITHUB_OUTPUT
fi
# Determines the supported values for PHP and database versions based on the WordPress version being tested.
build-test-matrix:
name: Build Test Matrix
uses: WordPress/wordpress-develop/.github/workflows/reusable-support-json-reader-v1.yml@trunk
permissions:
contents: read
secrets: inherit
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
with:
wp-version: ${{ inputs.wp-version }}

# Test the WordPress installation process through WP-CLI.
#
# Performs the following steps:
# - Sets up PHP.
# - Starts the database server.
# - Downloads the specified version of WordPress.
# - Creates a `wp-config.php` file.
# - Installs WordPress.
Expand All @@ -104,15 +63,16 @@ jobs:
permissions:
contents: read
runs-on: ${{ matrix.os }}
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
timeout-minutes: 10
needs: [ build-matrix ]
needs: [ build-test-matrix ]
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
php: ${{ fromJSON( needs.build-matrix.outputs.php-versions ) }}
php: ${{ fromJSON( needs.build-test-matrix.outputs.php-versions ) }}
db-type: [ 'mysql' ]
db-version: ${{ fromJSON( needs.build-matrix.outputs.mysql-versions ) }}
db-version: ${{ fromJSON( needs.build-test-matrix.outputs.mysql-versions ) }}
multisite: [ false, true ]
memcached: [ false ]

Expand All @@ -123,6 +83,14 @@ jobs:
- db-version: '5.0'
- db-version: '5.1'
- db-version: '5.5'
- php: '7.2'
db-version: '8.4'
- php: '7.3'
db-version: '8.4'
- php: '7.2'
db-version: '9.0'
- php: '7.3'
db-version: '9.0'

services:
database:
Expand All @@ -131,13 +99,13 @@ jobs:
- 3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=30s
--health-timeout=10s
--health-retries=5
-e MYSQL_ROOT_PASSWORD=root
-e MYSQL_DATABASE=test_db
--health-interval="30s"
--health-timeout="10s"
--health-retries="5"
-e MYSQL_ROOT_PASSWORD="root"
-e MYSQL_DATABASE="test_db"
--entrypoint sh ${{ matrix.db-type }}:${{ matrix.db-version }}
-c "exec docker-entrypoint.sh mysqld${{ matrix.db-version != '5.5' && ' --default-authentication-plugin=mysql_native_password"' || '' }}
-c "exec docker-entrypoint.sh mysqld${{ matrix.db-type == 'mysql' && contains( fromJSON('["7.2", "7.3"]'), matrix.php ) && ' --default-authentication-plugin=mysql_native_password' || '' }}"
steps:
- name: Set up PHP ${{ matrix.php }}
Expand All @@ -147,10 +115,6 @@ jobs:
coverage: none
tools: wp-cli${{ contains( fromJSON('["5.4", "5.5"]'), matrix.php ) && ':2.4.0' || '' }}

- name: Start the database server
run: |
sudo systemctl start ${{ matrix.db-type }}
- name: Download WordPress
run: wp core download ${{ inputs.wp-version && format( '--version={0}', inputs.wp-version ) || '--version=nightly' }}

Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/javascript-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ on:
- '.jshintrc'
# Any change to the QUnit directory should run tests.
- 'tests/qunit/**'
# Changes to workflow files should always verify all workflows are successful.
- '.github/workflows/*.yml'
# Confirm any changes to relevant workflow files.
- '.github/workflows/javascript-tests.yml'
- '.github/workflows/reusable-javascript-tests.yml'
workflow_dispatch:

# Cancels all previous workflow runs for pull requests that have not completed.
Expand Down
154 changes: 154 additions & 0 deletions .github/workflows/local-docker-environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
name: Local Docker Environment

on:
push:
branches:
- trunk
- '6.[8-9]'
- '[7-9].[0-9]'
paths:
# Any changes to Docker related files.
- '.env.example'
- 'docker-compose.yml'
# Any changes to local environment related files
- 'tools/local-env/**'
# These files manage packages used by the local environment.
- 'package*.json'
# These files configure Composer. Changes could affect the local environment.
- 'composer.*'
# These files define the versions to test.
- '.version-support-*.json'
# Changes to this and related workflow files should always be verified.
- '.github/workflows/local-docker-environment.yml'
- '.github/workflows/reusable-support-json-reader-v1.yml'
- '.github/workflows/reusable-test-docker-environment-v1.yml'
pull_request:
branches:
- trunk
- '6.[8-9]'
- '[7-9].[0-9]'
paths:
# Any changes to Docker related files.
- '.env.example'
- 'docker-compose.yml'
# Any changes to local environment related files
- 'tools/local-env/**'
# These files manage packages used by the local environment.
- 'package*.json'
# These files configure Composer. Changes could affect the local environment.
- 'composer.*'
# These files define the versions to test.
- '.version-support-*.json'
# Changes to this and related workflow files should always be verified.
- '.github/workflows/local-docker-environment.yml'
- '.github/workflows/reusable-support-json-reader-v1.yml'
- '.github/workflows/reusable-test-docker-environment-v1.yml'
workflow_dispatch:

# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

# Disable permissions for all available scopes by default.
# Any needed permissions should be configured at the job level.
permissions: {}

jobs:
#
# Determines the appropriate supported values for PHP and database versions based on the WordPress
# version being tested.
#
build-test-matrix:
name: Build Test Matrix
uses: WordPress/wordpress-develop/.github/workflows/reusable-support-json-reader-v1.yml@trunk
permissions:
contents: read
secrets: inherit
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
with:
wp-version: ${{ github.event_name == 'pull_request' && github.base_ref || github.ref_name }}

# Tests the local Docker environment.
environment-tests-mysql:
name: PHP ${{ matrix.php }}
uses: WordPress/wordpress-develop/.github/workflows/reusable-test-local-docker-environment-v1.yml@trunk
permissions:
contents: read
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
needs: [ build-test-matrix ]
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
memcached: [ false, true ]
php: ${{ fromJSON( needs.build-test-matrix.outputs.php-versions ) }}
db-version: ${{ fromJSON( needs.build-test-matrix.outputs.mysql-versions ) }}

exclude:
# The MySQL 5.5 containers will not start.
- db-version: '5.5'
# MySQL 9.0+ will not work on PHP 7.2 & 7.3
- php: '7.2'
db-version: '9.0'
- php: '7.3'
db-version: '9.0'

with:
os: ${{ matrix.os }}
php: ${{ matrix.php }}
db-type: 'mysql'
db-version: ${{ matrix.db-version }}
memcached: ${{ matrix.memcached }}
tests-domain: ${{ matrix.tests-domain }}

slack-notifications:
name: Slack Notifications
uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
permissions:
actions: read
contents: read
needs: [ build-test-matrix, environment-tests-mysql ]
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: [ build-test-matrix, environment-tests-mysql, slack-notifications ]
if: |
always() &&
github.repository == 'WordPress/wordpress-develop' &&
github.event_name != 'pull_request' &&
github.run_attempt < 2 &&
(
contains( needs.*.result, 'cancelled' ) ||
contains( needs.*.result, 'failure' )
)
steps:
- name: Dispatch workflow run
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
retries: 2
retry-exempt-status-codes: 418
script: |
github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'failed-workflow.yml',
ref: 'trunk',
inputs: {
run_id: '${{ github.run_id }}'
}
});
2 changes: 2 additions & 0 deletions .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
memcached: [ true, false ]
with:
memcached: ${{ matrix.memcached }}
secrets:
CODEVITALS_PROJECT_TOKEN: ${{ secrets.CODEVITALS_PROJECT_TOKEN }}

slack-notifications:
name: Slack Notifications
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/php-compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ on:
- 'composer.*'
# This file configures PHP compatibility scanning. Changes could affect the outcome.
- 'phpcompat.xml.dist'
# Changes to workflow files should always verify all workflows are successful.
- '.github/workflows/*.yml'
# Confirm any changes to relevant workflow files.
- '.github/workflows/php-compatibility.yml'
- '.github/workflows/reusable-php-compatibility.yml'
workflow_dispatch:

# Cancels all previous workflow runs for pull requests that have not completed.
Expand Down
Loading

0 comments on commit af9a159

Please sign in to comment.