Skip to content

Commit

Permalink
Merge branch 'trunk' into 21022-bcrypt
Browse files Browse the repository at this point in the history
  • Loading branch information
johnbillion committed Dec 12, 2024
2 parents 09ddc5e + 9104190 commit e5f8d5c
Show file tree
Hide file tree
Showing 368 changed files with 6,535 additions and 2,721 deletions.
98 changes: 30 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,66 +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
# 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' }}
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
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 @@ -107,14 +65,14 @@ jobs:
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 @@ -125,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 @@ -133,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 @@ -149,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
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 }}'
}
});
36 changes: 22 additions & 14 deletions .github/workflows/phpunit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,50 +47,58 @@ jobs:
os: [ ubuntu-latest ]
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
db-type: [ 'mysql' ]
db-version: [ '5.7', '8.0', '8.1', '8.2', '8.3' ]
db-version: [ '5.7', '8.0', '8.4', '9.0' ]
tests-domain: [ 'example.org' ]
multisite: [ false, true ]
memcached: [ false ]

include:
# Include jobs for PHP 7.4 with memcached.
# Include jobs that test with memcached.
- os: ubuntu-latest
php: '7.4'
php: '8.3'
db-type: 'mysql'
db-version: '5.7'
db-version: '8.4'
tests-domain: 'example.org'
multisite: false
memcached: true
- os: ubuntu-latest
php: '7.4'
php: '8.3'
db-type: 'mysql'
db-version: '5.7'
db-version: '8.4'
tests-domain: 'example.org'
multisite: true
memcached: true
# Include jobs with a port on the test domain for both single and multisite.
- os: ubuntu-latest
php: '7.4'
php: '8.4'
db-type: 'mysql'
db-version: '5.7'
db-version: '8.4'
tests-domain: 'example.org:8889'
multisite: false
memcached: false
- os: ubuntu-latest
php: '7.4'
php: '8.4'
db-type: 'mysql'
db-version: '5.7'
db-version: '8.4'
tests-domain: 'example.org:8889'
multisite: true
memcached: false
# Report test results to the Host Test Results.
- os: ubuntu-latest
db-type: 'mysql'
db-version: '8.0'
db-version: '8.4'
tests-domain: 'example.org'
multisite: false
memcached: false
report: true

exclude:
# 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 }}
Expand Down Expand Up @@ -123,15 +131,15 @@ jobs:
memcached: [ false ]

include:
# Include jobs for PHP 7.4 with memcached.
# Include jobs that test with memcached.
- os: ubuntu-latest
php: '7.4'
php: '8.3'
db-type: 'mariadb'
db-version: '11.2'
multisite: false
memcached: true
- os: ubuntu-latest
php: '7.4'
php: '8.3'
db-type: 'mariadb'
db-version: '11.2'
multisite: true
Expand Down
Loading

0 comments on commit e5f8d5c

Please sign in to comment.