diff --git a/.env.example b/.env.example index 76a4744165505..5fc17c65f7fad 100644 --- a/.env.example +++ b/.env.example @@ -15,7 +15,7 @@ LOCAL_PORT=8889 LOCAL_DIR=src # The PHP version to use. Valid options are 'latest', and '{version}-fpm'. -LOCAL_PHP=latest +LOCAL_PHP=8.5-fpm # Whether or not to enable Xdebug. LOCAL_PHP_XDEBUG=false diff --git a/.github/workflows/check-built-files.yml b/.github/workflows/check-built-files.yml index 5f62f825c243e..0ba34ef332000 100644 --- a/.github/workflows/check-built-files.yml +++ b/.github/workflows/check-built-files.yml @@ -46,6 +46,6 @@ jobs: check-for-built-file-changes: name: Check built files if: ${{ github.repository == 'wordpress/wordpress-develop' }} - uses: ./.github/workflows/reusable-check-built-files.yml + uses: WordPress/wordpress-develop/.github/workflows/reusable-check-built-files.yml@trunk permissions: contents: read diff --git a/.github/workflows/cleanup-pull-requests.yml b/.github/workflows/cleanup-pull-requests.yml index 578710dcf56ac..6c8d38e67b0b7 100644 --- a/.github/workflows/cleanup-pull-requests.yml +++ b/.github/workflows/cleanup-pull-requests.yml @@ -25,4 +25,4 @@ jobs: permissions: pull-requests: write if: ${{ github.repository == 'WordPress/wordpress-develop' }} - uses: ./.github/workflows/reusable-cleanup-pull-requests.yml + uses: WordPress/wordpress-develop/.github/workflows/reusable-cleanup-pull-requests.yml@trunk diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 6f9fc831df92f..9d00eb90882d8 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -52,7 +52,7 @@ jobs: # Runs the PHP coding standards checks. phpcs: name: Coding standards - uses: ./.github/workflows/reusable-coding-standards-php.yml + uses: WordPress/wordpress-develop/.github/workflows/reusable-coding-standards-php.yml@trunk permissions: contents: read if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} @@ -60,14 +60,14 @@ jobs: # Runs the JavaScript coding standards checks. jshint: name: Coding standards - uses: ./.github/workflows/reusable-coding-standards-javascript.yml + uses: WordPress/wordpress-develop/.github/workflows/reusable-coding-standards-javascript.yml@trunk permissions: contents: read if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} slack-notifications: name: Slack Notifications - uses: ./.github/workflows/slack-notifications.yml + uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk permissions: actions: read contents: read diff --git a/.github/workflows/commit-built-file-changes.yml b/.github/workflows/commit-built-file-changes.yml deleted file mode 100644 index f7265274cf520..0000000000000 --- a/.github/workflows/commit-built-file-changes.yml +++ /dev/null @@ -1,168 +0,0 @@ -# Commits all missed changes to built files back to pull request branches. -name: Commit Built File Changes (PRs) - -on: - workflow_run: - workflows: - - 'Check Built Files (PRs)' - - 'Test Default Themes & Create ZIPs' - types: - - completed - -# 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 == 'workflow_run' && format( '{0}-{1}', github.event.workflow_run.head_branch, github.event.workflow_run.head_repository.name ) || github.sha }} - -# Disable permissions for all available scopes by default. -# Any needed permissions should be configured at the job level. -permissions: {} - -jobs: - # Checks a PR for uncommitted changes to built files. - # - # Performs the following steps: - # - Attempts to download the artifact containing the PR diff. - # - Checks for the existence of an artifact. - # - Unzips the artifact. - # - Generates a token for authenticating with the GitHub App. - # - Checks out the repository. - # - Applies the patch file. - # - Displays the result of git diff. - # - Configures the Git author. - # - Stages changes. - # - Commits changes. - # - Pushes changes. - update-built-files: - name: Check and update built files - runs-on: ubuntu-24.04 - if: ${{ github.repository == 'wordpress/wordpress-develop' }} - timeout-minutes: 10 - permissions: - contents: write - steps: - - name: Download artifact - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 - with: - script: | - const artifacts = await github.rest.actions.listWorkflowRunArtifacts( { - owner: context.repo.owner, - repo: context.repo.repo, - run_id: process.env.RUN_ID, - } ); - - const matchArtifact = artifacts.data.artifacts.filter( ( artifact ) => { - return artifact.name === 'pr-built-file-changes' - } )[0]; - - if ( ! matchArtifact ) { - core.info( 'No artifact found!' ); - return; - } - - const download = await github.rest.actions.downloadArtifact( { - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - } ); - - const fs = require( 'fs' ); - fs.writeFileSync( '${{ github.workspace }}/pr-built-file-changes.zip', Buffer.from( download.data ) ) - env: - RUN_ID: ${{ github.event.workflow_run.id }} - - - name: Check for artifact - id: artifact-check - run: | - if [ -f "pr-built-file-changes.zip" ]; then - echo "exists=true" >> "$GITHUB_OUTPUT" - else - echo "exists=false" >> "$GITHUB_OUTPUT" - fi - - - name: Unzip the artifact containing the PR data - if: ${{ steps.artifact-check.outputs.exists == 'true' }} - run: unzip pr-built-file-changes.zip - - - name: Generate Installation Token - id: generate_token - if: ${{ steps.artifact-check.outputs.exists == 'true' }} - env: - GH_APP_ID: ${{ secrets.GH_PR_BUILT_FILES_APP_ID }} - GH_APP_PRIVATE_KEY: ${{ secrets.GH_PR_BUILT_FILES_PRIVATE_KEY }} - run: | - echo "$GH_APP_PRIVATE_KEY" > private-key.pem - - # Generate JWT - JWT=$(python3 - <> "$GITHUB_ENV" - - rm -f private-key.pem - - - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - if: ${{ steps.artifact-check.outputs.exists == 'true' }} - with: - repository: ${{ github.event.workflow_run.head_repository.full_name }} - ref: ${{ github.event.workflow_run.head_branch }} - path: 'pr-repo' - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - token: ${{ env.ACCESS_TOKEN }} - - - name: Apply patch - if: ${{ steps.artifact-check.outputs.exists == 'true' }} - working-directory: 'pr-repo' - run: git apply ${{ github.workspace }}/changes.diff - - - name: Display changes to versioned files - if: ${{ steps.artifact-check.outputs.exists == 'true' }} - working-directory: 'pr-repo' - run: git diff - - - name: Configure git user name and email - if: ${{ steps.artifact-check.outputs.exists == 'true' }} - working-directory: 'pr-repo' - env: - GH_APP_ID: ${{ secrets.GH_PR_BUILT_FILES_APP_ID }} - run: | - git config user.name "wordpress-develop-pr-bot[bot]" - git config user.email ${{ env.GH_APP_ID }}+wordpress-develop-pr-bot[bot]@users.noreply.github.com - - - name: Stage changes - if: ${{ steps.artifact-check.outputs.exists == 'true' }} - working-directory: 'pr-repo' - run: git add . - - - name: Commit changes - if: ${{ steps.artifact-check.outputs.exists == 'true' }} - working-directory: 'pr-repo' - run: | - git commit -m "Automation: Updating built files with changes." - - - name: Push changes - if: ${{ steps.artifact-check.outputs.exists == 'true' }} - working-directory: 'pr-repo' - run: git push diff --git a/.github/workflows/end-to-end-tests.yml b/.github/workflows/end-to-end-tests.yml index 4e4bed002f95b..95bee81fc6423 100644 --- a/.github/workflows/end-to-end-tests.yml +++ b/.github/workflows/end-to-end-tests.yml @@ -57,7 +57,7 @@ jobs: # Runs the end-to-end test suite. e2e-tests: name: ${{ matrix.label }} - uses: ./.github/workflows/reusable-end-to-end-tests.yml + uses: WordPress/wordpress-develop/.github/workflows/reusable-end-to-end-tests.yml@trunk permissions: contents: read if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} @@ -72,7 +72,7 @@ jobs: slack-notifications: name: Slack Notifications - uses: ./.github/workflows/slack-notifications.yml + uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk permissions: actions: read contents: read diff --git a/.github/workflows/failed-workflow.yml b/.github/workflows/failed-workflow.yml deleted file mode 100644 index 6df8999464a68..0000000000000 --- a/.github/workflows/failed-workflow.yml +++ /dev/null @@ -1,56 +0,0 @@ -## -# Performs follow-up tasks when a workflow fails or is cancelled. -## -name: Failed Workflow - -on: - workflow_dispatch: - inputs: - run_id: - description: 'ID of the GitHub Action workflow run to rerun' - required: true - type: 'string' - -# Disable permissions for all available scopes by default. -# Any needed permissions should be configured at the job level. -permissions: {} - -jobs: - # Attempts to rerun a workflow. - # - # Performs the following steps: - # - Retrieves the workflow run that dispatched this workflow. - # - Restarts all failed jobs when the workflow fails or is cancelled for the first time. - failed-workflow: - name: Rerun a workflow - runs-on: ubuntu-24.04 - permissions: - actions: write - timeout-minutes: 30 - - steps: - - name: Rerun a workflow - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 - with: - retries: 15 - retry-exempt-status-codes: 418 - script: | - const workflow_run = await github.rest.actions.getWorkflowRun({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: process.env.RUN_ID, - }); - - // Only rerun after the first run attempt. - if ( workflow_run.data.run_attempt > 1 ) { - return; - } - - const rerun = await github.rest.actions.reRunWorkflowFailedJobs({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: process.env.RUN_ID, - enable_debug_logging: true - }); - env: - RUN_ID: ${{ inputs.run_id }} diff --git a/.github/workflows/install-testing.yml b/.github/workflows/install-testing.yml deleted file mode 100644 index 844f8bd117729..0000000000000 --- a/.github/workflows/install-testing.yml +++ /dev/null @@ -1,187 +0,0 @@ -# Confirms that installing WordPress using WP-CLI works successfully. -# -# This workflow is not meant to test wordpress-develop checkouts, but rather tagged versions officially available on WordPress.org. -name: Installation Tests - -on: - push: - branches: - - trunk - # Always test the workflow after it's updated. - 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: - - '.version-support-*.json' - - '.github/workflows/install-testing.yml' - - '.github/workflows/reusable-support-json-reader-v1.yml' - - schedule: - - cron: '0 0 * * 1' - workflow_dispatch: - inputs: - wp-version: - description: 'The version to test installing. Accepts major and minor versions, "latest", or "nightly". Major releases must not end with ".0".' - type: string - default: 'nightly' - -# 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 }}-${{ inputs.wp-version || 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 supported values for PHP and database versions based on the WordPress version being tested. - build-test-matrix: - name: Build Test Matrix - uses: ./.github/workflows/reusable-support-json-reader-v1.yml - permissions: - contents: read - secrets: inherit - if: ${{ github.repository == 'WordPress/wordpress-develop' }} - with: - wp-version: ${{ inputs.wp-version }} - - # Test the WordPress installation process through WP-CLI. - # - # Performs the following steps: - # - Sets up PHP. - # - Downloads the specified version of WordPress. - # - Creates a `wp-config.php` file. - # - Installs WordPress. - install-tests-mysql: - name: WP ${{ inputs.wp-version || 'nightly' }} / PHP ${{ matrix.php }} / ${{ 'mariadb' == matrix.db-type && 'MariaDB' || 'MySQL' }} ${{ matrix.db-version }}${{ matrix.multisite && ' multisite' || '' }} - permissions: - contents: read - runs-on: ${{ matrix.os }} - if: ${{ github.repository == 'WordPress/wordpress-develop' }} - timeout-minutes: 10 - needs: [ build-test-matrix ] - strategy: - fail-fast: false - matrix: - os: [ ubuntu-24.04 ] - php: ${{ fromJSON( needs.build-test-matrix.outputs.php-versions ) }} - db-type: [ 'mysql' ] - db-version: ${{ fromJSON( needs.build-test-matrix.outputs.mysql-versions ) }} - multisite: [ false, true ] - memcached: [ false ] - - # Exclude some PHP and MySQL versions that cannot currently be tested with Docker containers. - exclude: - # There are no local WordPress Docker environment containers for PHP <= 5.3. - - php: '5.2' - - php: '5.3' - # MySQL containers <= 5.5 do not exist or fail to start properly. - - db-version: '5.0' - - db-version: '5.1' - - db-version: '5.5' - # The PHP <= 7.3/MySQL 8.4 jobs currently fail due to mysql_native_password being disabled by default. See https://core.trac.wordpress.org/ticket/61218. - - php: '7.2' - db-version: '8.4' - - php: '7.3' - db-version: '8.4' - # Only test the latest innovation release. - - db-version: '9.0' - - db-version: '9.1' - - db-version: '9.2' - - db-version: '9.3' - # MySQL 9.0+ will not work on PHP 7.2 & 7.3. See https://core.trac.wordpress.org/ticket/61218. - - php: '7.2' - db-version: '9.4' - - php: '7.3' - db-version: '9.4' - - services: - database: - image: ${{ matrix.db-type }}:${{ matrix.db-version }} - ports: - - 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" - --entrypoint sh ${{ matrix.db-type }}:${{ matrix.db-version }} - -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 }} - uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # v2.35.5 - with: - php-version: '${{ matrix.php }}' - coverage: none - tools: ${{ contains( fromJSON('["5.4", "5.5"]'), matrix.php ) && 'wp-cli:2.4.0' || 'wp-cli' }} - - - name: Download WordPress - run: wp core download --version="${WP_VERSION}" - env: - WP_VERSION: ${{ inputs.wp-version || 'nightly' }} - - - name: Create wp-config.php file - run: wp config create --dbname=test_db --dbuser=root --dbpass=root --dbhost="127.0.0.1:${DB_PORT}" - env: - DB_PORT: ${{ job.services.database.ports['3306'] }} - - - name: Install WordPress - run: wp core ${{ matrix.multisite && 'multisite-install' || 'install' }} --url=http://localhost/ --title="Upgrade Test" --admin_user=admin --admin_password=password --admin_email=me@example.org --skip-email - - slack-notifications: - name: Slack Notifications - uses: ./.github/workflows/slack-notifications.yml - permissions: - actions: read - contents: read - needs: [ install-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-24.04 - permissions: - actions: write - needs: [ 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@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 - 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: `${context.runId}`, - } - }); diff --git a/.github/workflows/javascript-tests.yml b/.github/workflows/javascript-tests.yml index ec23fdfefa54d..943fd3fb9ddbf 100644 --- a/.github/workflows/javascript-tests.yml +++ b/.github/workflows/javascript-tests.yml @@ -53,14 +53,14 @@ jobs: # Runs the WordPress Core JavaScript tests. test-js: name: QUnit Tests - uses: ./.github/workflows/reusable-javascript-tests.yml + uses: WordPress/wordpress-develop/.github/workflows/reusable-javascript-tests.yml@trunk permissions: contents: read if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} slack-notifications: name: Slack Notifications - uses: ./.github/workflows/slack-notifications.yml + uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk permissions: actions: read contents: read diff --git a/.github/workflows/local-docker-environment.yml b/.github/workflows/local-docker-environment.yml index 490fb2a93f376..798dd6dae4039 100644 --- a/.github/workflows/local-docker-environment.yml +++ b/.github/workflows/local-docker-environment.yml @@ -74,7 +74,7 @@ jobs: # build-test-matrix: name: Build Test Matrix - uses: ./.github/workflows/reusable-support-json-reader-v1.yml + uses: WordPress/wordpress-develop/.github/workflows/reusable-support-json-reader-v1.yml@trunk permissions: contents: read secrets: inherit @@ -85,7 +85,7 @@ jobs: # Tests the local Docker environment. environment-tests-mysql: name: PHP ${{ matrix.php }} - uses: ./.github/workflows/reusable-test-local-docker-environment-v1.yml + uses: WordPress/wordpress-develop/.github/workflows/reusable-test-local-docker-environment-v1.yml@trunk permissions: contents: read needs: [ build-test-matrix ] @@ -123,7 +123,7 @@ jobs: slack-notifications: name: Slack Notifications - uses: ./.github/workflows/slack-notifications.yml + uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk permissions: actions: read contents: read diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml index 636dce5db56ef..a2f20f0ffe752 100644 --- a/.github/workflows/performance.yml +++ b/.github/workflows/performance.yml @@ -95,7 +95,7 @@ jobs: # Runs the performance test suite. performance: name: ${{ matrix.multisite && 'Multisite' || 'Single Site' }} ${{ matrix.memcached && 'Memcached' || 'Default' }} - uses: ./.github/workflows/reusable-performance-test-v2.yml + uses: WordPress/wordpress-develop/.github/workflows/reusable-performance-test-v2.yml@trunk needs: [ determine-matrix ] permissions: contents: read @@ -113,7 +113,7 @@ jobs: compare: name: ${{ matrix.label }} - uses: ./.github/workflows/reusable-performance-report-v2.yml + uses: WordPress/wordpress-develop/.github/workflows/reusable-performance-report-v2.yml@trunk needs: [ determine-matrix, performance ] permissions: contents: read @@ -134,7 +134,7 @@ jobs: slack-notifications: name: Slack Notifications - uses: ./.github/workflows/slack-notifications.yml + uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk permissions: actions: read contents: read diff --git a/.github/workflows/php-compatibility.yml b/.github/workflows/php-compatibility.yml index bd81c8958daa6..9f47aa1002a10 100644 --- a/.github/workflows/php-compatibility.yml +++ b/.github/workflows/php-compatibility.yml @@ -44,14 +44,14 @@ jobs: # Runs PHP compatibility testing. php-compatibility: name: Check PHP compatibility - uses: ./.github/workflows/reusable-php-compatibility.yml + uses: WordPress/wordpress-develop/.github/workflows/reusable-php-compatibility.yml@trunk permissions: contents: read if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} slack-notifications: name: Slack Notifications - uses: ./.github/workflows/slack-notifications.yml + uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk permissions: actions: read contents: read diff --git a/.github/workflows/phpunit-tests.yml b/.github/workflows/phpunit-tests.yml index f2583d16d2874..65efa0825aeeb 100644 --- a/.github/workflows/phpunit-tests.yml +++ b/.github/workflows/phpunit-tests.yml @@ -63,7 +63,7 @@ jobs: # test-with-mysql: name: PHP ${{ matrix.php }} - uses: ./.github/workflows/reusable-phpunit-tests-v3.yml + uses: WordPress/wordpress-develop/.github/workflows/reusable-phpunit-tests-v3.yml@trunk permissions: contents: read secrets: inherit @@ -199,7 +199,7 @@ jobs: # test-with-mariadb: name: PHP ${{ matrix.php }} - uses: ./.github/workflows/reusable-phpunit-tests-v3.yml + uses: WordPress/wordpress-develop/.github/workflows/reusable-phpunit-tests-v3.yml@trunk permissions: contents: read secrets: inherit @@ -422,7 +422,7 @@ jobs: # test-innovation-releases: name: PHP ${{ matrix.php }} - uses: ./.github/workflows/reusable-phpunit-tests-v3.yml + uses: WordPress/wordpress-develop/.github/workflows/reusable-phpunit-tests-v3.yml@trunk permissions: contents: read secrets: inherit @@ -489,7 +489,7 @@ jobs: # html-api-test-groups: name: ${{ matrix.label }} - uses: ./.github/workflows/reusable-phpunit-tests-v3.yml + uses: WordPress/wordpress-develop/.github/workflows/reusable-phpunit-tests-v3.yml@trunk permissions: contents: read secrets: inherit @@ -518,7 +518,7 @@ jobs: # limited-matrix-for-forks: name: PHP ${{ matrix.php }} - uses: ./.github/workflows/reusable-phpunit-tests-v3.yml + uses: WordPress/wordpress-develop/.github/workflows/reusable-phpunit-tests-v3.yml@trunk permissions: contents: read secrets: inherit @@ -569,7 +569,7 @@ jobs: slack-notifications: name: Slack Notifications - uses: ./.github/workflows/slack-notifications.yml + uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk permissions: actions: read contents: read diff --git a/.github/workflows/reusable-build-package.yml b/.github/workflows/reusable-build-package.yml deleted file mode 100644 index 8361c1c9e7a99..0000000000000 --- a/.github/workflows/reusable-build-package.yml +++ /dev/null @@ -1,60 +0,0 @@ -## -# A reusable workflow that builds and packages WordPress. The resulting package can be used to test upgrading and installing. -## -name: Build and package WordPress - -on: - workflow_call: - -# Disable permissions for all available scopes by default. -# Any needed permissions should be configured at the job level. -permissions: {} - -jobs: - # Builds and packages WordPress. - # - # Performs the following steps: - # - Checks out the repository. - # - Sets up Node.js. - # - Runs the build script. - # - Prepares the directory structure for the ZIP. - # - Creates a ZIP of the built files. - # - Uploads the ZIP as a GitHub Actions artifact. - build: - name: WordPress - permissions: - contents: read - runs-on: ubuntu-24.04 - timeout-minutes: 20 - - steps: - - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - persist-credentials: false - - - name: Set up Node.js - uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 - with: - node-version-file: '.nvmrc' - cache: npm - - - name: Install npm Dependencies - run: npm ci - - - name: Build WordPress - run: npm run build - - - name: Prepare the directory structure for the ZIP - run: mv build wordpress - - - name: Create ZIP of built files - run: zip -q -r develop.zip wordpress/. - - - name: Upload ZIP as a GitHub Actions artifact - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 - with: - name: wordpress-develop - path: develop.zip - if-no-files-found: error diff --git a/.github/workflows/reusable-check-built-files.yml b/.github/workflows/reusable-check-built-files.yml deleted file mode 100644 index f9bcab80343ab..0000000000000 --- a/.github/workflows/reusable-check-built-files.yml +++ /dev/null @@ -1,110 +0,0 @@ -## -# A reusable workflow that checks for uncommitted changes to built files in pull requests. -## -name: Check Built Files (PRs) - -on: - workflow_call: - -permissions: {} - -jobs: - # Checks a PR for uncommitted changes to built files. - # - # When changes are detected, the patch is stored as an artifact for processing by the Commit Built File Changes - # workflow. - # - # Performs the following steps: - # - Checks out the repository. - # - Sets up Node.js. - # - Configures caching for Composer. - # - Installs Composer dependencies. - # - Logs general debug information about the runner. - # - Installs npm dependencies. - # - Builds CSS file using SASS. - # - Builds Emoji files. - # - Builds bundled Root Certificate files. - # - Builds WordPress. - # - Checks for changes to versioned files. - # - Displays the result of git diff for debugging purposes. - # - Saves the diff to a patch file. - # - Uploads the patch file as an artifact. - update-built-files: - name: Check and update built files - runs-on: ubuntu-24.04 - timeout-minutes: 10 - permissions: - contents: read - steps: - - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Set up Node.js - uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 - with: - node-version-file: '.nvmrc' - cache: npm - - # This date is used to ensure that the PHPCS cache is cleared at least once every week. - # http://man7.org/linux/man-pages/man1/date.1.html - - name: "Get last Monday's date" - id: get-date - run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> "$GITHUB_OUTPUT" - - # Since Composer dependencies are installed using `composer update` and no lock file is in version control, - # passing a custom cache suffix ensures that the cache is flushed at least once per week. - - name: Install Composer dependencies - uses: ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520 # v3.1.1 - with: - custom-cache-suffix: ${{ steps.get-date.outputs.date }} - - - name: Log debug information - run: | - npm --version - node --version - curl --version - git --version - - - name: Install npm Dependencies - run: npm ci - - - name: Run SASS precommit tasks - run: npm run grunt precommit:css - - - name: Run Emoji precommit task - run: npm run grunt precommit:emoji - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Run certificate tasks - run: npm run grunt copy:certificates - - - name: Build WordPress - run: npm run build:dev - - - name: Check for changes to versioned files - id: built-file-check - run: | - if git diff --quiet; then - echo "uncommitted_changes=false" >> "$GITHUB_OUTPUT" - else - echo "uncommitted_changes=true" >> "$GITHUB_OUTPUT" - fi - - - name: Display changes to versioned files - if: ${{ steps.built-file-check.outputs.uncommitted_changes == 'true' }} - run: git diff - - - name: Save diff to a file - if: ${{ steps.built-file-check.outputs.uncommitted_changes == 'true' }} - run: git diff > ./changes.diff - - # Uploads the diff file as an artifact. - - name: Upload diff file as artifact - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 - if: ${{ steps.built-file-check.outputs.uncommitted_changes == 'true' }} - with: - name: pr-built-file-changes - path: changes.diff diff --git a/.github/workflows/reusable-cleanup-pull-requests.yml b/.github/workflows/reusable-cleanup-pull-requests.yml deleted file mode 100644 index 9dae63cb213d3..0000000000000 --- a/.github/workflows/reusable-cleanup-pull-requests.yml +++ /dev/null @@ -1,122 +0,0 @@ -## -# A reusable workflow that finds and closes any pull requests that are linked to Trac -# tickets that are referenced as fixed in commit messages. -# -# More info about using GitHub pull requests for contributing to WordPress can be found in the handbook: https://make.wordpress.org/core/handbook/contribute/git/github-pull-requests-for-code-review/. -## -name: Run pull request cleanup - -on: - workflow_call: - -jobs: - # Finds and closes pull requests referencing fixed Trac tickets in commit messages using the - # documented expected format - # - # Commit message format is documented in the Core handbook: https://make.wordpress.org/core/handbook/best-practices/commit-messages/. - # - # Performs the following steps: - # - Parse fixed ticket numbers from the commit message. - # - Parse the SVN revision from the commit message. - # - Searches for pull requests referencing any fixed tickets. - # - Leaves a comment on each PR before closing. - close-prs: - name: Find and close PRs - runs-on: ubuntu-24.04 - permissions: - pull-requests: write - - steps: - - name: Find fixed ticket numbers - id: trac-tickets - env: - COMMIT_MSG_RAW: ${{ github.event.head_commit.message }} - run: | - COMMIT_MESSAGE="$(echo "$COMMIT_MSG_RAW" | sed -n '/^Fixes #/,/\./p')" - echo "fixed_list=$(echo "$COMMIT_MESSAGE" | sed -n 's/.*Fixes #\([0-9]\+\).*/\1/p' | tr '\n' ' ')" >> "$GITHUB_OUTPUT" - - - name: Get the SVN revision - id: git-svn-id - env: - COMMIT_MSG_RAW: ${{ github.event.head_commit.message }} - run: | - COMMIT_MESSAGE="$(echo "$COMMIT_MSG_RAW" | sed -n '$p')" - echo "svn_revision_number=$(echo "$COMMIT_MESSAGE" | sed -n 's/.*git-svn-id: https:\/\/develop.svn.wordpress.org\/[^@]*@\([0-9]*\) .*/\1/p')" >> "$GITHUB_OUTPUT" - - - name: Find pull requests - id: linked-prs - if: ${{ steps.trac-tickets.outputs.fixed_list != '' && steps.git-svn-id.outputs.svn_revision_number != '' }} - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 - with: - script: | - const fixedList = "${{ steps.trac-tickets.outputs.fixed_list }}".split(' ').filter(Boolean); - let prNumbers = []; - - for (const ticket of fixedList) { - const tracTicketUrl = `https://core.trac.wordpress.org/ticket/${ticket}`; - const corePrefix = `core-${ticket}`; - - const query = ` - query($searchQuery: String!) { - search(query: $searchQuery, type: ISSUE_ADVANCED, first: 20) { - nodes { - ... on PullRequest { - number - bodyText - } - } - } - } - `; - - const searchQuery = `repo:${context.repo.owner}/${context.repo.repo} is:pr is:open ( "${tracTicketUrl}" OR "${corePrefix}" )`; - - const result = await github.graphql(query, { - searchQuery, - }); - - // Since search queries will match anywhere for any activity on a pull request, the body specifically needs to be manually checked. - const matchingPRs = result.search.nodes - .filter(pr => { - const bodyLower = pr.bodyText.toLowerCase(); - - return bodyLower.includes(tracTicketUrl.toLowerCase()) || bodyLower.includes(corePrefix.toLowerCase()); - }).map(pr => pr.number); - - prNumbers.push(...matchingPRs); - } - - return prNumbers; - - - name: Comment and close pull requests - if: ${{ steps.trac-tickets.outputs.fixed_list != '' && steps.git-svn-id.outputs.svn_revision_number != '' }} - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 - with: - script: | - const prNumbers = ${{ steps.linked-prs.outputs.result }}; - - const commentBody = `A commit was made that fixes the Trac ticket referenced in the description of this pull request. - - SVN changeset: [${{ steps.git-svn-id.outputs.svn_revision_number }}](https://core.trac.wordpress.org/changeset/${{ steps.git-svn-id.outputs.svn_revision_number }}) - GitHub commit: https://github.com/WordPress/wordpress-develop/commit/${{ github.sha }} - - This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.`; - - // Update all matched pull requests. - for (const prNumber of prNumbers) { - // Comment on the pull request with details. - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: prNumber, - body: commentBody - }); - - // Close the pull request. - await github.rest.pulls.update({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: prNumber, - state: 'closed' - }); - } diff --git a/.github/workflows/reusable-coding-standards-javascript.yml b/.github/workflows/reusable-coding-standards-javascript.yml deleted file mode 100644 index e9f41e82d4b3e..0000000000000 --- a/.github/workflows/reusable-coding-standards-javascript.yml +++ /dev/null @@ -1,61 +0,0 @@ -## -# A reusable workflow that checks the JavaScript coding standards. -## -name: JavaScript coding standards - -on: - workflow_call: - -env: - PUPPETEER_SKIP_DOWNLOAD: ${{ true }} - -# Disable permissions for all available scopes by default. -# Any needed permissions should be configured at the job level. -permissions: {} - -jobs: - # Runs the JavaScript coding standards checks. - # - # JSHint violations are not currently reported inline with annotations. - # - # Performs the following steps: - # - Checks out the repository. - # - Sets up Node.js. - # - Logs debug information about the GitHub Action runner. - # - Installs npm dependencies. - # - Run the WordPress JSHint checks. - # - Ensures version-controlled files are not modified or deleted. - jshint: - name: JavaScript checks - runs-on: ubuntu-24.04 - permissions: - contents: read - timeout-minutes: 20 - - steps: - - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - persist-credentials: false - - - name: Set up Node.js - uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 - with: - node-version-file: '.nvmrc' - cache: npm - - - name: Log debug information - run: | - npm --version - node --version - git --version - - - name: Install npm Dependencies - run: npm ci - - - name: Run JSHint - run: npm run grunt jshint - - - name: Ensure version-controlled files are not modified or deleted - run: git diff --exit-code diff --git a/.github/workflows/reusable-coding-standards-php.yml b/.github/workflows/reusable-coding-standards-php.yml deleted file mode 100644 index db343aa5b819c..0000000000000 --- a/.github/workflows/reusable-coding-standards-php.yml +++ /dev/null @@ -1,108 +0,0 @@ -## -# A reusable workflow that checks the PHP coding standards. -## -name: PHP coding standards - -on: - workflow_call: - inputs: - php-version: - description: 'The PHP version to use.' - required: false - type: 'string' - default: 'latest' - old-branch: - description: 'Whether this is an old branch that runs phpcbf instead of phpcs' - required: false - type: 'boolean' - default: false - -# Disable permissions for all available scopes by default. -# Any needed permissions should be configured at the job level. -permissions: {} - -jobs: - # Runs the PHP coding standards checks. - # - # Violations are reported inline with annotations. - # - # Performs the following steps: - # - Checks out the repository. - # - Sets up PHP. - # - Configures caching for PHPCS scans. - # - Installs Composer dependencies. - # - Make Composer packages available globally. - # - Runs PHPCS on the full codebase (warnings excluded). - # - Generate a report for displaying issues as pull request annotations. - # - Runs PHPCS on the `tests` directory without (warnings included). - # - Generate a report for displaying `test` directory issues as pull request annotations. - # - Ensures version-controlled files are not modified or deleted. - phpcs: - name: PHP checks - runs-on: ubuntu-24.04 - permissions: - contents: read - timeout-minutes: 20 - - steps: - - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - persist-credentials: false - - - name: Set up PHP - uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # v2.35.5 - with: - php-version: ${{ inputs.php-version }} - coverage: none - tools: cs2pr - - # This date is used to ensure that the PHPCS cache is cleared at least once every week. - # http://man7.org/linux/man-pages/man1/date.1.html - - name: "Get last Monday's date" - id: get-date - run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> "$GITHUB_OUTPUT" - - - name: Cache PHPCS scan cache - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 - with: - path: | - .cache/phpcs-src.json - .cache/phpcs-tests.json - key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-php-${{ inputs.php-version }}-phpcs-cache-${{ hashFiles('**/composer.json', 'phpcs.xml.dist') }} - - # Since Composer dependencies are installed using `composer update` and no lock file is in version control, - # passing a custom cache suffix ensures that the cache is flushed at least once per week. - - name: Install Composer dependencies - uses: ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520 # v3.1.1 - with: - custom-cache-suffix: ${{ steps.get-date.outputs.date }} - - - name: Make Composer packages available globally - run: echo "${PWD}/vendor/bin" >> "$GITHUB_PATH" - - - name: Run PHPCS on all Core files - id: phpcs-core - if: ${{ ! inputs.old-branch }} - run: phpcs -n --report-full --cache=./.cache/phpcs-src.json --report-checkstyle=./.cache/phpcs-report.xml - - - name: Show PHPCS results in PR - if: ${{ always() && steps.phpcs-core.outcome == 'failure' }} - run: cs2pr ./.cache/phpcs-report.xml - - - name: Check test suite files for warnings - id: phpcs-tests - if: ${{ ! inputs.old-branch }} - run: phpcs tests --report-full --cache=./.cache/phpcs-tests.json --report-checkstyle=./.cache/phpcs-tests-report.xml - - - name: Show test suite scan results in PR - if: ${{ always() && steps.phpcs-tests.outcome == 'failure' }} - run: cs2pr ./.cache/phpcs-tests-report.xml - - - name: Run PHPCBF on all Core files (old branches) - if: ${{ inputs.old-branch }} - run: phpcbf - - - name: Ensure version-controlled files are not modified during the tests - run: git diff --exit-code diff --git a/.github/workflows/reusable-end-to-end-tests.yml b/.github/workflows/reusable-end-to-end-tests.yml deleted file mode 100644 index 620949d7a6717..0000000000000 --- a/.github/workflows/reusable-end-to-end-tests.yml +++ /dev/null @@ -1,157 +0,0 @@ -## -# A reusable workflow that runs end-to-end tests. -# -# Branches 6.3 and earlier used Puppeteer instead of Playwright. -# Use https://github.com/WordPress/wordpress-develop/tree/6.3/.github/workflows/reusable-end-to-end-tests.yml instead. -## -name: End-to-end Tests - -on: - workflow_call: - inputs: - LOCAL_SCRIPT_DEBUG: - description: 'Whether to enable script debugging.' - required: false - type: 'boolean' - default: false - php-version: - description: 'The PHP version to use.' - required: false - type: 'string' - default: 'latest' - install-gutenberg: - description: 'Whether to install the Gutenberg plugin.' - required: false - type: 'boolean' - default: true - gutenberg-version: - description: 'A specific version of Gutenberg to install.' - required: false - type: 'string' - install-playwright: - description: 'Whether to install Playwright browsers.' - required: false - type: 'boolean' - default: true - -env: - LOCAL_DIR: build - LOCAL_PHP: ${{ inputs.php-version }}${{ 'latest' != inputs.php-version && '-fpm' || '' }} - -# Disable permissions for all available scopes by default. -# Any needed permissions should be configured at the job level. -permissions: {} - -jobs: - # Runs the end-to-end test suite. - # - # Performs the following steps: - # - Sets environment variables. - # - Checks out the repository. - # - 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. - # - Install additional languages. - # - Run the E2E tests. - # - Uploads screenshots and HTML snapshots as an artifact. - # - Ensures version-controlled files are not modified or deleted. - e2e-tests: - name: SCRIPT_DEBUG ${{ inputs.LOCAL_SCRIPT_DEBUG && 'enabled' || 'disabled' }} - runs-on: ubuntu-24.04 - permissions: - contents: read - timeout-minutes: 20 - - steps: - - name: Configure environment variables - run: | - echo "PHP_FPM_UID=$(id -u)" >> "$GITHUB_ENV" - echo "PHP_FPM_GID=$(id -g)" >> "$GITHUB_ENV" - - - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - persist-credentials: false - - - name: Set up Node.js - uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 - with: - node-version-file: '.nvmrc' - cache: npm - - - name: Log debug information - run: | - npm --version - node --version - curl --version - git --version - locale -a - - - name: Install npm Dependencies - run: npm ci - - - name: Install Playwright browsers - if: ${{ inputs.install-playwright }} - run: npx playwright install --with-deps - - - name: Build WordPress - run: npm run build - - - name: Start Docker environment - run: | - npm run env:start - - - name: Log running Docker containers - run: docker ps -a - - - name: Docker debug information - run: | - docker -v - docker compose run --rm mysql mysql --version - docker compose run --rm php php --version - docker compose run --rm php php -m - docker compose run --rm php php -i - docker compose run --rm php locale -a - - - name: Install WordPress - env: - LOCAL_SCRIPT_DEBUG: ${{ inputs.LOCAL_SCRIPT_DEBUG }} - run: npm run env:install - - - name: Install Gutenberg - if: ${{ inputs.install-gutenberg }} - run: | - npm run env:cli -- plugin install gutenberg \ - ${{ inputs.gutenberg-version && '--version="${GUTENBERG_VERSION}"' || '' }} \ - --path="/var/www/${LOCAL_DIR}" - env: - GUTENBERG_VERSION: ${{ inputs.gutenberg-version }} - - - name: Install additional languages - run: | - npm run env:cli -- language core install de_DE --path="/var/www/${LOCAL_DIR}" - npm run env:cli -- language plugin install de_DE --all --path="/var/www/${LOCAL_DIR}" - npm run env:cli -- language theme install de_DE --all --path="/var/www/${LOCAL_DIR}" - - - name: Run E2E tests - run: npm run test:e2e - - - name: Archive debug artifacts (screenshots, HTML snapshots) - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 - if: always() - with: - name: failures-artifacts${{ inputs.LOCAL_SCRIPT_DEBUG && '-SCRIPT_DEBUG' || '' }}-${{ github.run_id }} - path: artifacts - if-no-files-found: ignore - include-hidden-files: true - - - name: Ensure version-controlled files are not modified or deleted - run: git diff --exit-code diff --git a/.github/workflows/reusable-javascript-tests.yml b/.github/workflows/reusable-javascript-tests.yml deleted file mode 100644 index 0fa37c589b2f7..0000000000000 --- a/.github/workflows/reusable-javascript-tests.yml +++ /dev/null @@ -1,71 +0,0 @@ -## -# A reusable workflow that runs JavaScript tests. -## -name: JavaScript tests - -on: - workflow_call: - inputs: - disable-apparmor: - description: 'Whether to disable AppArmor.' - required: false - type: 'boolean' - default: false - -# Disable permissions for all available scopes by default. -# Any needed permissions should be configured at the job level. -permissions: {} - -jobs: - # Runs the QUnit test suite. - # - # Performs the following steps: - # - Checks out the repository. - # - Sets up Node.js. - # - Logs debug information about the GitHub Action runner. - # - Installs npm dependencies. - # - Run the WordPress QUnit tests. - # - Ensures version-controlled files are not modified or deleted. - test-js: - name: Run QUnit tests - runs-on: ubuntu-24.04 - permissions: - contents: read - timeout-minutes: 20 - - steps: - - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - persist-credentials: false - - - name: Set up Node.js - uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 - with: - node-version-file: '.nvmrc' - cache: npm - - - name: Log debug information - run: | - npm --version - node --version - git --version - - - name: Install npm Dependencies - run: npm ci - - # Older branches using outdated versions of Puppeteer fail on newer versions of the `ubuntu-24` image. - # This disables AppArmor in order to work around those failures. - # - # See https://issues.chromium.org/issues/373753919 - # and https://chromium.googlesource.com/chromium/src/+/main/docs/security/apparmor-userns-restrictions.md - - name: Disable AppArmor - if: ${{ inputs.disable-apparmor }} - run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns - - - name: Run QUnit tests - run: npm run grunt qunit:compiled - - - name: Ensure version-controlled files are not modified or deleted - run: git diff --exit-code diff --git a/.github/workflows/reusable-performance-report-v2.yml b/.github/workflows/reusable-performance-report-v2.yml deleted file mode 100644 index 988e60310d950..0000000000000 --- a/.github/workflows/reusable-performance-report-v2.yml +++ /dev/null @@ -1,114 +0,0 @@ -## -# A reusable workflow that compares and publishes the performance tests. -## -name: Compare and publish performance Tests - -on: - workflow_call: - inputs: - BASE_TAG: - description: 'The version being used for baseline measurements.' - required: true - type: string - memcached: - description: 'Whether to enable memcached.' - required: false - type: boolean - default: false - multisite: - description: 'Whether to use Multisite.' - required: false - type: boolean - default: false - publish: - description: 'Whether to publish the results to Code Vitals.' - required: false - type: boolean - default: false - secrets: - CODEVITALS_PROJECT_TOKEN: - description: 'The authorization token for https://www.codevitals.run/project/wordpress.' - required: false - -env: - BASE_TAG: ${{ inputs.BASE_TAG }} - -# Disable permissions for all available scopes by default. -# Any needed permissions should be configured at the job level. -permissions: {} - -jobs: - # Performs the following steps: - # - Checkout repository. - # - Set up Node.js. - # - Download the relevant performance test artifacts. - # - List the downloaded files for debugging. - # - Compare results. - # - Add workflow summary. - # - Determine the sha of the baseline tag if necessary. - # - Publish performance results if necessary. - compare: - name: ${{ inputs.multisite && 'Multisite' || 'Single Site' }} ${{ inputs.memcached && 'Memcached' || 'Default' }} ${{ inputs.publish && '(Publishes)' || '' }} - runs-on: ubuntu-24.04 - permissions: - contents: read - - steps: - - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - fetch-depth: ${{ github.event_name == 'workflow_dispatch' && '2' || '1' }} - persist-credentials: false - - - name: Set up Node.js - uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 - with: - node-version-file: '.nvmrc' - cache: npm - - - name: Download artifacts - uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 - with: - pattern: performance-${{ inputs.multisite && 'multisite' || 'single' }}-${{ inputs.memcached && 'memcached' || 'default' }}-* - path: artifacts - merge-multiple: true - - - name: List files - run: tree artifacts - - - name: Compare results - run: node ./tests/performance/compare-results.js "${RUNNER_TEMP}/summary.md" - - - name: Add workflow summary - run: cat "${RUNNER_TEMP}/summary.md" >> "$GITHUB_STEP_SUMMARY" - - - name: Set the base sha - # Only needed when publishing results. - if: ${{ inputs.publish }} - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 - id: base-sha - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - result-encoding: string - script: | - const baseRef = await github.rest.git.getRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: 'tags/' + process.env.BASE_TAG, - }); - return baseRef.data.object.sha; - - - name: Publish performance results - if: ${{ inputs.publish }} - env: - BASE_SHA: ${{ steps.base-sha.outputs.result }} - CODEVITALS_PROJECT_TOKEN: ${{ secrets.CODEVITALS_PROJECT_TOKEN }} - HOST_NAME: www.codevitals.run - run: | - if [ -z "$CODEVITALS_PROJECT_TOKEN" ]; then - echo "Performance results could not be published. 'CODEVITALS_PROJECT_TOKEN' is not set" - exit 1 - fi - COMMITTED_AT="$(git show -s "$GITHUB_SHA" --format='%cI')" - node ./tests/performance/log-results.js "$CODEVITALS_PROJECT_TOKEN" trunk "$GITHUB_SHA" "$BASE_SHA" "$COMMITTED_AT" "$HOST_NAME" diff --git a/.github/workflows/reusable-performance-test-v2.yml b/.github/workflows/reusable-performance-test-v2.yml deleted file mode 100644 index d900c95844cab..0000000000000 --- a/.github/workflows/reusable-performance-test-v2.yml +++ /dev/null @@ -1,270 +0,0 @@ -## -# A reusable workflow that runs the performance test suite. -## -name: Run performance Tests - -on: - workflow_call: - inputs: - subject: - description: Subject of the test. One of `current`, `before`, or `base`. - required: true - type: string - LOCAL_DIR: - description: 'Where to run WordPress from.' - required: false - type: 'string' - default: 'build' - BASE_TAG: - description: 'The version being used for baseline measurements.' - required: false - type: 'string' - default: '6.7.0' - TARGET_SHA: - description: 'SHA hash of the target commit used for "before" measurements.' - required: true - type: 'string' - php-version: - description: 'The PHP version to use.' - required: false - type: 'string' - default: 'latest' - memcached: - description: 'Whether to enable memcached.' - required: false - type: 'boolean' - default: false - multisite: - description: 'Whether to use Multisite.' - required: false - type: 'boolean' - default: false - outputs: - BASE_TAG: - description: 'The version being used for baseline measurements.' - value: ${{ inputs.BASE_TAG }} - secrets: - CODEVITALS_PROJECT_TOKEN: - description: 'The authorization token for https://www.codevitals.run/project/wordpress.' - required: false - -env: - PUPPETEER_SKIP_DOWNLOAD: ${{ true }} - - # Prevent wp-scripts from downloading extra Playwright browsers, - # since Chromium will be installed in its dedicated step already. - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true - - # Performance testing should be performed in an environment reflecting a standard production environment. - LOCAL_WP_DEBUG: false - LOCAL_SCRIPT_DEBUG: false - LOCAL_SAVEQUERIES: false - LOCAL_WP_DEVELOPMENT_MODE: "''" - - BASE_TAG: ${{ inputs.BASE_TAG }} - TARGET_SHA: ${{ inputs.TARGET_SHA }} - - LOCAL_DIR: ${{ inputs.LOCAL_DIR }} - LOCAL_PHP_MEMCACHED: ${{ inputs.memcached }} - LOCAL_PHP: ${{ inputs.php-version }}${{ 'latest' != inputs.php-version && '-fpm' || '' }} - LOCAL_MULTISITE: ${{ inputs.multisite }} - -# Disable permissions for all available scopes by default. -# Any needed permissions should be configured at the job level. -permissions: {} - -jobs: - # Performs the following steps: - # - Configure environment variables. - # - Checkout repository. - # - Set up Node.js. - # - Log debug information. - # - Install npm dependencies. - # - Install Playwright browsers. - # - Build WordPress. - # - Start Docker environment. - # - Put the baseline or target version of WordPress in place if necessary. - # - Install object cache drop-in. - # - Log running Docker containers. - # - Docker debug information. - # - Install WordPress. - # - WordPress debug information. - # - Enable themes on Multisite. - # - Install WordPress Importer plugin. - # - Import mock data. - # - Deactivate WordPress Importer plugin. - # - Update permalink structure. - # - Install additional languages. - # - Disable external HTTP requests. - # - Disable cron. - # - List defined constants. - # - Install MU plugin. - # - Run performance tests. - # - Archive artifacts. - # - Ensure version-controlled files are not modified or deleted. - performance: - name: Test ${{ inputs.subject == 'base' && inputs.BASE_TAG || inputs.subject }} - runs-on: ubuntu-24.04 - permissions: - contents: read - - steps: - - name: Configure environment variables - run: | - echo "PHP_FPM_UID=$(id -u)" >> "$GITHUB_ENV" - echo "PHP_FPM_GID=$(id -g)" >> "$GITHUB_ENV" - - - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - fetch-depth: ${{ github.event_name == 'workflow_dispatch' && '2' || '1' }} - persist-credentials: false - - - name: Set up Node.js - uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 - with: - node-version-file: '.nvmrc' - cache: npm - - - name: Log debug information - run: | - npm --version - node --version - curl --version - git --version - locale -a - - - name: Install npm dependencies - run: npm ci - - - name: Install Playwright browsers - run: npx playwright install --with-deps chromium - - - name: Start Docker environment - run: npm run env:start - - - name: Build WordPress - run: npm run build - - - name: Download previous build artifact (target branch or previous commit) - if: ${{ inputs.subject == 'before' }} - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 - id: get-previous-build - with: - script: | - const artifacts = await github.rest.actions.listArtifactsForRepo({ - owner: context.repo.owner, - repo: context.repo.repo, - name: 'wordpress-build-' + process.env.TARGET_SHA, - }); - const matchArtifact = artifacts.data.artifacts[0]; - if ( ! matchArtifact ) { - core.setFailed( 'No artifact found!' ); - return false; - } - const download = await github.rest.actions.downloadArtifact( { - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - } ); - const fs = require( 'fs' ); - fs.writeFileSync( process.env.GITHUB_WORKSPACE + '/before.zip', Buffer.from( download.data ) ) - return true; - - - name: Unzip the previous build - if: ${{ inputs.subject == 'before' }} - run: | - unzip "${GITHUB_WORKSPACE}/before.zip" - unzip -o "${GITHUB_WORKSPACE}/wordpress.zip" - - - name: Set the environment to the baseline version - if: ${{ inputs.subject == 'base' }} - run: | - VERSION="${BASE_TAG%.0}" - npm run env:cli -- core download --version="$VERSION" --force --path="/var/www/${LOCAL_DIR}" - - - name: Install object cache drop-in - if: ${{ inputs.memcached }} - run: cp src/wp-content/object-cache.php build/wp-content/object-cache.php - - - name: Log running Docker containers - run: docker ps -a - - - name: Docker debug information - run: | - docker -v - docker compose run --rm mysql mysql --version - docker compose run --rm php php --version - docker compose run --rm php php -m - docker compose run --rm php php -i - docker compose run --rm php locale -a - - - name: Install WordPress - run: npm run env:install - - - name: Check version number - run: npm run env:cli -- core version --path="/var/www/${LOCAL_DIR}" - - - name: Enable themes on Multisite - if: ${{ inputs.multisite }} - run: | - npm run env:cli -- theme enable twentytwentyone --network --path="/var/www/${LOCAL_DIR}" - npm run env:cli -- theme enable twentytwentythree --network --path="/var/www/${LOCAL_DIR}" - npm run env:cli -- theme enable twentytwentyfour --network --path="/var/www/${LOCAL_DIR}" - npm run env:cli -- theme enable twentytwentyfive --network --path="/var/www/${LOCAL_DIR}" - - - name: Install WordPress Importer plugin - run: npm run env:cli -- plugin install wordpress-importer --activate --path="/var/www/${LOCAL_DIR}" - - - name: Import mock data - run: | - curl -O https://raw.githubusercontent.com/WordPress/theme-test-data/b9752e0533a5acbb876951a8cbb5bcc69a56474c/themeunittestdata.wordpress.xml - npm run env:cli -- import themeunittestdata.wordpress.xml --authors=create --path="/var/www/${LOCAL_DIR}" - rm themeunittestdata.wordpress.xml - - - name: Deactivate WordPress Importer plugin - run: npm run env:cli -- plugin deactivate wordpress-importer --path="/var/www/${LOCAL_DIR}" - - - name: Update permalink structure - run: npm run env:cli -- rewrite structure '/%year%/%monthnum%/%postname%/' --path="/var/www/${LOCAL_DIR}" - - - name: Install additional languages - run: | - npm run env:cli -- language core install de_DE --path="/var/www/${LOCAL_DIR}" - npm run env:cli -- language plugin install de_DE --all --path="/var/www/${LOCAL_DIR}" - npm run env:cli -- language theme install de_DE --all --path="/var/www/${LOCAL_DIR}" - - # Prevent background update checks from impacting test stability. - - name: Disable external HTTP requests - run: npm run env:cli -- config set WP_HTTP_BLOCK_EXTERNAL true --raw --type=constant --path="/var/www/${LOCAL_DIR}" - - # Prevent background tasks from impacting test stability. - - name: Disable cron - run: npm run env:cli -- config set DISABLE_WP_CRON true --raw --type=constant --path="/var/www/${LOCAL_DIR}" - - - name: List defined constants - run: npm run env:cli -- config list --path="/var/www/${LOCAL_DIR}" - - - name: Install MU plugin - run: | - mkdir "./${LOCAL_DIR}/wp-content/mu-plugins" - cp ./tests/performance/wp-content/mu-plugins/server-timing.php "./${LOCAL_DIR}/wp-content/mu-plugins/server-timing.php" - - - name: Run performance tests - run: npm run test:performance - env: - TEST_RESULTS_PREFIX: ${{ inputs.subject != 'current' && inputs.subject || '' }} - - - name: Archive artifacts - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 - if: always() - with: - name: performance-${{ inputs.multisite && 'multisite' || 'single' }}-${{ inputs.memcached && 'memcached' || 'default' }}-${{ inputs.subject }} - path: artifacts - if-no-files-found: error - include-hidden-files: true - - - name: Ensure version-controlled files are not modified or deleted - run: git diff --exit-code diff --git a/.github/workflows/reusable-performance.yml b/.github/workflows/reusable-performance.yml deleted file mode 100644 index f211b58890fc3..0000000000000 --- a/.github/workflows/reusable-performance.yml +++ /dev/null @@ -1,360 +0,0 @@ -## -# A reusable workflow that runs the performance test suite. -## -name: Run performance Tests - -on: - workflow_call: - inputs: - LOCAL_DIR: - description: 'Where to run WordPress from.' - required: false - type: 'string' - default: 'build' - BASE_TAG: - description: 'The version being used for baseline measurements.' - required: false - type: 'string' - default: '6.7.0' - php-version: - description: 'The PHP version to use.' - required: false - type: 'string' - default: 'latest' - memcached: - description: 'Whether to enable memcached.' - required: false - type: 'boolean' - default: false - multisite: - description: 'Whether to use Multisite.' - required: false - type: 'boolean' - default: false - secrets: - CODEVITALS_PROJECT_TOKEN: - description: 'The authorization token for https://www.codevitals.run/project/wordpress.' - required: false - -env: - PUPPETEER_SKIP_DOWNLOAD: ${{ true }} - - # Prevent wp-scripts from downloading extra Playwright browsers, - # since Chromium will be installed in its dedicated step already. - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true - - # Performance testing should be performed in an environment reflecting a standard production environment. - 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. - # This is done to isolate variance in measurements caused by the GitHub runners - # from differences caused by code changes between commits. The BASE_TAG value here - # represents the version being used for baseline measurements. It should only be - # changed if we want to normalize results against a different baseline. - BASE_TAG: ${{ inputs.BASE_TAG }} - LOCAL_DIR: ${{ inputs.LOCAL_DIR }} - TARGET_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || '' }} - TARGET_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }} - - LOCAL_PHP_MEMCACHED: ${{ inputs.memcached }} - LOCAL_PHP: ${{ inputs.php-version }}${{ 'latest' != inputs.php-version && '-fpm' || '' }} - LOCAL_MULTISITE: ${{ inputs.multisite }} - -# Disable permissions for all available scopes by default. -# Any needed permissions should be configured at the job level. -permissions: {} - -jobs: - # Performs the following steps: - # - Configure environment variables. - # - Checkout repository. - # - Determine the target SHA value (on `workflow_dispatch` only). - # - Set up Node.js. - # - Log debug information. - # - Install npm dependencies. - # - Install Playwright browsers. - # - Build WordPress. - # - Start Docker environment. - # - Install object cache drop-in. - # - Log running Docker containers. - # - Docker debug information. - # - Install WordPress. - # - Enable themes on Multisite. - # - Install WordPress Importer plugin. - # - Import mock data. - # - Deactivate WordPress Importer plugin. - # - Update permalink structure. - # - Install additional languages. - # - Disable external HTTP requests. - # - Disable cron. - # - List defined constants. - # - Install MU plugin. - # - Run performance tests (current commit). - # - Download previous build artifact (target branch or previous commit). - # - Download artifact. - # - Unzip the build. - # - Run any database upgrades. - # - Flush cache. - # - Delete expired transients. - # - Run performance tests (previous/target commit). - # - Set the environment to the baseline version. - # - Run any database upgrades. - # - Flush cache. - # - Delete expired transients. - # - Run baseline performance tests. - # - Archive artifacts. - # - Compare results. - # - Add workflow summary. - # - Set the base sha. - # - Set commit details. - # - Publish performance results. - # - Ensure version-controlled files are not modified or deleted. - performance: - name: ${{ inputs.multisite && 'Multisite' || 'Single site' }} / ${{ inputs.memcached && 'Memcached' || 'Default' }} - runs-on: ubuntu-24.04 - permissions: - contents: read - if: ${{ ! contains( github.event.before, '00000000' ) }} - - steps: - - name: Configure environment variables - run: | - echo "PHP_FPM_UID=$(id -u)" >> "$GITHUB_ENV" - echo "PHP_FPM_GID=$(id -g)" >> "$GITHUB_ENV" - - - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - fetch-depth: ${{ github.event_name == 'workflow_dispatch' && '2' || '1' }} - persist-credentials: false - - # The `workflow_dispatch` event is the only one missing the needed SHA to target. - - name: Retrieve previous commit SHA (if necessary) - if: ${{ github.event_name == 'workflow_dispatch' }} - run: echo "TARGET_SHA=$(git rev-parse HEAD^1)" >> "$GITHUB_ENV" - - - name: Set up Node.js - uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 - with: - node-version-file: '.nvmrc' - cache: npm - - - name: Log debug information - run: | - npm --version - node --version - curl --version - git --version - locale -a - - - name: Install npm dependencies - run: npm ci - - - name: Install Playwright browsers - run: npx playwright install --with-deps chromium - - - name: Build WordPress - run: npm run build - - - name: Start Docker environment - run: npm run env:start - - - name: Install object cache drop-in - if: ${{ inputs.memcached }} - run: cp src/wp-content/object-cache.php build/wp-content/object-cache.php - - - name: Log running Docker containers - run: docker ps -a - - - name: Docker debug information - run: | - docker -v - docker compose run --rm mysql mysql --version - docker compose run --rm php php --version - docker compose run --rm php php -m - docker compose run --rm php php -i - docker compose run --rm php locale -a - - - name: Install WordPress - run: npm run env:install - - - name: Enable themes on Multisite - if: ${{ inputs.multisite }} - run: | - npm run env:cli -- theme enable twentytwentyone --network --path="/var/www/${LOCAL_DIR}" - npm run env:cli -- theme enable twentytwentythree --network --path="/var/www/${LOCAL_DIR}" - npm run env:cli -- theme enable twentytwentyfour --network --path="/var/www/${LOCAL_DIR}" - npm run env:cli -- theme enable twentytwentyfive --network --path="/var/www/${LOCAL_DIR}" - - - name: Install WordPress Importer plugin - run: npm run env:cli -- plugin install wordpress-importer --activate --path="/var/www/${LOCAL_DIR}" - - - name: Import mock data - run: | - curl -O https://raw.githubusercontent.com/WordPress/theme-test-data/b9752e0533a5acbb876951a8cbb5bcc69a56474c/themeunittestdata.wordpress.xml - npm run env:cli -- import themeunittestdata.wordpress.xml --authors=create --path="/var/www/${LOCAL_DIR}" - rm themeunittestdata.wordpress.xml - - - name: Deactivate WordPress Importer plugin - run: npm run env:cli -- plugin deactivate wordpress-importer --path="/var/www/${LOCAL_DIR}" - - - name: Update permalink structure - run: npm run env:cli -- rewrite structure '/%year%/%monthnum%/%postname%/' --path="/var/www/${LOCAL_DIR}" - - - name: Install additional languages - run: | - npm run env:cli -- language core install de_DE --path="/var/www/${LOCAL_DIR}" - npm run env:cli -- language plugin install de_DE --all --path="/var/www/${LOCAL_DIR}" - npm run env:cli -- language theme install de_DE --all --path="/var/www/${LOCAL_DIR}" - - # Prevent background update checks from impacting test stability. - - name: Disable external HTTP requests - run: npm run env:cli -- config set WP_HTTP_BLOCK_EXTERNAL true --raw --type=constant --path="/var/www/${LOCAL_DIR}" - - # Prevent background tasks from impacting test stability. - - name: Disable cron - run: npm run env:cli -- config set DISABLE_WP_CRON true --raw --type=constant --path="/var/www/${LOCAL_DIR}" - - - name: List defined constants - run: npm run env:cli -- config list --path="/var/www/${LOCAL_DIR}" - - - name: Install MU plugin - run: | - mkdir "./${LOCAL_DIR}/wp-content/mu-plugins" - cp ./tests/performance/wp-content/mu-plugins/server-timing.php "./${LOCAL_DIR}/wp-content/mu-plugins/server-timing.php" - - - name: Run performance tests (current commit) - run: npm run test:performance - - - name: Download previous build artifact (target branch or previous commit) - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 - id: get-previous-build - with: - script: | - const artifacts = await github.rest.actions.listArtifactsForRepo({ - owner: context.repo.owner, - repo: context.repo.repo, - name: 'wordpress-build-' + process.env.TARGET_SHA, - }); - - const matchArtifact = artifacts.data.artifacts[0]; - - if ( ! matchArtifact ) { - core.setFailed( 'No artifact found!' ); - return false; - } - - const download = await github.rest.actions.downloadArtifact( { - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - } ); - - const fs = require( 'fs' ); - fs.writeFileSync( process.env.GITHUB_WORKSPACE + '/before.zip', Buffer.from( download.data ) ) - - return true; - - - name: Unzip the build - if: ${{ steps.get-previous-build.outputs.result }} - run: | - unzip "${GITHUB_WORKSPACE}/before.zip" - unzip -o "${GITHUB_WORKSPACE}/wordpress.zip" - - - name: Run any database upgrades - if: ${{ steps.get-previous-build.outputs.result }} - run: npm run env:cli -- core update-db --path="/var/www/${LOCAL_DIR}" - - - name: Flush cache - if: ${{ steps.get-previous-build.outputs.result }} - run: npm run env:cli -- cache flush --path="/var/www/${LOCAL_DIR}" - - - name: Delete expired transients - if: ${{ steps.get-previous-build.outputs.result }} - run: npm run env:cli -- transient delete --expired --path="/var/www/${LOCAL_DIR}" - - - name: Run target performance tests (previous/target commit) - if: ${{ steps.get-previous-build.outputs.result }} - env: - TEST_RESULTS_PREFIX: before - run: npm run test:performance - - - name: Set the environment to the baseline version - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' }} - run: | - VERSION="${BASE_TAG}" - VERSION="${VERSION%.0}" - npm run env:cli -- core update --version="$VERSION" --force --path="/var/www/${LOCAL_DIR}" - npm run env:cli -- core version --path="/var/www/${LOCAL_DIR}" - - - name: Run any database upgrades - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' }} - run: npm run env:cli -- core update-db --path="/var/www/${LOCAL_DIR}" - - - name: Flush cache - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' }} - run: npm run env:cli -- cache flush --path="/var/www/${LOCAL_DIR}" - - - name: Delete expired transients - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' }} - run: npm run env:cli -- transient delete --expired --path="/var/www/${LOCAL_DIR}" - - - name: Run baseline performance tests - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' }} - env: - TEST_RESULTS_PREFIX: base - run: npm run test:performance - - - name: Archive artifacts - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 - if: always() - with: - name: performance-artifacts${{ inputs.multisite && '-multisite' || '' }}${{ inputs.memcached && '-memcached' || '' }}-${{ github.run_id }} - path: artifacts - if-no-files-found: ignore - include-hidden-files: true - - - name: Compare results - run: node ./tests/performance/compare-results.js "${RUNNER_TEMP}/summary.md" - - - name: Add workflow summary - run: cat "${RUNNER_TEMP}/summary.md" >> "$GITHUB_STEP_SUMMARY" - - - name: Set the base sha - # Only needed when publishing results. - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' && ! inputs.memcached && ! inputs.multisite }} - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 - id: base-sha - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const baseRef = await github.rest.git.getRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: 'tags/' + process.env.BASE_TAG, - }); - return baseRef.data.object.sha; - - - name: Publish performance results - # Only publish results on pushes to trunk. - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' && ! inputs.memcached && ! inputs.multisite }} - env: - BASE_SHA: ${{ steps.base-sha.outputs.result }} - CODEVITALS_PROJECT_TOKEN: ${{ secrets.CODEVITALS_PROJECT_TOKEN }} - HOST_NAME: "www.codevitals.run" - run: | - if [ -z "$CODEVITALS_PROJECT_TOKEN" ]; then - echo "Performance results could not be published. 'CODEVITALS_PROJECT_TOKEN' is not set" - exit 1 - fi - COMMITTED_AT="$(git show -s "$GITHUB_SHA" --format='%cI')" - node ./tests/performance/log-results.js "$CODEVITALS_PROJECT_TOKEN" trunk "$GITHUB_SHA" "$BASE_SHA" "$COMMITTED_AT" "$HOST_NAME" - - - name: Ensure version-controlled files are not modified or deleted - run: git diff --exit-code diff --git a/.github/workflows/reusable-php-compatibility.yml b/.github/workflows/reusable-php-compatibility.yml deleted file mode 100644 index bbb688f040e74..0000000000000 --- a/.github/workflows/reusable-php-compatibility.yml +++ /dev/null @@ -1,90 +0,0 @@ -## -# A reusable workflow that runs PHP compatibility tests. -## -name: PHP Compatibility - -on: - workflow_call: - inputs: - php-version: - description: 'The PHP version to use.' - required: false - type: 'string' - default: 'latest' - -# Disable permissions for all available scopes by default. -# Any needed permissions should be configured at the job level. -permissions: {} - -jobs: - # Runs PHP compatibility tests. - # - # Violations are reported inline with annotations. - # - # Performs the following steps: - # - Checks out the repository. - # - Sets up PHP. - # - Logs debug information. - # - Configures caching for PHP compatibility scans. - # - Installs Composer dependencies. - # - Make Composer packages available globally. - # - Runs the PHP compatibility tests. - # - Generate a report for displaying issues as pull request annotations. - # - Ensures version-controlled files are not modified or deleted. - php-compatibility: - name: Run compatibility checks - runs-on: ubuntu-24.04 - permissions: - contents: read - timeout-minutes: 20 - - steps: - - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - persist-credentials: false - - - name: Set up PHP - uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # v2.35.5 - with: - php-version: ${{ inputs.php-version }} - coverage: none - tools: cs2pr - - - name: Log debug information - run: | - composer --version - - # This date is used to ensure that the PHP compatibility cache is cleared at least once every week. - # http://man7.org/linux/man-pages/man1/date.1.html - - name: "Get last Monday's date" - id: get-date - run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> "$GITHUB_OUTPUT" - - - name: Cache PHP compatibility scan cache - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 - with: - path: .cache/phpcompat.json - key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-php-${{ inputs.php-version }}-phpcompat-cache-${{ hashFiles('**/composer.json', 'phpcompat.xml.dist') }} - - # Since Composer dependencies are installed using `composer update` and no lock file is in version control, - # passing a custom cache suffix ensures that the cache is flushed at least once per week. - - name: Install Composer dependencies - uses: ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520 # v3.1.1 - with: - custom-cache-suffix: ${{ steps.get-date.outputs.date }} - - - name: Make Composer packages available globally - run: echo "${PWD}/vendor/bin" >> "$GITHUB_PATH" - - - name: Run PHP compatibility tests - id: phpcs - run: phpcs --standard=phpcompat.xml.dist --report-full --report-checkstyle=./.cache/phpcs-compat-report.xml - - - name: Show PHPCompatibility results in PR - if: ${{ always() && steps.phpcs.outcome == 'failure' }} - run: cs2pr ./.cache/phpcs-compat-report.xml - - - name: Ensure version-controlled files are not modified or deleted - run: git diff --exit-code diff --git a/.github/workflows/reusable-phpunit-tests-v1.yml b/.github/workflows/reusable-phpunit-tests-v1.yml deleted file mode 100644 index 787e5f521b8b3..0000000000000 --- a/.github/workflows/reusable-phpunit-tests-v1.yml +++ /dev/null @@ -1,197 +0,0 @@ -## -# DEPRECATED -# -# A reusable workflow that runs the PHPUnit test suite with the specified configuration. -# -# This workflow is used by branches 4.7 through 5.1. -## -name: Run PHPUnit tests - -on: - workflow_call: - inputs: - os: - description: 'Operating system to run tests on' - required: false - type: 'string' - default: 'ubuntu-24.04' - php: - description: 'The version of PHP to use, in the format of X.Y' - required: true - type: 'string' - phpunit: - description: 'The PHPUnit version to use when running tests. See .env for details about valid values.' - required: false - type: 'string' - default: ${{ inputs.php }}-fpm - multisite: - description: 'Whether to run tests as multisite' - required: false - type: 'boolean' - default: false - split_slow: - description: 'Whether to run slow tests group.' - required: false - type: 'boolean' - default: false - memcached: - description: 'Whether to test with memcached enabled' - required: false - type: 'boolean' - default: false - phpunit-config: - description: 'The PHPUnit configuration file to use' - required: false - type: 'string' - default: 'phpunit.xml.dist' - allow-errors: - description: 'Whether to continue when test errors occur.' - required: false - type: boolean - default: false -env: - COMPOSER_INSTALL: ${{ false }} - LOCAL_PHP: ${{ inputs.php }}-fpm - LOCAL_PHPUNIT: ${{ inputs.phpunit && inputs.phpunit || inputs.php }}-fpm - LOCAL_PHP_MEMCACHED: ${{ inputs.memcached }} - PHPUNIT_CONFIG: ${{ inputs.phpunit-config }} - PHPUNIT_SCRIPT: php - PUPPETEER_SKIP_DOWNLOAD: ${{ true }} - SLOW_TESTS: 'external-http,media' - -# Disable permissions for all available scopes by default. -# Any needed permissions should be configured at the job level. -permissions: {} - -jobs: - # Runs the PHPUnit tests for WordPress. - # - # Performs the following steps: - # - Sets environment variables. - # - Sets up the environment variables needed for testing with memcached (if desired). - # - Installs NodeJS. - # - Build WordPress - # _ Installs npm dependencies. - # - Configures caching for Composer. - # _ Installs Composer dependencies (if desired). - # - Logs Docker debug information (about the Docker installation within the runner). - # - Starts the WordPress Docker container. - # - Starts the Memcached server after the Docker network has been created (if desired). - # - Logs general debug information about the runner. - # - Logs the running Docker containers. - # - Logs debug information from inside the WordPress Docker container. - # - Logs debug information about what's installed within the WordPress Docker containers. - # - Install WordPress within the Docker container. - # - Run the PHPUnit tests. - test-php: - name: PHP ${{ inputs.php }} / ${{ inputs.multisite && ' Multisite' || 'Single site' }}${{ inputs.split_slow && ' slow tests' || '' }}${{ inputs.memcached && ' with memcached' || '' }} - runs-on: ${{ inputs.os }} - timeout-minutes: 20 - permissions: - contents: read - - steps: - - name: Configure environment variables - run: | - echo "PHP_FPM_UID=$(id -u)" >> "$GITHUB_ENV" - echo "PHP_FPM_GID=$(id -g)" >> "$GITHUB_ENV" - - - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - persist-credentials: false - - - name: Set up Node.js - uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 - with: - node-version-file: '.nvmrc' - cache: npm - - - name: Install Dependencies - run: npm ci - - - name: Build WordPress - run: npm run build - - - name: Get composer cache directory - if: ${{ env.COMPOSER_INSTALL == true }} - id: composer-cache - run: echo "composer_dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT" - - - name: Cache Composer dependencies - if: ${{ env.COMPOSER_INSTALL == true }} - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 - env: - cache-name: cache-composer-dependencies - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-php-${{ inputs.php }}-composer-${{ hashFiles('**/composer.lock') }} - - - name: Install Composer dependencies - if: ${{ env.COMPOSER_INSTALL == true }} - run: | - docker compose run --rm php composer --version - docker compose run --rm php composer install - - - name: Docker debug information - run: | - docker -v - docker compose -v - - - name: Start Docker environment - run: | - npm run env:start - - # The memcached server needs to start after the Docker network has been set up with `npm run env:start`. - - name: Start the Memcached server. - if: ${{ inputs.memcached }} - run: | - cp tests/phpunit/includes/object-cache.php build/wp-content/object-cache.php - BASE=$(basename "$PWD") - docker run --name memcached --net "${BASE}_wpdevnet" -d memcached - - - name: General debug information - run: | - npm --version - node --version - curl --version - git --version - - - name: Log running Docker containers - run: docker ps -a - - - name: WordPress Docker container debug information - run: | - docker compose run --rm mysql mysql --version - docker compose run --rm php php --version - docker compose run --rm php php -m - docker compose run --rm php php -i - docker compose run --rm php locale -a - - - name: Install WordPress - run: npm run env:install - - - name: Run slow PHPUnit tests - if: ${{ inputs.split_slow }} - run: npm run "test:${PHPUNIT_SCRIPT}" -- --verbose -c "${PHPUNIT_CONFIG}" --group "${SLOW_TESTS}" - - - name: Run PHPUnit tests for single site excluding slow tests - if: ${{ inputs.php < '7.0' && ! inputs.split_slow && ! inputs.multisite }} - run: npm run "test:${PHPUNIT_SCRIPT}" -- --verbose -c "${PHPUNIT_CONFIG}" --exclude-group "${SLOW_TESTS},ajax,ms-files,ms-required" - - - name: Run PHPUnit tests for Multisite excluding slow tests - if: ${{ inputs.php < '7.0' && ! inputs.split_slow && inputs.multisite }} - run: npm run "test:${PHPUNIT_SCRIPT}" -- --verbose -c "${PHPUNIT_CONFIG}" --exclude-group "${SLOW_TESTS},ajax,ms-files,ms-excluded,oembed-headers" - - - name: Run PHPUnit tests - if: ${{ inputs.php >= '7.0' }} - run: npm run "test:${PHPUNIT_SCRIPT}" -- --verbose -c "${PHPUNIT_CONFIG}" - - - name: Run AJAX tests - if: ${{ ! inputs.multisite && ! inputs.split_slow }} - run: npm run "test:${PHPUNIT_SCRIPT}" -- --verbose -c "${PHPUNIT_CONFIG}" --group ajax - - - name: Run external HTTP tests - if: ${{ ! inputs.multisite && ! inputs.split_slow }} - run: npm run "test:${PHPUNIT_SCRIPT}" -- --verbose -c phpunit.xml.dist --group external-http diff --git a/.github/workflows/reusable-phpunit-tests-v2.yml b/.github/workflows/reusable-phpunit-tests-v2.yml deleted file mode 100644 index 092d09227131b..0000000000000 --- a/.github/workflows/reusable-phpunit-tests-v2.yml +++ /dev/null @@ -1,212 +0,0 @@ -## -# DEPRECATED -# -# A reusable workflow that runs the PHPUnit test suite with the specified configuration. -# -# This workflow is used by branches 5.2 through 5.8. -## -name: Run PHPUnit tests - -on: - workflow_call: - inputs: - os: - description: 'Operating system to run tests on' - required: false - type: 'string' - default: 'ubuntu-24.04' - php: - description: 'The version of PHP to use, in the format of X.Y' - required: true - type: 'string' - multisite: - description: 'Whether to run tests as multisite' - required: false - type: 'boolean' - default: false - split_slow: - description: 'Whether to run slow tests group.' - required: false - type: 'boolean' - default: false - test_ajax: - description: 'Whether to run AJAX tests.' - required: false - type: 'boolean' - default: true - memcached: - description: 'Whether to test with memcached enabled' - required: false - type: 'boolean' - default: false - phpunit-config: - description: 'The PHPUnit configuration file to use' - required: false - type: 'string' - default: 'phpunit.xml.dist' - report: - description: 'Whether to report results to WordPress.org Hosting Tests' - required: false - type: 'boolean' - default: false - allow-errors: - description: 'Whether to continue when test errors occur.' - required: false - type: boolean - default: false -env: - LOCAL_PHP: ${{ inputs.php }}-fpm - LOCAL_PHP_MEMCACHED: ${{ inputs.memcached }} - PHPUNIT_CONFIG: ${{ inputs.phpunit-config }} - PUPPETEER_SKIP_DOWNLOAD: ${{ true }} - # Controls which npm script to use for running PHPUnit tests. Options ar `php` and `php-composer`. - PHPUNIT_SCRIPT: php - SLOW_TESTS: 'external-http,media' - -# Disable permissions for all available scopes by default. -# Any needed permissions should be configured at the job level. -permissions: {} - -jobs: - # Runs the PHPUnit tests for WordPress. - # - # Performs the following steps: - # - Sets environment variables. - # - Checks out the repository. - # - Installs Node.js. - # - Installs npm dependencies - # - Configures caching for Composer. - # - Installs Composer dependencies. - # - Logs Docker debug information (about the Docker installation within the runner). - # - Starts the WordPress Docker container. - # - Logs general debug information about the runner. - # - Logs the running Docker containers. - # - Logs debug information from inside the WordPress Docker container. - # - Install WordPress within the Docker container. - # - Run the PHPUnit tests. - # - Ensures version-controlled files are not modified or deleted. - test-php: - name: PHP ${{ inputs.php }} / ${{ inputs.multisite && ' Multisite' || 'Single Site' }}${{ inputs.split_slow && ' slow tests' || '' }}${{ inputs.memcached && ' with memcached' || '' }} - runs-on: ${{ inputs.os }} - timeout-minutes: 20 - permissions: - contents: read - - steps: - - name: Configure environment variables - run: | - echo "PHP_FPM_UID=$(id -u)" >> "$GITHUB_ENV" - echo "PHP_FPM_GID=$(id -g)" >> "$GITHUB_ENV" - - - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - persist-credentials: false - - - name: Install Node.js - uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 - with: - node-version-file: '.nvmrc' - cache: npm - - - name: Install npm dependencies - run: npm ci - - - name: Get composer cache directory - id: composer-cache - run: echo "composer_dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT" - - - name: Cache Composer dependencies - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 - env: - cache-name: cache-composer-dependencies - with: - path: ${{ steps.composer-cache.outputs.composer_dir }} - key: ${{ runner.os }}-php-${{ inputs.php }}-composer-${{ hashFiles('**/composer.lock') }} - - - name: Install Composer dependencies - run: | - docker compose run --rm php composer --version - - # The PHPUnit 7.x phar is not compatible with PHP 8 and won't be updated, - # as PHPUnit 7 is no longer supported. The Composer-installed PHPUnit should be - # used for PHP 8 testing instead. - if [ "${LOCAL_PHP}" == '8.0-fpm' ]; then - docker compose run --rm php composer install --ignore-platform-reqs - echo "PHPUNIT_SCRIPT=php-composer" >> "$GITHUB_ENV" - elif [ "${LOCAL_PHP}" == '7.1-fpm' ]; then - docker compose run --rm php composer update - git checkout -- composer.lock - elif [[ "${LOCAL_PHP}" == '5.6-fpm' || "${LOCAL_PHP}" == '7.0-fpm' ]]; then - docker compose run --rm php composer require --dev phpunit/phpunit:"^5.7" --update-with-dependencies - git checkout -- composer.lock composer.json - else - docker compose run --rm php composer install - fi - - - name: Docker debug information - run: | - docker -v - docker compose -v - - - name: Start Docker environment - run: | - npm run env:start - - - name: General debug information - run: | - npm --version - node --version - curl --version - git --version - - - name: Log running Docker containers - run: docker ps -a - - - name: WordPress Docker container debug information - run: | - docker compose run --rm mysql mysql --version - docker compose run --rm php php --version - docker compose run --rm php php -m - docker compose run --rm php php -i - docker compose run --rm php locale -a - - - name: Install WordPress - run: npm run env:install - - - name: Run slow PHPUnit tests - if: ${{ inputs.split_slow }} - run: npm run "test:${PHPUNIT_SCRIPT}" -- --verbose -c "${PHPUNIT_CONFIG}" --group "${SLOW_TESTS}" - - - name: Run PHPUnit tests for single site excluding slow tests - if: ${{ inputs.php < '7.0' && ! inputs.split_slow && ! inputs.multisite }} - run: npm run "test:${PHPUNIT_SCRIPT}" -- --verbose -c "${PHPUNIT_CONFIG}" --exclude-group "${SLOW_TESTS},ajax,ms-files,ms-required" - - - name: Run PHPUnit tests for Multisite excluding slow tests - if: ${{ inputs.php < '7.0' && ! inputs.split_slow && inputs.multisite }} - run: npm run "test:${PHPUNIT_SCRIPT}" -- --verbose -c "${PHPUNIT_CONFIG}" --exclude-group "${SLOW_TESTS},ajax,ms-files,ms-excluded,oembed-headers" - - - name: Run PHPUnit tests - if: ${{ inputs.php >= '7.0' }} - run: npm run "test:${PHPUNIT_SCRIPT}" -- --verbose -c "${PHPUNIT_CONFIG}" - - - name: Run AJAX tests - if: ${{ ! inputs.split_slow&& inputs.test_ajax }} - run: npm run "test:${PHPUNIT_SCRIPT}" -- --verbose -c "${PHPUNIT_CONFIG}" --group ajax - - - name: Run ms-files tests as a multisite install - if: ${{ inputs.multisite && ! inputs.split_slow }} - run: npm run "test:${PHPUNIT_SCRIPT}" -- --verbose -c "${PHPUNIT_CONFIG}" --group ms-files - - - name: Run external HTTP tests - if: ${{ ! inputs.multisite && ! inputs.split_slow }} - run: npm run "test:${PHPUNIT_SCRIPT}" -- --verbose -c phpunit.xml.dist --group external-http - - # __fakegroup__ is excluded to force PHPUnit to ignore the settings in phpunit.xml.dist. - - name: Run (xDebug) tests - if: ${{ ! inputs.split_slow }} - run: LOCAL_PHP_XDEBUG=true npm run "test:${PHPUNIT_SCRIPT}" -- -v --group xdebug --exclude-group __fakegroup__ - - - name: Ensure version-controlled files are not modified or deleted - run: git diff --exit-code diff --git a/.github/workflows/reusable-phpunit-tests-v3.yml b/.github/workflows/reusable-phpunit-tests-v3.yml deleted file mode 100644 index 7a51389765c75..0000000000000 --- a/.github/workflows/reusable-phpunit-tests-v3.yml +++ /dev/null @@ -1,268 +0,0 @@ -## -# A reusable workflow that runs the PHPUnit test suite with the specified configuration. -# -# This workflow is used by `trunk` and branches >= 5.9. -## -name: Run PHPUnit tests - -on: - workflow_call: - inputs: - os: - description: 'Operating system to run tests on' - required: false - type: 'string' - default: 'ubuntu-24.04' - php: - description: 'The version of PHP to use, in the format of X.Y' - required: true - type: 'string' - db-type: - description: 'Database type. Valid types are mysql and mariadb' - required: false - type: 'string' - default: 'mysql' - db-version: - description: 'Database version' - required: false - type: 'string' - default: '8.4' - db-innovation: - description: 'Whether a database software innovation release is being tested.' - required: false - type: 'boolean' - default: false - multisite: - description: 'Whether to run tests as multisite' - required: false - type: 'boolean' - default: false - memcached: - description: 'Whether to test with memcached enabled' - required: false - type: 'boolean' - default: false - phpunit-config: - description: 'The PHPUnit configuration file to use' - required: false - type: 'string' - default: 'phpunit.xml.dist' - phpunit-test-groups: - description: 'A list of test groups to run.' - required: false - type: 'string' - default: '' - tests-domain: - description: 'The domain to use for the tests' - required: false - type: 'string' - default: 'example.org' - coverage-report: - description: 'Whether to generate a code coverage report.' - required: false - type: boolean - default: false - report: - description: 'Whether to report results to WordPress.org Hosting Tests' - required: false - type: 'boolean' - default: false - allow-errors: - description: 'Whether to continue when test errors occur.' - required: false - type: boolean - default: false - secrets: - CODECOV_TOKEN: - description: 'The Codecov token required for uploading reports.' - required: false - WPT_REPORT_API_KEY: - description: 'The WordPress.org Hosting Tests API key.' - required: false - -env: - LOCAL_PHP: ${{ inputs.php }}-fpm - LOCAL_PHP_XDEBUG: ${{ inputs.coverage-report || false }} - LOCAL_PHP_XDEBUG_MODE: ${{ inputs.coverage-report && 'coverage' || 'develop,debug' }} - LOCAL_DB_TYPE: ${{ inputs.db-type }} - LOCAL_DB_VERSION: ${{ inputs.db-version }} - LOCAL_PHP_MEMCACHED: ${{ inputs.memcached }} - LOCAL_WP_TESTS_DOMAIN: ${{ inputs.tests-domain }} - PHPUNIT_CONFIG: ${{ inputs.phpunit-config }} - PUPPETEER_SKIP_DOWNLOAD: ${{ true }} - -# Disable permissions for all available scopes by default. -# Any needed permissions should be configured at the job level. -permissions: {} - -jobs: - # Runs the PHPUnit tests for WordPress. - # - # Performs the following steps: - # - Sets environment variables. - # - Checks out the repository. - # - Sets up Node.js. - # - Sets up PHP. - # - Installs Composer dependencies. - # - Installs npm dependencies - # - Logs general debug information about the runner. - # - Logs Docker debug information (about the Docker installation within the runner). - # - Starts the WordPress Docker container. - # - Logs the running Docker containers. - # - Logs debug information about what's installed within the WordPress Docker containers. - # - Install WordPress within the Docker container. - # - Run the PHPUnit tests. - # - Upload the code coverage report to Codecov.io. - # - Upload the HTML code coverage report as an artifact. - # - Ensures version-controlled files are not modified or deleted. - # - Checks out the WordPress Test reporter repository. - # - Submit the test results to the WordPress.org host test results. - phpunit-tests: - name: ${{ ( inputs.phpunit-test-groups || inputs.coverage-report ) && format( 'PHP {0} with ', inputs.php ) || '' }} ${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.multisite && ' multisite' || '' }}${{ inputs.db-innovation && ' (innovation release)' || '' }}${{ inputs.memcached && ' with memcached' || '' }}${{ inputs.report && ' (test reporting enabled)' || '' }} ${{ 'example.org' != inputs.tests-domain && inputs.tests-domain || '' }} - runs-on: ${{ inputs.os }} - timeout-minutes: ${{ inputs.coverage-report && 120 || inputs.php == '8.4' && 30 || 20 }} - permissions: - contents: read - - steps: - - name: Configure environment variables - run: | - echo "PHP_FPM_UID=$(id -u)" >> "$GITHUB_ENV" - echo "PHP_FPM_GID=$(id -g)" >> "$GITHUB_ENV" - - - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - persist-credentials: false - - - name: Set up Node.js - uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 - with: - node-version-file: '.nvmrc' - cache: npm - - ## - # This allows Composer dependencies to be installed using a single step. - # - # Since the tests are currently run within the Docker containers where the PHP version varies, - # the same PHP version needs to be configured for the action runner machine so that the correct - # dependency versions are installed and cached. - ## - - name: Set up PHP - uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # v2.35.5 - with: - php-version: '${{ inputs.php }}' - coverage: none - - # Since Composer dependencies are installed using `composer update` and no lock file is in version control, - # passing a custom cache suffix ensures that the cache is flushed at least once per week. - - name: Install Composer dependencies - uses: ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520 # v3.1.1 - with: - custom-cache-suffix: $(/bin/date -u --date='last Mon' "+%F") - - - name: Install npm dependencies - run: npm ci - - - name: General debug information - run: | - npm --version - node --version - curl --version - git --version - composer --version - locale -a - - - name: Docker debug information - run: | - docker -v - - - name: Start Docker environment - run: | - npm run env:start - - - name: Log running Docker containers - run: docker ps -a - - - name: WordPress Docker container debug information - run: | - docker compose run --rm mysql "${LOCAL_DB_CMD}" --version - docker compose run --rm php php --version - docker compose run --rm php php -m - docker compose run --rm php php -i - docker compose run --rm php locale -a - env: - LOCAL_DB_CMD: ${{ env.LOCAL_DB_TYPE == 'mariadb' && contains( fromJSON('["5.5", "10.0", "10.1", "10.2", "10.3"]'), env.LOCAL_DB_VERSION ) && 'mysql' || env.LOCAL_DB_TYPE }} - - - name: Install WordPress - run: npm run env:install - - - name: Run PHPUnit tests${{ inputs.phpunit-test-groups && format( ' ({0} groups)', inputs.phpunit-test-groups ) || '' }}${{ inputs.coverage-report && ' with coverage report' || '' }} - continue-on-error: ${{ inputs.allow-errors }} - run: | - node ./tools/local-env/scripts/docker.js run \ - php ./vendor/bin/phpunit \ - --verbose \ - -c "${PHPUNIT_CONFIG}" \ - ${{ inputs.phpunit-test-groups && '--group "${TEST_GROUPS}"' || '' }} \ - ${{ inputs.coverage-report && '--coverage-clover "wp-code-coverage-${MULTISITE_FLAG}-${GITHUB_SHA}.xml" --coverage-html "wp-code-coverage-${MULTISITE_FLAG}-${GITHUB_SHA}"' || '' }} - env: - TEST_GROUPS: ${{ inputs.phpunit-test-groups }} - MULTISITE_FLAG: ${{ inputs.multisite && 'multisite' || 'single' }} - - - name: Run AJAX tests - if: ${{ ! inputs.phpunit-test-groups && ! inputs.coverage-report }} - continue-on-error: ${{ inputs.allow-errors }} - run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c "${PHPUNIT_CONFIG}" --group ajax - - - name: Run ms-files tests as a multisite install - if: ${{ inputs.multisite && ! inputs.phpunit-test-groups && ! inputs.coverage-report }} - continue-on-error: ${{ inputs.allow-errors }} - run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c "${PHPUNIT_CONFIG}" --group ms-files - - - name: Run external HTTP tests - if: ${{ ! inputs.multisite && ! inputs.phpunit-test-groups && ! inputs.coverage-report }} - continue-on-error: ${{ inputs.allow-errors }} - run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c "${PHPUNIT_CONFIG}" --group external-http - - # __fakegroup__ is excluded to force PHPUnit to ignore the settings in phpunit.xml.dist. - - name: Run (Xdebug) tests - if: ${{ ! inputs.phpunit-test-groups && ! inputs.coverage-report }} - continue-on-error: ${{ inputs.allow-errors }} - run: LOCAL_PHP_XDEBUG=true node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit -v --group xdebug --exclude-group __fakegroup__ - - - name: Upload test coverage report to Codecov - if: ${{ inputs.coverage-report }} - uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: wp-code-coverage${{ inputs.multisite && '-multisite' || '-single' }}-${{ github.sha }}.xml - flags: ${{ inputs.multisite && 'multisite' || 'single' }},php - fail_ci_if_error: true - - - name: Upload HTML coverage report as artifact - if: ${{ inputs.coverage-report }} - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 - with: - name: wp-code-coverage${{ inputs.multisite && '-multisite' || '-single' }}-${{ github.sha }} - path: wp-code-coverage${{ inputs.multisite && '-multisite' || '-single' }}-${{ github.sha }} - overwrite: true - - - name: Ensure version-controlled files are not modified or deleted - run: git diff --exit-code - - - name: Checkout the WordPress Test Reporter - if: ${{ github.ref == 'refs/heads/trunk' && inputs.report }} - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - repository: 'WordPress/phpunit-test-runner' - path: 'test-runner' - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - persist-credentials: false - - - name: Submit test results to the WordPress.org host test results - if: ${{ github.ref == 'refs/heads/trunk' && inputs.report }} - 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 diff --git a/.github/workflows/reusable-support-json-reader-v1.yml b/.github/workflows/reusable-support-json-reader-v1.yml deleted file mode 100644 index c2f263a093ab9..0000000000000 --- a/.github/workflows/reusable-support-json-reader-v1.yml +++ /dev/null @@ -1,155 +0,0 @@ -## -# A reusable workflow that reads the .version-support-*.json files and returns values for use in a -# test matrix based on a given WordPress version. -## -name: Determine test matrix values - -on: - workflow_call: - inputs: - wp-version: - description: 'The WordPress version to test . Accepts major and minor versions, "latest", or "nightly". Major releases must not end with ".0".' - type: string - default: 'nightly' - repository: - description: 'The repository to read support JSON files from.' - type: string - default: 'WordPress/wordpress-develop' - outputs: - major-wp-version: - description: "The major WordPress version based on the version provided in wp-version" - value: ${{ jobs.major-wp-version.outputs.version }} - php-versions: - description: "The PHP versions to test for the given wp-version" - value: ${{ jobs.php-versions.outputs.versions }} - mysql-versions: - description: "The MySQL versions to test for the given wp-version" - value: ${{ jobs.mysql-versions.outputs.versions }} - -# Disable permissions for all available scopes by default. -# Any needed permissions should be configured at the job level. -permissions: {} - -jobs: - # Determines the major version of WordPress being tested. - # - # The data in the JSON files are indexed by major version, so this is used to look up the appropriate support policy. - # - # Performs the following steps: - # - Checks out the repository - # - Returns the major WordPress version as an output based on the value passed to the wp-version input. - major-wp-version: - name: Determine major WordPress version - permissions: - contents: read - runs-on: ubuntu-24.04 - timeout-minutes: 5 - outputs: - version: ${{ steps.major-wp-version.outputs.version }} - - steps: - - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - repository: ${{ inputs.repository }} - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - persist-credentials: false - - - name: Determine the major WordPress version - id: major-wp-version - run: | - if [ "${WP_VERSION}" ] && [ "${WP_VERSION}" != "nightly" ] && [ "${WP_VERSION}" != "latest" ] && [ "${WP_VERSION}" != "trunk" ]; then - echo "version=$(echo "${WP_VERSION}" | tr '.' '-' | cut -d '-' -f1-2)" >> "$GITHUB_OUTPUT" - elif [ "${WP_VERSION}" ] && [ "${WP_VERSION}" != "trunk" ]; then - echo "version=${WP_VERSION}" >> "$GITHUB_OUTPUT" - else - echo "version=nightly" >> "$GITHUB_OUTPUT" - fi - env: - WP_VERSION: ${{ inputs.wp-version }} - - # Determines the versions of PHP supported for a version of WordPress. - # - # Performs the following steps: - # - Checks out the repository - # - Returns the versions of PHP supported for the major version of WordPress by parsing the - # .version-support-php.json file and returning the values in that version's index. - php-versions: - name: Determine PHP versions - permissions: - contents: read - runs-on: ubuntu-24.04 - needs: [ major-wp-version ] - timeout-minutes: 5 - outputs: - versions: ${{ steps.php-versions.outputs.versions }} - - steps: - - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - repository: ${{ inputs.repository }} - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - persist-credentials: false - - # 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 [ "${WP_VERSION}" != "latest" ] && [ "${WP_VERSION}" != "nightly" ]; then - VERSIONS="$( jq \ - -r \ - --arg wp_version "${WP_VERSION}" \ - '.[$wp_version] | @json' \ - .version-support-php.json - )" - echo "versions=$VERSIONS" >> "$GITHUB_OUTPUT" - else - echo "versions=$(jq -r '.[ (keys[-1]) ] | @json' .version-support-php.json)" >> "$GITHUB_OUTPUT" - fi - env: - WP_VERSION: ${{ needs.major-wp-version.outputs.version }} - - # Determines the versions of MySQL supported for a version of WordPress. - # - # Performs the following steps: - # - Checks out the repository - # - Returns the versions of MySQL supported for the major version of WordPress by parsing the - # .version-support-mysql.json file and returning the values in that version's index. - mysql-versions: - name: Determine MySQL versions - permissions: - contents: read - runs-on: ubuntu-24.04 - needs: [ major-wp-version ] - timeout-minutes: 5 - outputs: - versions: ${{ steps.mysql-versions.outputs.versions }} - - steps: - - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - repository: ${{ inputs.repository }} - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - persist-credentials: false - - # 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 [ "${WP_VERSION}" != "latest" ] && [ "${WP_VERSION}" != "nightly" ]; then - VERSIONS="$( jq \ - -r \ - --arg wp_version "${WP_VERSION}" \ - '.[$wp_version] | @json' \ - .version-support-mysql.json - )" - echo "versions=$VERSIONS" >> "$GITHUB_OUTPUT" - else - echo "versions=$(jq -r '.[ (keys[-1]) ] | @json' .version-support-mysql.json)" >> "$GITHUB_OUTPUT" - fi - env: - WP_VERSION: ${{ needs.major-wp-version.outputs.version }} diff --git a/.github/workflows/reusable-test-core-build-process.yml b/.github/workflows/reusable-test-core-build-process.yml deleted file mode 100644 index 54db09f4fda4e..0000000000000 --- a/.github/workflows/reusable-test-core-build-process.yml +++ /dev/null @@ -1,157 +0,0 @@ -## -# A reusable workflow that tests the WordPress Core build process. -## -name: Test the WordPress Build Process - -on: - workflow_call: - inputs: - os: - description: 'Operating system to run tests on' - required: false - type: 'string' - default: 'ubuntu-24.04' - directory: - description: 'Directory to run WordPress from. Valid values are `src` or `build`' - required: false - type: 'string' - default: 'src' - test-emoji: - description: 'Whether to run the precommit:emoji Grunt script.' - required: false - type: 'boolean' - default: true - test-certificates: - description: 'Whether to run the certificate related Grunt scripts.' - required: false - type: 'boolean' - default: false - save-build: - description: 'Whether to save a ZIP of built WordPress as an artifact.' - required: false - type: 'boolean' - default: false - prepare-playground: - description: 'Whether to prepare the artifacts needed for Playground testing.' - required: false - type: 'boolean' - default: false - -env: - PUPPETEER_SKIP_DOWNLOAD: ${{ true }} - -# Disable permissions for all available scopes by default. -# Any needed permissions should be configured at the job level. -permissions: {} - -jobs: - # Verifies that installing npm dependencies and building WordPress works as expected. - # - # Performs the following steps: - # - Checks out the repository. - # - Sets up Node.js. - # - Logs debug information about the GitHub Action runner. - # - Installs npm dependencies. - # - Builds WordPress to run from the desired location (src or build). - # - Ensures version-controlled files are not modified or deleted. - # - Creates a ZIP of the built WordPress files (when building to the build directory). - # - Cleans up after building WordPress. - # - Ensures version-controlled files are not modified or deleted. - # - Uploads the ZIP as a GitHub Actions artifact (when building to the build directory). - # - Saves the pull request number to a text file. - # - Uploads the pull request number as an artifact. - build-process-tests: - name: ${{ contains( inputs.os, 'macos-' ) && 'MacOS' || contains( inputs.os, 'windows-' ) && 'Windows' || 'Linux' }} - permissions: - contents: read - runs-on: ${{ inputs.os }} - timeout-minutes: 20 - - steps: - - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - persist-credentials: false - - # This date is used to ensure that the PHPCS cache is cleared at least once every week. - # http://man7.org/linux/man-pages/man1/date.1.html - - name: "Get last Monday's date" - id: get-date - if: ${{ inputs.test-certificates }} - run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> "$GITHUB_OUTPUT" - - # Since Composer dependencies are installed using `composer update` and no lock file is in version control, - # passing a custom cache suffix ensures that the cache is flushed at least once per week. - - name: Install Composer dependencies - if: ${{ inputs.test-certificates }} - uses: ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520 # v3.1.1 - with: - custom-cache-suffix: ${{ steps.get-date.outputs.date }} - - - name: Set up Node.js - uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 - with: - node-version-file: '.nvmrc' - cache: npm - - - name: Log debug information - run: | - npm --version - node --version - curl --version - git --version - - - name: Install npm Dependencies - run: npm ci - - - name: Run Emoji precommit task - if: ${{ inputs.test-emoji }} - run: npm run grunt precommit:emoji - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Ensure certificates files are updated - if: ${{ inputs.test-certificates }} - run: npm run grunt copy:certificates && npm run grunt build:certificates - - - name: Build WordPress to run from ${{ inputs.directory }} - run: npm run ${{ inputs.directory == 'src' && 'build:dev' || 'build' }} - - - name: Ensure version-controlled files are not modified or deleted during building - run: git diff --exit-code - - - name: Create ZIP of built files - if: ${{ inputs.directory == 'build' && contains( inputs.os, 'ubuntu-' ) }} - run: zip -r wordpress.zip build/. - - - name: Clean after building to run from ${{ inputs.directory }} - run: npm run grunt ${{ inputs.directory == 'src' && 'clean -- --dev' || 'clean' }} - - - name: Ensure version-controlled files are not modified or deleted during cleaning - run: git diff --exit-code - - - name: Upload ZIP as a GitHub Actions artifact - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 - if: ${{ inputs.save-build || inputs.prepare-playground }} - with: - name: wordpress-build-${{ github.event_name == 'pull_request' && github.event.number || github.sha }} - path: wordpress.zip - if-no-files-found: error - - - name: Save PR number - if: ${{ inputs.prepare-playground }} - run: | - mkdir -p ./pr-number - echo "${EVENT_NUMBER}" > ./pr-number/NR - env: - EVENT_NUMBER: ${{ github.event.number }} - - # Uploads the PR number as an artifact for the Pull Request Commenting workflow to download and then - # leave a comment detailing how to test the PR within WordPress Playground. - - name: Upload PR number as artifact - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 - if: ${{ inputs.prepare-playground && github.repository == 'WordPress/wordpress-develop' && github.event_name == 'pull_request' }} - with: - name: pr-number - path: pr-number/ diff --git a/.github/workflows/reusable-test-gutenberg-build-process.yml b/.github/workflows/reusable-test-gutenberg-build-process.yml deleted file mode 100644 index a0e74d6d00bf5..0000000000000 --- a/.github/workflows/reusable-test-gutenberg-build-process.yml +++ /dev/null @@ -1,100 +0,0 @@ -## -# A reusable workflow that tests the Gutenberg plugin build process when run within a wordpress-develop checkout. -## -name: Test the Gutenberg plugin Build Process - -on: - workflow_call: - inputs: - os: - description: 'Operating system to run tests on' - required: false - type: 'string' - default: 'ubuntu-24.04' - directory: - description: 'Directory to run WordPress from. Valid values are `src` or `build`' - required: false - type: 'string' - default: 'src' - -env: - GUTENBERG_DIRECTORY: ${{ inputs.directory == 'build' && 'build' || 'src' }}/wp-content/plugins/gutenberg - PUPPETEER_SKIP_DOWNLOAD: ${{ true }} - NODE_OPTIONS: '--max-old-space-size=8192' - -# Disable permissions for all available scopes by default. -# Any needed permissions should be configured at the job level. -permissions: {} - -jobs: - # Verifies that installing npm dependencies and building the Gutenberg plugin works as expected. - # - # Performs the following steps: - # - Checks out the repository. - # - Checks out the Gutenberg plugin into the plugins directory. - # - Sets up Node.js. - # - Logs debug information about the GitHub Action runner. - # - Installs Gutenberg npm dependencies. - # - Runs the Gutenberg build process. - # - Installs Core npm dependencies. - # - Builds WordPress to run from the relevant location (src or build). - # - Builds Gutenberg. - # - Ensures version-controlled files are not modified or deleted. - build-process-tests: - name: ${{ contains( inputs.os, 'macos-' ) && 'MacOS' || contains( inputs.os, 'windows-' ) && 'Windows' || 'Linux' }} - permissions: - contents: read - runs-on: ${{ inputs.os }} - timeout-minutes: 30 - - steps: - - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - persist-credentials: false - - - name: Checkout Gutenberg plugin - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - repository: 'WordPress/gutenberg' - path: ${{ env.GUTENBERG_DIRECTORY }} - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - persist-credentials: false - - - name: Set up Node.js - uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 - with: - node-version-file: '.nvmrc' - cache: npm - cache-dependency-path: | - package-lock.json - ${{ env.GUTENBERG_DIRECTORY }}/package-lock.json - - - name: Log debug information - run: | - npm --version - node --version - curl --version - git --version - - - name: Install Gutenberg Dependencies - run: npm ci - working-directory: ${{ env.GUTENBERG_DIRECTORY }} - - - name: Build Gutenberg - run: npm run build - working-directory: ${{ env.GUTENBERG_DIRECTORY }} - - - name: Install Core Dependencies - run: npm ci - - - name: Build WordPress to run from ${{ inputs.directory }} - run: npm run ${{ inputs.directory == 'src' && 'build:dev' || 'build' }} - - - name: Run Gutenberg build script after building Core to run from ${{ inputs.directory }} - run: npm run build - working-directory: ${{ env.GUTENBERG_DIRECTORY }} - - - name: Ensure version-controlled files are not modified or deleted during building - run: git diff --exit-code diff --git a/.github/workflows/reusable-test-local-docker-environment-v1.yml b/.github/workflows/reusable-test-local-docker-environment-v1.yml deleted file mode 100644 index acdd7622f6136..0000000000000 --- a/.github/workflows/reusable-test-local-docker-environment-v1.yml +++ /dev/null @@ -1,167 +0,0 @@ -## -# A reusable workflow that ensures the local Docker environment is working properly. -# -# This workflow is used by `trunk` and branches >= 6.8. -## -name: Test local Docker environment - -on: - workflow_call: - inputs: - os: - description: 'Operating system to test' - required: false - type: 'string' - default: 'ubuntu-24.04' - php: - description: 'The version of PHP to use, in the format of X.Y' - required: false - type: 'string' - default: 'latest' - db-type: - description: 'Database type. Valid types are mysql and mariadb' - required: false - type: 'string' - default: 'mysql' - db-version: - description: 'Database version' - required: false - type: 'string' - default: '8.4' - memcached: - description: 'Whether to enable memcached' - required: false - type: 'boolean' - default: false - tests-domain: - description: 'The domain to use for the tests' - required: false - type: 'string' - default: 'example.org' - -env: - LOCAL_PHP: ${{ inputs.php == 'latest' && 'latest' || format( '{0}-fpm', inputs.php ) }} - LOCAL_DB_TYPE: ${{ inputs.db-type }} - LOCAL_DB_VERSION: ${{ inputs.db-version }} - LOCAL_PHP_MEMCACHED: ${{ inputs.memcached }} - LOCAL_WP_TESTS_DOMAIN: ${{ inputs.tests-domain }} - PUPPETEER_SKIP_DOWNLOAD: ${{ true }} - -# Disable permissions for all available scopes by default. -# Any needed permissions should be configured at the job level. -permissions: {} - -jobs: - # Tests the local Docker environment. - # - # Performs the following steps: - # - Sets environment variables. - # - Checks out the repository. - # - Sets up Node.js. - # - Sets up PHP. - # - Installs Composer dependencies. - # - Installs npm dependencies - # - Logs general debug information about the runner. - # - Logs Docker debug information (about the Docker installation within the runner). - # - Starts the WordPress Docker container. - # - Logs the running Docker containers. - # - Logs debug information about what's installed within the WordPress Docker containers. - # - Install WordPress within the Docker container. - # - Restarts the Docker environment. - # - Runs a WP CLI command. - # - Tests the logs command. - # - Tests the reset command. - # - Ensures version-controlled files are not modified or deleted. - local-docker-environment-tests: - name: ${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.memcached && ' with memcached' || '' }}${{ 'example.org' != inputs.tests-domain && format( ' {0}', inputs.tests-domain ) || '' }} - permissions: - contents: read - runs-on: ${{ inputs.os }} - timeout-minutes: 20 - - steps: - - name: Configure environment variables - run: | - echo "PHP_FPM_UID=$(id -u)" >> "$GITHUB_ENV" - echo "PHP_FPM_GID=$(id -g)" >> "$GITHUB_ENV" - - - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - persist-credentials: false - - - name: Set up Node.js - uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 - with: - node-version-file: '.nvmrc' - cache: npm - - ## - # This allows Composer dependencies to be installed using a single step. - # - # Since tests are currently run within the Docker containers where the PHP version varies, - # the same PHP version needs to be configured for the action runner machine so that the correct - # dependency versions are installed and cached. - ## - - name: Set up PHP - uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # v2.35.5 - with: - php-version: '${{ inputs.php }}' - coverage: none - - # Since Composer dependencies are installed using `composer update` and no lock file is in version control, - # passing a custom cache suffix ensures that the cache is flushed at least once per week. - - name: Install Composer dependencies - uses: ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520 # v3.1.1 - with: - custom-cache-suffix: $(/bin/date -u --date='last Mon' "+%F") - - - name: Install npm dependencies - run: npm ci - - - name: General debug information - run: | - npm --version - node --version - curl --version - git --version - composer --version - locale -a - - - name: Docker debug information - run: | - docker -v - - - name: Start Docker environment - run: | - npm run env:start - - - name: Log running Docker containers - run: docker ps -a - - - name: WordPress Docker container debug information - run: | - docker compose run --rm mysql "${LOCAL_DB_TYPE}" --version - docker compose run --rm php php --version - docker compose run --rm php php -m - docker compose run --rm php php -i - docker compose run --rm php locale -a - - - name: Install WordPress - run: npm run env:install - - - name: Restart Docker environment - run: npm run env:restart - - - name: Test a CLI command - run: npm run env:cli option get siteurl - - - name: Test logs command - run: npm run env:logs - - - name: Reset the Docker environment - run: npm run env:reset - - - name: Ensure version-controlled files are not modified or deleted - run: git diff --exit-code diff --git a/.github/workflows/reusable-upgrade-testing.yml b/.github/workflows/reusable-upgrade-testing.yml deleted file mode 100644 index 193802ce9f4ad..0000000000000 --- a/.github/workflows/reusable-upgrade-testing.yml +++ /dev/null @@ -1,139 +0,0 @@ -# A reusable workflow that runs WordPress upgrade testing under the conditions provided. -name: Upgrade Tests - -on: - workflow_call: - inputs: - os: - description: 'Operating system to run tests on.' - required: false - type: 'string' - default: 'ubuntu-24.04' - wp: - description: 'The version of WordPress to start with.' - required: true - type: 'string' - new-version: - description: 'The version of WordPress to update to. Use "latest" to update to the latest version, "develop" to update to the current branch, or provide a specific version number to update to.' - type: 'string' - default: 'latest' - php: - description: 'The version of PHP to use. Expected format: X.Y.' - required: true - type: 'string' - multisite: - description: 'Whether to run tests as multisite.' - required: false - type: 'boolean' - default: false - db-type: - description: 'Database type. Valid types are mysql and mariadb.' - required: false - type: 'string' - default: 'mysql' - db-version: - description: 'Database version.' - required: false - type: 'string' - default: '5.7' - -# Disable permissions for all available scopes by default. -# Any needed permissions should be configured at the job level. -permissions: {} - -jobs: - # Runs upgrade tests on a build of WordPress. - # - # Performs the following steps: - # - Sets up PHP. - # - Downloads the specified version of WordPress. - # - Creates a `wp-config.php` file. - # - Installs WordPress. - # - Checks the version of WordPress before the upgrade. - # - Updates to the latest minor version. - # - Updates the database after the minor update. - # - Checks the version of WordPress after the minor update. - # - Updates to the version of WordPress being tested. - # - Updates the database. - # - Checks the version of WordPress after the upgrade. - upgrade-tests: - name: PHP ${{ inputs.php }} with ${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.multisite && ' multisite' || '' }} - permissions: - contents: read - runs-on: ${{ inputs.os }} - timeout-minutes: 20 - - services: - database: - image: ${{ inputs.db-type }}:${{ inputs.db-version }} - ports: - - 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" - --entrypoint sh ${{ inputs.db-type }}:${{ inputs.db-version }} - -c "exec docker-entrypoint.sh mysqld${{ inputs.db-type == 'mysql' && contains( fromJSON('["7.2", "7.3"]'), inputs.php ) && ' --default-authentication-plugin=mysql_native_password' || '' }}" - - steps: - - name: Set up PHP ${{ inputs.php }} - uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # v2.35.5 - with: - php-version: '${{ inputs.php }}' - coverage: none - tools: wp-cli - - - name: Download WordPress ${{ inputs.wp }} - run: wp core download --version="${WP_VERSION}" - env: - WP_VERSION: ${{ inputs.wp }} - - - name: Create wp-config.php file - run: wp config create --dbname=test_db --dbuser=root --dbpass=root --dbhost="127.0.0.1:${DB_PORT}" - env: - DB_PORT: ${{ job.services.database.ports['3306'] }} - - - name: Install WordPress - run: | - wp core ${{ inputs.multisite && 'multisite-install' || 'install' }} \ - --url=http://localhost/ --title="Upgrade Test" --admin_user=admin \ - --admin_password=password --admin_email=me@example.org --skip-email - - - name: Pre-upgrade version check - run: wp core version - - - name: Update to the latest minor version - run: wp core update --minor - - - name: Update the database after the minor update - run: wp core update-db ${{ inputs.multisite && '--network' || '' }} - - - name: Post-upgrade version check after the minor update - run: wp core version - - - name: Download build artifact for the current branch - if: ${{ inputs.new-version == 'develop' }} - uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 - with: - name: wordpress-develop - - - name: Upgrade to WordPress at current branch - if: ${{ inputs.new-version == 'develop' }} - run: | - wp core update develop.zip - - - name: Upgrade to WordPress ${{ inputs.new-version }} - if: ${{ inputs.new-version != 'develop' }} - run: | - wp core update ${{ 'latest' != inputs.new-version && '--version="${WP_VERSION}"' || '' }} - env: - WP_VERSION: ${{ inputs.new-version }} - - - name: Update the database - run: wp core update-db ${{ inputs.multisite && '--network' || '' }} - - - name: Post-upgrade version check - run: wp core version diff --git a/.github/workflows/reusable-workflow-lint.yml b/.github/workflows/reusable-workflow-lint.yml deleted file mode 100644 index 8a83830beb8fd..0000000000000 --- a/.github/workflows/reusable-workflow-lint.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Lint GitHub Actions workflows -on: - workflow_call: - -permissions: {} - -jobs: - # Runs the actionlint GitHub Action workflow file linter. - # - # This helps guard against common mistakes including strong type checking for expressions (${{ }}), security checks, - # `run:` script checking, glob syntax validation, and more. - # - # Performs the following steps: - # - Checks out the repository. - # - Runs actionlint. - actionlint: - name: Run actionlint - runs-on: ubuntu-24.04 - permissions: - contents: read - timeout-minutes: 5 - steps: - - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - persist-credentials: false - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - # actionlint is static checker for GitHub Actions workflow files. - # See https://github.com/rhysd/actionlint. - - name: Run actionlint - uses: docker://rhysd/actionlint@sha256:887a259a5a534f3c4f36cb02dca341673c6089431057242cdc931e9f133147e9 # v1.7.7 - with: - args: "-color -verbose" diff --git a/.github/workflows/slack-notifications.yml b/.github/workflows/slack-notifications.yml deleted file mode 100644 index e00a6e9fbaa6e..0000000000000 --- a/.github/workflows/slack-notifications.yml +++ /dev/null @@ -1,229 +0,0 @@ -## -# 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 - -on: - 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 - -# Disable permissions for all available scopes by default. -# Any needed permissions should be configured at the job level. -permissions: {} - -env: - CURRENT_BRANCH: ${{ github.ref_name }} - -jobs: - # Gathers the details needed for Slack notifications. - # - # These details are passed as outputs to the subsequent, dependant jobs that - # submit data to Slack webhook URLs configured to post messages. - # - # Performs the following steps: - # - Retrieves the current workflow run. - # - Determines the conclusion of the previous workflow run or run attempt. - # - Sets the previous conclusion as an output. - # - Prepares the commit message. - # - Constructs and stores a message payload as an output. - prepare: - name: Prepare notifications - runs-on: ubuntu-24.04 - permissions: - actions: read - contents: read - timeout-minutes: 5 - if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event.workflow_run.event != 'pull_request' }} - outputs: - previous_conclusion: ${{ steps.previous-attempt-result.outputs.result }} - payload: ${{ steps.create-payload.outputs.payload }} - - steps: - - name: Determine the status of the previous attempt - id: previous-attempt-result - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 - with: - retries: 2 - retry-exempt-status-codes: 418 - result-encoding: string - script: | - const workflow_run = await github.rest.actions.getWorkflowRun({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: `${context.runId}`, - }); - - if ( process.env.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, - run_id: `${context.runId}`, - attempt_number: workflow_run.data.run_attempt - 1 - }); - - return previous_run.data.conclusion; - } - - // Otherwise, check the previous workflow run. - const previous_runs = await github.rest.actions.listWorkflowRuns({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: workflow_run.data.workflow_id, - branch: process.env.CURRENT_BRANCH, - exclude_pull_requests: true, - }); - - // This is the first workflow run for this branch or tag. - if ( previous_runs.data.workflow_runs.length < 2 ) { - return 'none'; - } - - const expected_events = new Array( 'push', 'schedule', 'workflow_dispatch' ); - - // Find the workflow run for the commit that immediately preceded this one. - for ( let i = 0; i < previous_runs.data.workflow_runs.length; i++ ) { - if ( previous_runs.data.workflow_runs[ i ].run_number == workflow_run.data.run_number ) { - let next_index = i; - do { - next_index++; - - // Protects against a false notification when contributors use the trunk branch as the pull request head_ref. - if ( expected_events.indexOf( previous_runs.data.workflow_runs[ next_index ].event ) == -1 ) { - continue; - } - - return previous_runs.data.workflow_runs[ next_index ].conclusion; - } while ( next_index < previous_runs.data.workflow_runs.length ); - } - } - - // Can't determine previous workflow conclusion. - return 'unknown'; - env: - CALLING_STATUS: ${{ inputs.calling_status }} - - - name: Get the commit message - id: current-commit-message - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 - if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }} - with: - retries: 2 - retry-exempt-status-codes: 418 - result-encoding: string - script: | - const commit_details = await github.rest.repos.getCommit({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: context.sha, - }); - return commit_details.data.commit.message; - - - name: Construct payload and store as an output - id: create-payload - run: | - COMMIT_MSG="$(echo "${COMMIT_MSG_RAW}" | awk 'NR==1')" - PAYLOAD="$( jq \ - -n \ - --arg workflow_name "${GITHUB_WORKFLOW}" \ - --arg ref_name "${CURRENT_BRANCH}" \ - --arg run_url "https://github.com/WordPress/wordpress-develop/actions/runs/${GITHUB_RUN_ID}/attempts/${GITHUB_RUN_ATTEMPT}" \ - --arg commit_message "${COMMIT_MSG}" \ - '{workflow_name: $workflow_name, ref_name: $ref_name, run_url: $run_url, commit_message: $commit_message}' | jq -c . - )" - echo "payload=$PAYLOAD" >> "$GITHUB_OUTPUT" - env: - COMMIT_MSG_RAW: ${{ ( github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) && steps.current-commit-message.outputs.result || github.event.head_commit.message }} - - # Posts notifications when a workflow fails. - failure: - name: Failure notifications - permissions: {} - runs-on: ubuntu-24.04 - timeout-minutes: 20 - needs: [ prepare ] - if: ${{ needs.prepare.outputs.previous_conclusion != 'first-failure' && inputs.calling_status == 'failure' || failure() }} - - steps: - - name: Post failure notifications to Slack - uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1 - with: - webhook-type: webhook-trigger - webhook: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }} - payload: ${{ needs.prepare.outputs.payload }} - - # Posts notifications the first time a workflow run succeeds after previously failing. - fixed: - name: Fixed notifications - permissions: {} - runs-on: ubuntu-24.04 - timeout-minutes: 20 - needs: [ prepare ] - if: ${{ contains( fromJson( '["failure", "cancelled", "none"]' ), needs.prepare.outputs.previous_conclusion ) && inputs.calling_status == 'success' && success() }} - - steps: - - name: Post failure notifications to Slack - uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1 - with: - webhook-type: webhook-trigger - webhook: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }} - payload: ${{ needs.prepare.outputs.payload }} - - # Posts notifications when a workflow is successful. - success: - name: Success notifications - permissions: {} - runs-on: ubuntu-24.04 - timeout-minutes: 20 - needs: [ prepare ] - if: ${{ inputs.calling_status == 'success' && success() }} - - steps: - - name: Post success notifications to Slack - uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1 - with: - webhook-type: webhook-trigger - webhook: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }} - payload: ${{ needs.prepare.outputs.payload }} - - # Posts notifications when a workflow is cancelled. - cancelled: - name: Cancelled notifications - permissions: {} - runs-on: ubuntu-24.04 - timeout-minutes: 20 - needs: [ prepare ] - if: ${{ inputs.calling_status == 'cancelled' || cancelled() }} - - steps: - - name: Post cancelled notifications to Slack - uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1 - with: - webhook-type: webhook-trigger - webhook: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }} - payload: ${{ needs.prepare.outputs.payload }} diff --git a/.github/workflows/test-and-zip-default-themes.yml b/.github/workflows/test-and-zip-default-themes.yml deleted file mode 100644 index c560a7b0dd21f..0000000000000 --- a/.github/workflows/test-and-zip-default-themes.yml +++ /dev/null @@ -1,305 +0,0 @@ -name: Test Default Themes & Create ZIPs - -on: - push: - branches: - - trunk - - '3.[89]' - - '[4-9].[0-9]' - paths: - # Changing the preferred version of Node.js could affect themes with build processes. - - '.npmrc' - - '.nvmrc' - # Changes to any themes with a build script should be confirmed. - - 'src/wp-content/themes/twentynineteen/**' - - 'src/wp-content/themes/twentytwenty/**' - - 'src/wp-content/themes/twentytwentyone/**' - - 'src/wp-content/themes/twentytwentytwo/**' - - 'src/wp-content/themes/twentytwentyfive/**' - # Changes to this workflow file should always verify success. - - '.github/workflows/test-and-zip-default-themes.yml' - pull_request: - branches: - - trunk - - '3.[89]' - - '[4-9].[0-9]' - paths: - # Changing the preferred version of Node.js could affect themes with build processes. - - '.npmrc' - - '.nvmrc' - # Changes to any themes with a build script should be confirmed. - - 'src/wp-content/themes/twentynineteen/**' - - 'src/wp-content/themes/twentytwenty/**' - - 'src/wp-content/themes/twentytwentyone/**' - - 'src/wp-content/themes/twentytwentytwo/**' - - 'src/wp-content/themes/twentytwentyfive/**' - # Changes to this workflow file should always verify success. - - '.github/workflows/test-and-zip-default-themes.yml' - workflow_dispatch: - inputs: - branch: - description: 'The branch to create ZIP files from' - required: true - type: string - default: 'trunk' - -# 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: - # 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-24.04 - permissions: - contents: read - timeout-minutes: 10 - if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} - strategy: - fail-fast: false - matrix: - theme: [ - 'twentytwentyfive', - 'twentytwentyfour', - 'twentytwentythree', - 'twentytwentytwo', - 'twentytwentyone', - 'twentytwenty', - 'twentynineteen', - 'twentyseventeen', - 'twentysixteen', - 'twentyfifteen', - 'twentyfourteen', - 'twentythirteen', - 'twentytwelve', - 'twentyeleven', - 'twentyten' - ] - - steps: - - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - ref: ${{ github.event_name == 'workflow_dispatch' && inputs.branch || github.ref }} - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - persist-credentials: false - - - name: Check for zero-byte (empty) files - run: | - [[ ! $(find "src/wp-content/themes/${THEME}" -empty) ]] - env: - THEME: ${{ matrix.theme }} - - # Tests the build script for themes that have one. - # - # Performs the following steps: - # - Checks out the repository. - # - Sets up Node.js. - # - Installs npm dependencies. - # - Runs the theme build script. - # - Ensures version-controlled files are not modified or deleted. - test-build-scripts: - name: Test ${{ matrix.theme }} build script - runs-on: ubuntu-24.04 - permissions: - contents: read - timeout-minutes: 10 - if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} - strategy: - fail-fast: false - matrix: - theme: [ - 'twentytwentyfive', - 'twentytwentytwo', - 'twentytwentyone', - 'twentytwenty', - 'twentynineteen', - ] - - defaults: - run: - working-directory: src/wp-content/themes/${{ matrix.theme }} - - steps: - - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - ref: ${{ github.event_name == 'workflow_dispatch' && inputs.branch || github.ref }} - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - persist-credentials: false - - - name: Set up Node.js - uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 - with: - node-version-file: '.nvmrc' - cache: npm - cache-dependency-path: src/wp-content/themes/${{ matrix.theme }}/package-lock.json - - - name: Install npm dependencies - run: npm ci - - - name: Build theme - run: npm run build - - - name: Check for changes to versioned files - id: built-file-check - if: ${{ github.event_name == 'pull_request' }} - run: | - if git diff --quiet; then - echo "uncommitted_changes=false" >> "$GITHUB_OUTPUT" - else - echo "uncommitted_changes=true" >> "$GITHUB_OUTPUT" - fi - - - name: Display changes to versioned files - if: ${{ steps.built-file-check.outputs.uncommitted_changes == 'true' }} - run: git diff - - - name: Save diff to a file - if: ${{ steps.built-file-check.outputs.uncommitted_changes == 'true' }} - run: git diff > ./changes.diff - - # Uploads the diff file as an artifact. - - name: Upload diff file as artifact - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 - if: ${{ steps.built-file-check.outputs.uncommitted_changes == 'true' }} - with: - name: pr-built-file-changes - path: src/wp-content/themes/${{ matrix.theme }}/changes.diff - - - name: Ensure version-controlled files are not modified or deleted - run: git diff --exit-code - - # Prepares bundled themes for release. - # - # Performs the following steps: - # - Checks out the repository. - # - Uploads the theme files as a workflow artifact (files uploaded as an artifact are automatically zipped). - bundle-theme: - name: Create ${{ matrix.theme }} ZIP file - runs-on: ubuntu-24.04 - permissions: - contents: read - needs: [ check-for-empty-files, test-build-scripts ] - timeout-minutes: 10 - if: ${{ github.repository == 'WordPress/wordpress-develop' }} - strategy: - fail-fast: false - matrix: - theme: [ - 'twentytwentyfive', - 'twentytwentyfour', - 'twentytwentythree', - 'twentytwentytwo', - 'twentytwentyone', - 'twentytwenty', - 'twentynineteen', - 'twentyseventeen', - 'twentysixteen', - 'twentyfifteen', - 'twentyfourteen', - 'twentythirteen', - 'twentytwelve', - 'twentyeleven', - 'twentyten' - ] - - steps: - - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - ref: ${{ github.event_name == 'workflow_dispatch' && inputs.branch || github.ref }} - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - persist-credentials: false - - - name: Set up Node.js for themes needing minification - if: matrix.theme == 'twentytwentytwo' || matrix.theme == 'twentytwentyfive' - uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 - with: - node-version-file: '.nvmrc' - cache: npm - cache-dependency-path: src/wp-content/themes/${{ matrix.theme }}/package-lock.json - - - name: Install npm dependencies - if: matrix.theme == 'twentytwentytwo' || matrix.theme == 'twentytwentyfive' - run: npm ci - working-directory: src/wp-content/themes/${{ matrix.theme }} - - - name: Build theme assets - if: matrix.theme == 'twentytwentytwo' || matrix.theme == 'twentytwentyfive' - run: npm run build - working-directory: src/wp-content/themes/${{ matrix.theme }} - - - name: Upload theme ZIP as an artifact - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 - with: - name: ${{ matrix.theme }} - path: | - src/wp-content/themes/${{ matrix.theme }} - !src/wp-content/themes/${{ matrix.theme }}/node_modules - if-no-files-found: error - include-hidden-files: true - - slack-notifications: - name: Slack Notifications - uses: ./.github/workflows/slack-notifications.yml - permissions: - actions: read - contents: read - 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' }} - 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-24.04 - permissions: - actions: write - needs: [ 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@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 - 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: `${context.runId}`, - } - }); diff --git a/.github/workflows/test-build-processes.yml b/.github/workflows/test-build-processes.yml index b33443367c846..ef04aa058c388 100644 --- a/.github/workflows/test-build-processes.yml +++ b/.github/workflows/test-build-processes.yml @@ -50,7 +50,7 @@ jobs: # Tests the WordPress Core build process. test-core-build-process: name: Core running from ${{ matrix.directory }} - uses: ./.github/workflows/reusable-test-core-build-process.yml + uses: WordPress/wordpress-develop/.github/workflows/reusable-test-core-build-process.yml@trunk permissions: contents: read if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} @@ -85,7 +85,7 @@ jobs: # See https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability. test-core-build-process-additional-os: name: Core running from ${{ matrix.directory }} - uses: ./.github/workflows/reusable-test-core-build-process.yml + uses: WordPress/wordpress-develop/.github/workflows/reusable-test-core-build-process.yml@trunk permissions: contents: read if: ${{ github.repository == 'WordPress/wordpress-develop' }} @@ -101,7 +101,7 @@ jobs: # Tests the Gutenberg plugin build process within a wordpress-develop checkout. test-gutenberg-build-process: name: Gutenberg running from ${{ matrix.directory }} - uses: ./.github/workflows/reusable-test-gutenberg-build-process.yml + uses: WordPress/wordpress-develop/.github/workflows/reusable-test-gutenberg-build-process.yml@trunk permissions: contents: read if: ${{ github.repository == 'WordPress/wordpress-develop' }} @@ -126,7 +126,7 @@ jobs: # See https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability. test-gutenberg-build-process-additional-os: name: Gutenberg running from ${{ matrix.directory }} - uses: ./.github/workflows/reusable-test-gutenberg-build-process.yml + uses: WordPress/wordpress-develop/.github/workflows/reusable-test-gutenberg-build-process.yml@trunk permissions: contents: read if: ${{ github.repository == 'WordPress/wordpress-develop' }} @@ -141,7 +141,7 @@ jobs: slack-notifications: name: Slack Notifications - uses: ./.github/workflows/slack-notifications.yml + uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk permissions: actions: read contents: read diff --git a/.github/workflows/test-coverage.yml b/.github/workflows/test-coverage.yml deleted file mode 100644 index deb190eba9e9b..0000000000000 --- a/.github/workflows/test-coverage.yml +++ /dev/null @@ -1,115 +0,0 @@ -name: Code Coverage Report - -on: - # Verify - push: - branches: - - trunk - paths: - - '.github/workflows/test-coverage.yml' - - '.github/workflows/reusable-phpunit-tests-v3.yml' - - 'docker-compose.yml' - - 'phpunit.xml.dist' - - 'tests/phpunit/multisite.xml' - pull_request: - branches: - - trunk - paths: - - '.github/workflows/test-coverage.yml' - - '.github/workflows/reusable-phpunit-tests-v3.yml' - - 'docker-compose.yml' - - 'phpunit.xml.dist' - - 'tests/phpunit/multisite.xml' - # Once daily at 00:00 UTC. - schedule: - - cron: '0 0 * * *' - # Allow manually triggering the workflow. - 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: {} - -env: - LOCAL_PHP_XDEBUG: true - LOCAL_PHP_XDEBUG_MODE: 'coverage' - LOCAL_PHP_MEMCACHED: ${{ false }} - PUPPETEER_SKIP_DOWNLOAD: ${{ true }} - -jobs: - # - # Creates a PHPUnit test jobs for generating code coverage reports. - # - test-coverage-report: - name: ${{ matrix.multisite && 'Multisite' || 'Single site' }} report - uses: ./.github/workflows/reusable-phpunit-tests-v3.yml - permissions: - contents: read - if: ${{ github.repository == 'WordPress/wordpress-develop' }} - strategy: - fail-fast: false - matrix: - multisite: [ false, true ] - coverage-report: [ true ] - with: - php: '8.3' - multisite: ${{ matrix.multisite }} - coverage-report: ${{ matrix.coverage-report }} - secrets: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - - slack-notifications: - name: Slack Notifications - uses: ./.github/workflows/slack-notifications.yml - permissions: - actions: read - contents: read - needs: [ test-coverage-report ] - 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-24.04 - permissions: - actions: write - needs: [ 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@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 - 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: `${context.runId}`, - } - }); diff --git a/.github/workflows/test-old-branches.yml b/.github/workflows/test-old-branches.yml deleted file mode 100644 index a6f7ed2bdcfd1..0000000000000 --- a/.github/workflows/test-old-branches.yml +++ /dev/null @@ -1,153 +0,0 @@ -name: Test old branches - -on: - # Verify the workflow is successful when this file is updated. - push: - branches: - - trunk - paths: - - '.github/workflows/test-old-branches.yml' - - '.github/workflows/reusable-phpunit-tests-v[1-2].yml' - # Run twice a month on the 1st and 15th at 00:00 UTC. - schedule: - - cron: '0 0 1 * *' - - cron: '0 0 15 * *' - workflow_dispatch: - inputs: - strategy: - description: 'The branches to test. Accepts X.Y branch names, or "all". Defaults to only the currently supported branch.' - required: false - type: string - default: '' - -# Disable permissions for all available scopes by default. -# Any needed permissions should be configured at the job level. -permissions: {} - -env: - CURRENTLY_SUPPORTED_BRANCH: '6.8' - -jobs: - dispatch-workflows-for-old-branches: - name: ${{ matrix.workflow }} for ${{ matrix.branch }} - runs-on: ubuntu-24.04 - permissions: - actions: write - timeout-minutes: 20 - if: ${{ github.repository == 'WordPress/wordpress-develop' }} - strategy: - fail-fast: false - matrix: - workflow: [ - 'coding-standards.yml', - 'javascript-tests.yml', - 'phpunit-tests.yml', - 'test-build-processes.yml' - ] - branch: [ - '6.8', '6.7', '6.6', '6.5', '6.4', '6.3', '6.2', '6.1','6.0', - '5.9', '5.8', '5.7', '5.6', '5.5', '5.4', '5.3', '5.2', '5.1', '5.0', - '4.9', '4.8', '4.7' - ] - include: - # PHP Compatibility testing was introduced in 5.5. - - branch: '6.8' - workflow: 'php-compatibility.yml' - - branch: '6.7' - workflow: 'php-compatibility.yml' - - branch: '6.6' - workflow: 'php-compatibility.yml' - - branch: '6.5' - workflow: 'php-compatibility.yml' - - branch: '6.4' - workflow: 'php-compatibility.yml' - - branch: '6.3' - workflow: 'php-compatibility.yml' - - branch: '6.2' - workflow: 'php-compatibility.yml' - - branch: '6.1' - workflow: 'php-compatibility.yml' - - branch: '6.0' - workflow: 'php-compatibility.yml' - - branch: '5.9' - workflow: 'php-compatibility.yml' - - branch: '5.8' - workflow: 'php-compatibility.yml' - - branch: '5.7' - workflow: 'php-compatibility.yml' - - branch: '5.6' - workflow: 'php-compatibility.yml' - - branch: '5.5' - workflow: 'php-compatibility.yml' - - # End-to-end testing was introduced in 5.3 but was later removed as there were no meaningful assertions. - # Starting in 5.8 with #52905, some additional tests with real assertions were introduced. - # Branches 5.8 and newer should be tested to confirm no regressions are introduced. - - branch: '6.8' - workflow: 'end-to-end-tests.yml' - - branch: '6.7' - workflow: 'end-to-end-tests.yml' - - branch: '6.6' - workflow: 'end-to-end-tests.yml' - - branch: '6.5' - workflow: 'end-to-end-tests.yml' - - branch: '6.4' - workflow: 'end-to-end-tests.yml' - - branch: '6.3' - workflow: 'end-to-end-tests.yml' - - branch: '6.2' - workflow: 'end-to-end-tests.yml' - - branch: '6.1' - workflow: 'end-to-end-tests.yml' - - branch: '6.0' - workflow: 'end-to-end-tests.yml' - - branch: '5.9' - workflow: 'end-to-end-tests.yml' - - branch: '5.8' - workflow: 'end-to-end-tests.yml' - - # Performance testing was introduced in 6.2 using Puppeteer but was overhauled to use Playwright instead in 6.4. - # Since the workflow frequently failed for 6.2 and 6.3 due to the flaky nature of the Puppeteer tests, - # the workflow was removed from those two branches. - - branch: '6.8' - workflow: 'performance.yml' - - branch: '6.7' - workflow: 'performance.yml' - - branch: '6.6' - workflow: 'performance.yml' - - branch: '6.5' - workflow: 'performance.yml' - - branch: '6.4' - workflow: 'performance.yml' - - # Run all branches monthly, but only the currently supported one twice per month. - steps: - - name: Dispatch workflow run - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 - if: ${{ github.event_name == 'push' || ( github.event_name == 'workflow_dispatch' && matrix.branch == inputs.strategy || inputs.strategy == 'all' ) || github.event.schedule == '0 0 15 * *' || matrix.branch == env.CURRENTLY_SUPPORTED_BRANCH }} - with: - retries: 2 - retry-exempt-status-codes: 418 - script: | - github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: '${{ matrix.workflow }}', - ref: '${{ matrix.branch }}' - }); - - slack-notifications: - name: Slack Notifications - uses: ./.github/workflows/slack-notifications.yml - permissions: - actions: read - contents: read - needs: [ dispatch-workflows-for-old-branches ] - 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 }} diff --git a/.github/workflows/upgrade-develop-testing.yml b/.github/workflows/upgrade-develop-testing.yml index cdd004acaedf3..5ea233f1e5673 100644 --- a/.github/workflows/upgrade-develop-testing.yml +++ b/.github/workflows/upgrade-develop-testing.yml @@ -46,7 +46,7 @@ jobs: # Build WordPress from the current branch ready for the upgrade tests. build: name: Build - uses: ./.github/workflows/reusable-build-package.yml + uses: WordPress/wordpress-develop/.github/workflows/reusable-build-package.yml@trunk if: ${{ startsWith( github.repository, 'WordPress/' ) && ( github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' ) }} permissions: contents: read @@ -54,7 +54,7 @@ jobs: # Run upgrade tests for the current branch. upgrade-tests-develop: name: Upgrade from ${{ matrix.wp }} - uses: ./.github/workflows/reusable-upgrade-testing.yml + uses: WordPress/wordpress-develop/.github/workflows/reusable-upgrade-testing.yml@trunk if: ${{ github.repository == 'WordPress/wordpress-develop' }} needs: [ build ] permissions: @@ -89,7 +89,7 @@ jobs: # Run a limited set of upgrade tests for the current branch on forks. upgrade-tests-develop-forks: name: Upgrade from ${{ matrix.wp }} - uses: ./.github/workflows/reusable-upgrade-testing.yml + uses: WordPress/wordpress-develop/.github/workflows/reusable-upgrade-testing.yml@trunk if: ${{ github.repository != 'WordPress/wordpress-develop' }} needs: [ build ] permissions: @@ -120,7 +120,7 @@ jobs: slack-notifications: name: Slack Notifications - uses: ./.github/workflows/slack-notifications.yml + uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk permissions: actions: read contents: read diff --git a/.github/workflows/upgrade-testing.yml b/.github/workflows/upgrade-testing.yml deleted file mode 100644 index 24ffdd7bfe7f9..0000000000000 --- a/.github/workflows/upgrade-testing.yml +++ /dev/null @@ -1,275 +0,0 @@ -# Confirms that updating WordPress using WP-CLI works successfully. -# -# This workflow is not meant to test wordpress-develop checkouts, but rather tagged versions officially available on WordPress.org. -name: Upgrade Tests - -on: - push: - branches: - - trunk - # Always test the workflow after it's updated. - paths: - - '.github/workflows/upgrade-testing.yml' - - '.github/workflows/reusable-upgrade-testing.yml' - pull_request: - # This workflow is only meant to run from trunk. Pull requests changing this file with different BASE branches should be ignored. - branches: - - trunk - # Always test the workflow when changes are suggested. - paths: - - '.github/workflows/upgrade-testing.yml' - - '.github/workflows/reusable-upgrade-testing.yml' - workflow_dispatch: - inputs: - new-version: - description: 'The version to test installing. Accepts major and minor versions, "latest", or "nightly". Major releases must not end with ".0".' - type: string - default: 'latest' - -# 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 }}-${{ inputs.new-version || 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: {} - -# Because the number of jobs spawned can quickly balloon out of control, the following methodology is applied when -# building out the matrix below: -# -# - The two most recent releases of WordPress are tested against all PHP/MySQL LTS version combinations and the -# most recent innovation release. -# - The next 6 oldest versions of WordPress are tested against both the oldest and newest releases of PHP currently -# supported for both PHP 7 & 8 along with the oldest and newest MySQL LTS versions currently supported (no innovation -# releases). At the current 3 releases per year pace, this accounts for 2 additional years worth of releases. -# - Of the remaining versions of WordPress still receiving security updates, only test the ones where the database -# version was updated since the previous major release. -# - The oldest version of WordPress receiving security updates should always be tested against the same combinations as -# detailed for the two most recent releases. - -# Notes about chosen MySQL versions: -# - Only the most recent innovation release should be included in testing. -# - Even though MySQL >= 5.5.5 is currently supported, there are no 5.5.x Docker containers available that work on -# modern architectures. -# - 5.6.x Docker containers are available and work, but 5.6 only accounts for ~2.3% of installs as of 12/6/2024.defaults: -# - 5.7.x accounts for ~20% of installs, so this is used below instead. -jobs: - # Tests the full list of PHP/MySQL combinations for the two most recent versions of WordPress. - upgrade-tests-recent-releases: - name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }} - uses: ./.github/workflows/reusable-upgrade-testing.yml - if: ${{ github.repository == 'WordPress/wordpress-develop' }} - permissions: - contents: read - strategy: - fail-fast: false - matrix: - os: [ 'ubuntu-24.04' ] - php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ] - db-type: [ 'mysql' ] - db-version: [ '5.7', '8.0', '8.4', '9.4' ] - wp: [ '6.7', '6.8' ] - multisite: [ false, true ] - - exclude: - # The PHP <= 7.3/MySQL 8.4 jobs currently fail due to mysql_native_password being disabled by default. See https://core.trac.wordpress.org/ticket/61218. - - php: '7.2' - db-version: '8.4' - - php: '7.3' - db-version: '8.4' - # MySQL 9.0+ will not work on PHP 7.2 & 7.3. See https://core.trac.wordpress.org/ticket/61218. - - php: '7.2' - db-version: '9.4' - - php: '7.3' - db-version: '9.4' - with: - os: ${{ matrix.os }} - php: ${{ matrix.php }} - db-type: ${{ matrix.db-type }} - db-version: ${{ matrix.db-version }} - wp: ${{ matrix.wp }} - new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }} - multisite: ${{ matrix.multisite }} - - # Tests 6.x releases where the WordPress database version changed on the oldest and newest supported versions of PHP 7 & 8. - upgrade-tests-wp-6x-mysql: - name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }} - uses: ./.github/workflows/reusable-upgrade-testing.yml - if: ${{ github.repository == 'WordPress/wordpress-develop' }} - permissions: - contents: read - strategy: - fail-fast: false - matrix: - os: [ 'ubuntu-24.04' ] - php: [ '7.2', '7.4', '8.0', '8.4' ] - db-type: [ 'mysql' ] - db-version: [ '5.7', '8.4' ] - wp: [ '6.0', '6.3', '6.4', '6.5' ] - multisite: [ false, true ] - - exclude: - # The PHP <= 7.3/MySQL 8.4 jobs currently fail due to mysql_native_password being disabled by default. See https://core.trac.wordpress.org/ticket/61218. - - php: '7.2' - db-version: '8.4' - with: - os: ${{ matrix.os }} - php: ${{ matrix.php }} - db-type: ${{ matrix.db-type }} - db-version: ${{ matrix.db-version }} - wp: ${{ matrix.wp }} - new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }} - multisite: ${{ matrix.multisite }} - - # Tests 5.x releases where the WordPress database version changed on the oldest and newest supported versions of PHP 7. - upgrade-tests-wp-5x-php-7x-mysql: - name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }} - uses: ./.github/workflows/reusable-upgrade-testing.yml - if: ${{ github.repository == 'WordPress/wordpress-develop' }} - permissions: - contents: read - strategy: - fail-fast: false - matrix: - os: [ 'ubuntu-24.04' ] - php: [ '7.2', '7.4' ] - db-type: [ 'mysql' ] - db-version: [ '5.7', '8.4' ] - wp: [ '5.0', '5.1', '5.3', '5.4', '5.5', '5.6', '5.9' ] - multisite: [ false, true ] - - exclude: - # The PHP <= 7.3/MySQL 8.4 jobs currently fail due to mysql_native_password being disabled by default. See https://core.trac.wordpress.org/ticket/61218. - - php: '7.2' - db-version: '8.4' - with: - os: ${{ matrix.os }} - php: ${{ matrix.php }} - db-type: ${{ matrix.db-type }} - db-version: ${{ matrix.db-version }} - wp: ${{ matrix.wp }} - new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }} - multisite: ${{ matrix.multisite }} - - # Tests 5.x releases where the WordPress database version changed on the oldest and newest supported versions of PHP 8. - # - # WordPress 5.0-5.2 are excluded from PHP 8+ testing because of the following fatal errors: - # - Use of __autoload(). - # - array/string offset with curly braces. - upgrade-tests-wp-5x-php-8x-mysql: - name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }} - uses: ./.github/workflows/reusable-upgrade-testing.yml - if: ${{ github.repository == 'WordPress/wordpress-develop' }} - permissions: - contents: read - strategy: - fail-fast: false - matrix: - os: [ 'ubuntu-24.04' ] - php: [ '8.0', '8.4' ] - db-type: [ 'mysql' ] - db-version: [ '5.7', '8.4' ] - wp: [ '5.3', '5.4', '5.5', '5.6', '5.9' ] - multisite: [ false, true ] - with: - os: ${{ matrix.os }} - php: ${{ matrix.php }} - db-type: ${{ matrix.db-type }} - db-version: ${{ matrix.db-version }} - wp: ${{ matrix.wp }} - new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }} - multisite: ${{ matrix.multisite }} - - # The oldest version of WordPress receiving security updates should always be tested against - # the widest possible list of PHP/MySQL combinations. - # - # WordPress 4.7 is excluded from PHP 8+ testing because of the following fatal errors: - # - Use of __autoload(). - # - array/string offset with curly braces. - upgrade-tests-oldest-wp-mysql: - name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }} - uses: ./.github/workflows/reusable-upgrade-testing.yml - if: ${{ github.repository == 'WordPress/wordpress-develop' }} - permissions: - contents: read - strategy: - fail-fast: false - matrix: - os: [ 'ubuntu-24.04' ] - php: [ '7.2', '7.3', '7.4' ] - db-type: [ 'mysql' ] - db-version: [ '5.7', '8.0', '8.4', '9.4' ] - wp: [ '4.7' ] - multisite: [ false, true ] - - exclude: - # The PHP <= 7.3/MySQL 8.4 jobs currently fail due to mysql_native_password being disabled by default. See https://core.trac.wordpress.org/ticket/61218. - - php: '7.2' - db-version: '8.4' - - php: '7.3' - db-version: '8.4' - # MySQL 9.0+ will not work on PHP 7.2 & 7.3. See https://core.trac.wordpress.org/ticket/61218. - - php: '7.2' - db-version: '9.4' - - php: '7.3' - db-version: '9.4' - with: - os: ${{ matrix.os }} - php: ${{ matrix.php }} - db-type: ${{ matrix.db-type }} - db-version: ${{ matrix.db-version }} - wp: ${{ matrix.wp }} - new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }} - multisite: ${{ matrix.multisite }} - - slack-notifications: - name: Slack Notifications - uses: ./.github/workflows/slack-notifications.yml - permissions: - actions: read - contents: read - needs: [ upgrade-tests-recent-releases, upgrade-tests-wp-6x-mysql, upgrade-tests-wp-5x-php-7x-mysql, upgrade-tests-wp-5x-php-8x-mysql, upgrade-tests-oldest-wp-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-24.04 - permissions: - actions: write - needs: [ 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@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 - 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: `${context.runId}`, - } - }); diff --git a/.github/workflows/workflow-lint.yml b/.github/workflows/workflow-lint.yml index 0aae098543e21..774d621151408 100644 --- a/.github/workflows/workflow-lint.yml +++ b/.github/workflows/workflow-lint.yml @@ -32,7 +32,7 @@ permissions: {} jobs: lint: name: Lint GitHub Action files - uses: ./.github/workflows/reusable-workflow-lint.yml + uses: WordPress/wordpress-develop/.github/workflows/reusable-workflow-lint.yml@trunk if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} permissions: security-events: write @@ -41,7 +41,7 @@ jobs: slack-notifications: name: Slack Notifications - uses: ./.github/workflows/slack-notifications.yml + uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk permissions: actions: read contents: read diff --git a/docker-compose.yml b/docker-compose.yml index 274e106ec8e5c..322285d6b3564 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -32,7 +32,7 @@ services: # The PHP container. ## php: - image: wordpressdevelop/php:${LOCAL_PHP-latest} + image: wordpressdevelop/php:${LOCAL_PHP-8.5-fpm} networks: - wpdevnet @@ -64,7 +64,7 @@ services: # The MySQL container. ## mysql: - image: ${LOCAL_DB_TYPE-mysql}:${LOCAL_DB_VERSION-latest} + image: ${LOCAL_DB_TYPE-mysql}:${LOCAL_DB_VERSION-8.4} networks: - wpdevnet @@ -95,7 +95,7 @@ services: # The WP CLI container. ## cli: - image: wordpressdevelop/cli:${LOCAL_PHP-latest} + image: wordpressdevelop/cli:${LOCAL_PHP-8.5-fpm} networks: - wpdevnet