From 2b8f8d54de6842279fc2fc4c7bce14e2aee14011 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Mon, 6 Oct 2025 17:52:52 +0100 Subject: [PATCH 1/2] Remove unnecessary workflows. --- .github/workflows/failed-workflow.yml | 54 --- .github/workflows/install-testing.yml | 212 ----------- .github/workflows/performance.yml | 96 ----- .../reusable-coding-standards-javascript.yml | 56 --- .../reusable-coding-standards-php.yml | 103 ------ .../workflows/reusable-end-to-end-tests.yml | 141 -------- .../workflows/reusable-javascript-tests.yml | 51 --- .github/workflows/reusable-performance.yml | 340 ------------------ .../workflows/reusable-php-compatibility.yml | 85 ----- .../workflows/reusable-phpunit-tests-v1.yml | 184 ---------- .../workflows/reusable-phpunit-tests-v2.yml | 205 ----------- .../workflows/reusable-phpunit-tests-v3.yml | 210 ----------- .../reusable-test-core-build-process.yml | 124 ------- .../reusable-test-gutenberg-build-process.yml | 92 ----- .../workflows/reusable-upgrade-testing.yml | 89 ----- .github/workflows/slack-notifications.yml | 226 ------------ .../workflows/test-and-zip-default-themes.yml | 246 ------------- .github/workflows/test-coverage.yml | 240 ------------- .github/workflows/test-old-branches.yml | 134 ------- 19 files changed, 2888 deletions(-) delete mode 100644 .github/workflows/failed-workflow.yml delete mode 100644 .github/workflows/install-testing.yml delete mode 100644 .github/workflows/performance.yml delete mode 100644 .github/workflows/reusable-coding-standards-javascript.yml delete mode 100644 .github/workflows/reusable-coding-standards-php.yml delete mode 100644 .github/workflows/reusable-end-to-end-tests.yml delete mode 100644 .github/workflows/reusable-javascript-tests.yml delete mode 100644 .github/workflows/reusable-performance.yml delete mode 100644 .github/workflows/reusable-php-compatibility.yml delete mode 100644 .github/workflows/reusable-phpunit-tests-v1.yml delete mode 100644 .github/workflows/reusable-phpunit-tests-v2.yml delete mode 100644 .github/workflows/reusable-phpunit-tests-v3.yml delete mode 100644 .github/workflows/reusable-test-core-build-process.yml delete mode 100644 .github/workflows/reusable-test-gutenberg-build-process.yml delete mode 100644 .github/workflows/reusable-upgrade-testing.yml delete mode 100644 .github/workflows/slack-notifications.yml delete mode 100644 .github/workflows/test-and-zip-default-themes.yml delete mode 100644 .github/workflows/test-coverage.yml delete mode 100644 .github/workflows/test-old-branches.yml diff --git a/.github/workflows/failed-workflow.yml b/.github/workflows/failed-workflow.yml deleted file mode 100644 index 383800a3fc592..0000000000000 --- a/.github/workflows/failed-workflow.yml +++ /dev/null @@ -1,54 +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-latest - permissions: - actions: write - timeout-minutes: 30 - - steps: - - name: Rerun a workflow - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 - 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: ${{ inputs.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: ${{ inputs.run_id }}, - enable_debug_logging: true - }); diff --git a/.github/workflows/install-testing.yml b/.github/workflows/install-testing.yml deleted file mode 100644 index dfec592c2e154..0000000000000 --- a/.github/workflows/install-testing.yml +++ /dev/null @@ -1,212 +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' - pull_request: - # Always test the workflow when changes are suggested. - paths: - - '.github/workflows/install-testing.yml' - - '.version-support-*.json' - 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 appropriate values for PHP and database versions based on the WordPress version being tested. - # - # Performs the following steps: - # - Checks out the repository. - # - Fetches the versions of PHP to test. - # - Fetches the versions of MySQL to test. - build-matrix: - name: Determine PHP Versions to test - runs-on: ubuntu-latest - if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} - timeout-minutes: 5 - outputs: - major-wp-version: ${{ steps.major-wp-version.outputs.version }} - php-versions: ${{ steps.php-versions.outputs.versions }} - mysql-versions: ${{ steps.mysql-versions.outputs.versions }} - - steps: - - name: Checkout repository - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Determine the major WordPress version - id: major-wp-version - run: | - if [ "${{ inputs.wp-version }}" ] && [ "${{ inputs.wp-version }}" != "nightly" ] && [ "${{ inputs.wp-version }}" != "latest" ]; then - echo "version=$(echo "${{ inputs.wp-version }}" | tr '.' '-' | cut -d '-' -f1-2)" >> $GITHUB_OUTPUT - elif [ "${{ inputs.wp-version }}" ]; then - echo "version=$(echo "${{ inputs.wp-version }}")" >> $GITHUB_OUTPUT - else - echo "version=nightly" >> $GITHUB_OUTPUT - fi - - # Look up the major version's specific PHP support policy when a version is provided. - # Otherwise, use the current PHP support policy. - - name: Get supported PHP versions - id: php-versions - run: | - if [ "${{ steps.major-wp-version.outputs.version }}" != "latest" ] && [ "${{ steps.major-wp-version.outputs.version }}" != "nightly" ]; then - echo "versions=$(jq -r '.["${{ steps.major-wp-version.outputs.version }}"] | @json' .version-support-php.json)" >> $GITHUB_OUTPUT - else - echo "versions=$(jq -r '.[ (keys[-1]) ] | @json' .version-support-php.json)" >> $GITHUB_OUTPUT - fi - - # Look up the major version's specific MySQL support policy when a version is provided. - # Otherwise, use the current MySQL support policy. - - name: Get supported MySQL versions - id: mysql-versions - run: | - if [ "${{ steps.major-wp-version.outputs.version }}" != "latest" ] && [ "${{ steps.major-wp-version.outputs.version }}" != "nightly" ]; then - echo "versions=$(jq -r '.["${{ steps.major-wp-version.outputs.version }}"] | @json' .version-support-mysql.json)" >> $GITHUB_OUTPUT - else - echo "versions=$(jq -r '.[ (keys[-1]) ] | @json' .version-support-mysql.json)" >> $GITHUB_OUTPUT - fi - - # Test the WordPress installation process through WP-CLI. - # - # Performs the following steps: - # - Sets up PHP. - # - Starts the database server. - # - Downloads the specified version of WordPress. - # - Creates a `wp-config.php` file. - # - Installs WordPress. - 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' || github.event_name == 'pull_request' }} - timeout-minutes: 10 - needs: [ build-matrix ] - strategy: - fail-fast: false - matrix: - os: [ ubuntu-latest ] - php: ${{ fromJSON( needs.build-matrix.outputs.php-versions ) }} - db-type: [ 'mysql' ] - db-version: ${{ fromJSON( needs.build-matrix.outputs.mysql-versions ) }} - multisite: [ false, true ] - memcached: [ false ] - - # Exclude some PHP and MySQL versions that cannot currently be tested with Docker containers. - exclude: - - php: '5.2' - - php: '5.3' - - db-version: '5.0' - - db-version: '5.1' - - db-version: '5.5' - - 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-version != '5.5' && ' --default-authentication-plugin=mysql_native_password"' || '' }} - - steps: - - name: Set up PHP ${{ matrix.php }} - uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1 - with: - php-version: '${{ matrix.php }}' - coverage: none - tools: wp-cli${{ contains( fromJSON('["5.4", "5.5"]'), matrix.php ) && ':2.4.0' || '' }} - - - name: Start the database server - run: | - sudo systemctl start ${{ matrix.db-type }} - - - name: Download WordPress - run: wp core download ${{ inputs.wp-version && format( '--version={0}', inputs.wp-version ) || '--version=nightly' }} - - - name: Create wp-config.php file - run: wp config create --dbname=test_db --dbuser=root --dbpass=root --dbhost=127.0.0.1:${{ job.services.database.ports['3306'] }} - - - name: Install WordPress - run: wp core ${{ matrix.multisite && 'multisite-' || '' }}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: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk - 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-latest - 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@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 - with: - retries: 2 - retry-exempt-status-codes: 418 - script: | - github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: 'failed-workflow.yml', - ref: 'trunk', - inputs: { - run_id: '${{ github.run_id }}' - } - }); diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml deleted file mode 100644 index e4929763afa83..0000000000000 --- a/.github/workflows/performance.yml +++ /dev/null @@ -1,96 +0,0 @@ -name: Performance Tests - -on: - push: - branches: - - trunk - - '6.[2-9]' - - '[7-9].[0-9]' - tags: - - '[0-9]+.[0-9]' - - '[0-9]+.[0-9].[0-9]+' - - '![45].[0-9].[0-9]+' - - '!6.[01].[0-9]+' - pull_request: - branches: - - trunk - - '6.[2-9]' - - '[7-9].[0-9]' - workflow_dispatch: - -# Cancels all previous workflow runs for pull requests that have not completed. -concurrency: - # The concurrency group contains the workflow name and the branch name for pull requests - # or the commit hash for any other events. - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} - cancel-in-progress: true - -# Disable permissions for all available scopes by default. -# Any needed permissions should be configured at the job level. -permissions: {} - -jobs: - # Runs the performance test suite. - performance: - name: Performance tests ${{ matrix.memcached && '(with memcached)' || '' }} - uses: WordPress/wordpress-develop/.github/workflows/reusable-performance.yml@trunk - permissions: - contents: read - if: ${{ ( github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' ) && ! contains( github.event.before, '00000000' ) }} - strategy: - fail-fast: false - matrix: - memcached: [ true, false ] - with: - memcached: ${{ matrix.memcached }} - secrets: - CODEVITALS_PROJECT_TOKEN: ${{ secrets.CODEVITALS_PROJECT_TOKEN }} - - slack-notifications: - name: Slack Notifications - uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk - permissions: - actions: read - contents: read - needs: [ performance ] - if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }} - with: - calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }} - secrets: - SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }} - SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }} - SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }} - SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }} - - failed-workflow: - name: Failed workflow tasks - runs-on: ubuntu-latest - permissions: - actions: write - needs: [ slack-notifications ] - if: | - always() && - github.repository == 'WordPress/wordpress-develop' && - github.event_name != 'pull_request' && - github.run_attempt < 2 && - ( - contains( needs.*.result, 'cancelled' ) || - contains( needs.*.result, 'failure' ) - ) - - steps: - - name: Dispatch workflow run - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 - with: - retries: 2 - retry-exempt-status-codes: 418 - script: | - github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: 'failed-workflow.yml', - ref: 'trunk', - inputs: { - run_id: '${{ github.run_id }}' - } - }); diff --git a/.github/workflows/reusable-coding-standards-javascript.yml b/.github/workflows/reusable-coding-standards-javascript.yml deleted file mode 100644 index 74207a8978bbd..0000000000000 --- a/.github/workflows/reusable-coding-standards-javascript.yml +++ /dev/null @@ -1,56 +0,0 @@ -## -# A reusable workflow that checks the JavaScript coding standards. -## -name: JavaScript coding standards - -on: - workflow_call: - -env: - PUPPETEER_SKIP_DOWNLOAD: ${{ true }} - -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: Run coding standards checks - runs-on: ubuntu-latest - permissions: - contents: read - timeout-minutes: 20 - - steps: - - name: Checkout repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Set up Node.js - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 - 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 40c4294b0ff51..0000000000000 --- a/.github/workflows/reusable-coding-standards-php.yml +++ /dev/null @@ -1,103 +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 - -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: Run coding standards checks - runs-on: ubuntu-latest - permissions: - contents: read - timeout-minutes: 20 - - steps: - - name: Checkout repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Set up PHP - uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1 - 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@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1 - 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@57532f8be5bda426838819c5ee9afb8af389d51a # v3.0.0 - 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 6a6cc5858e33c..0000000000000 --- a/.github/workflows/reusable-end-to-end-tests.yml +++ /dev/null @@ -1,141 +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' - -env: - LOCAL_DIR: build - LOCAL_PHP: ${{ inputs.php-version }}${{ 'latest' != inputs.php-version && '-fpm' || '' }} - -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: Run E2E tests - runs-on: ubuntu-latest - 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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Set up Node.js - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 - 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 - - - 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 && format( ' --version={0}', inputs.gutenberg-version ) || '' }} --path=/var/www/${{ env.LOCAL_DIR }} - - - name: Install additional languages - run: | - npm run env:cli -- language core install de_DE --path=/var/www/${{ env.LOCAL_DIR }} - npm run env:cli -- language plugin install de_DE --all --path=/var/www/${{ env.LOCAL_DIR }} - npm run env:cli -- language theme install de_DE --all --path=/var/www/${{ env.LOCAL_DIR }} - - - name: Run E2E tests - run: npm run test:e2e - - - name: Archive debug artifacts (screenshots, HTML snapshots) - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 - 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 2760df118fe98..0000000000000 --- a/.github/workflows/reusable-javascript-tests.yml +++ /dev/null @@ -1,51 +0,0 @@ -## -# A reusable workflow that runs JavaScript tests. -## -name: JavaScript tests - -on: - workflow_call: - -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-latest - permissions: - contents: read - timeout-minutes: 20 - - steps: - - name: Checkout repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Set up Node.js - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 - 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 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.yml b/.github/workflows/reusable-performance.yml deleted file mode 100644 index 814e7b95b8d10..0000000000000 --- a/.github/workflows/reusable-performance.yml +++ /dev/null @@ -1,340 +0,0 @@ -## -# A reusable workflow that runs the performance test suite. -## -name: 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.1.1' - 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 - secrets: - CODEVITALS_PROJECT_TOKEN: - description: 'The authorization token for https://www.codevitals.run/project/wordpress.' - required: false - -env: - PUPPETEER_SKIP_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' || '' }} - -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. - # - Log running Docker containers. - # - Docker debug information. - # - Install WordPress. - # - 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: Run tests - runs-on: ubuntu-latest - permissions: - contents: read - if: ${{ ( github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' ) && ! 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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - fetch-depth: ${{ github.event_name == 'workflow_dispatch' && '2' || '1' }} - - # 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@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 - 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: Install WordPress Importer plugin - run: npm run env:cli -- plugin install wordpress-importer --activate --path=/var/www/${{ env.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/${{ env.LOCAL_DIR }} - rm themeunittestdata.wordpress.xml - - - name: Deactivate WordPress Importer plugin - run: npm run env:cli -- plugin deactivate wordpress-importer --path=/var/www/${{ env.LOCAL_DIR }} - - - name: Update permalink structure - run: npm run env:cli -- rewrite structure '/%year%/%monthnum%/%postname%/' --path=/var/www/${{ env.LOCAL_DIR }} - - - name: Install additional languages - run: | - npm run env:cli -- language core install de_DE --path=/var/www/${{ env.LOCAL_DIR }} - npm run env:cli -- language plugin install de_DE --all --path=/var/www/${{ env.LOCAL_DIR }} - npm run env:cli -- language theme install de_DE --all --path=/var/www/${{ env.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/${{ env.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/${{ env.LOCAL_DIR }} - - - name: List defined constants - run: npm run env:cli -- config list --path=/var/www/${{ env.LOCAL_DIR }} - - - name: Install MU plugin - run: | - mkdir ./${{ env.LOCAL_DIR }}/wp-content/mu-plugins - cp ./tests/performance/wp-content/mu-plugins/server-timing.php ./${{ env.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@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 - 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( '${{ 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/${{ env.LOCAL_DIR }} - - - name: Flush cache - if: ${{ steps.get-previous-build.outputs.result }} - run: npm run env:cli -- cache flush --path=/var/www/${{ env.LOCAL_DIR }} - - - name: Delete expired transients - if: ${{ steps.get-previous-build.outputs.result }} - run: npm run env:cli -- transient delete --expired --path=/var/www/${{ env.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: | - npm run env:cli -- core update --version=${{ env.BASE_TAG }} --force --path=/var/www/${{ env.LOCAL_DIR }} - npm run env:cli -- core version --path=/var/www/${{ env.LOCAL_DIR }} - - - name: Run any database upgrades - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' }} - run: npm run env:cli -- core update-db --path=/var/www/${{ env.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/${{ env.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/${{ env.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@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 - if: always() - with: - name: performance-artifacts${{ 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 }} - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 - 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/${{ env.BASE_TAG }}' }); - return baseRef.data.object.sha; - - - name: Set commit details - # Only needed when publishing results. - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' && ! inputs.memcached }} - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 - id: commit-timestamp - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const commit_details = await github.rest.git.getCommit({ owner: context.repo.owner, repo: context.repo.repo, commit_sha: context.sha }); - return parseInt((new Date( commit_details.data.author.date ).getTime() / 1000).toFixed(0)) - - - name: Publish performance results - # Only publish results on pushes to trunk. - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' && ! inputs.memcached }} - env: - BASE_SHA: ${{ steps.base-sha.outputs.result }} - COMMITTED_AT: ${{ steps.commit-timestamp.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" >> $GITHUB_OUTPUT - exit 1 - fi - 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 e22457d29e444..0000000000000 --- a/.github/workflows/reusable-php-compatibility.yml +++ /dev/null @@ -1,85 +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' - -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-latest - permissions: - contents: read - timeout-minutes: 20 - - steps: - - name: Checkout repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Set up PHP - uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1 - 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@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1 - 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@57532f8be5bda426838819c5ee9afb8af389d51a # v3.0.0 - 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 3098c49066aa7..0000000000000 --- a/.github/workflows/reusable-phpunit-tests-v1.yml +++ /dev/null @@ -1,184 +0,0 @@ -## -# DEPRECATED -# -# A reusable workflow that runs the PHPUnit test suite with the specified configuration. -# -# This workflow is used by branches 4.1 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-latest' - 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: - 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' - -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 - - 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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Set up Node.js - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 - with: - node-version-file: '.nvmrc' - cache: npm - - - name: Install Dependencies - run: npm ci - - - name: Build WordPress - run: npm run build - - - name: Cache Composer dependencies - if: ${{ env.COMPOSER_INSTALL == true }} - uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1 - 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 - docker run --name memcached --net $(basename "$PWD")_wpdevnet -d memcached - - - name: General debug information - run: | - npm --version - node --version - curl --version - git --version - svn --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:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.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:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-required - - - name: Run PHPUnit tests for Multisite excluding slow tests - if: ${{ inputs.php < '7.0' && ! inputs.split_slow && inputs.multisite }} - run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-excluded,oembed-headers - - - name: Run PHPUnit tests - if: ${{ inputs.php >= '7.0' }} - run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} - - - name: Run AJAX tests - if: ${{ ! inputs.multisite && ! inputs.split_slow }} - run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax - - - name: Run external HTTP tests - if: ${{ ! inputs.multisite && ! inputs.split_slow }} - run: npm run test:${{ env.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 6df304bcb9f29..0000000000000 --- a/.github/workflows/reusable-phpunit-tests-v2.yml +++ /dev/null @@ -1,205 +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-latest' - 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' - -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 - - 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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Install Node.js - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 - 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@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1 - 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 [ ${{ env.LOCAL_PHP }} == '8.0-fpm' ]; then - docker compose run --rm php composer install --ignore-platform-reqs - echo "PHPUNIT_SCRIPT=php-composer" >> $GITHUB_ENV - elif [ ${{ env.LOCAL_PHP }} == '7.1-fpm' ]; then - docker compose run --rm php composer update - git checkout -- composer.lock - elif [[ ${{ env.LOCAL_PHP }} == '5.6-fpm' || ${{ env.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:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.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:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-required - - - name: Run PHPUnit tests for Multisite excluding slow tests - if: ${{ inputs.php < '7.0' && ! inputs.split_slow && inputs.multisite }} - run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-excluded,oembed-headers - - - name: Run PHPUnit tests - if: ${{ inputs.php >= '7.0' }} - run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} - - - name: Run AJAX tests - if: ${{ ! inputs.split_slow&& inputs.test_ajax }} - run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax - - - name: Run ms-files tests as a multisite install - if: ${{ inputs.multisite && ! inputs.split_slow }} - run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ms-files - - - name: Run external HTTP tests - if: ${{ ! inputs.multisite && ! inputs.split_slow }} - run: npm run test:${{ env.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:${{ env.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 5acdbae89c338..0000000000000 --- a/.github/workflows/reusable-phpunit-tests-v3.yml +++ /dev/null @@ -1,210 +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-latest' - 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.0' - 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' - 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_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 }} - -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. - # - 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: PHP ${{ inputs.php }} / ${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.multisite && ' multisite' || '' }}${{ inputs.phpunit-test-groups && format( ' ({0})', inputs.phpunit-test-groups ) || '' }}${{ inputs.memcached && ' with memcached' || '' }}${{ inputs.report && ' (test reporting enabled)' || '' }} ${{ 'example.org' != inputs.tests-domain && inputs.tests-domain || '' }} - 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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Set up Node.js - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 - 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@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1 - 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@57532f8be5bda426838819c5ee9afb8af389d51a # v3.0.0 - 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 ${{ env.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: Run PHPUnit tests${{ inputs.phpunit-test-groups && format( ' ({0} groups)', inputs.phpunit-test-groups ) || '' }} - continue-on-error: ${{ inputs.allow-errors }} - run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }}${{ inputs.phpunit-test-groups && format( ' --group {0}', inputs.phpunit-test-groups ) || '' }} - - - name: Run AJAX tests - if: ${{ ! inputs.phpunit-test-groups }} - continue-on-error: ${{ inputs.allow-errors }} - run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax - - - name: Run ms-files tests as a multisite install - if: ${{ inputs.multisite && ! inputs.phpunit-test-groups }} - continue-on-error: ${{ inputs.allow-errors }} - run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ms-files - - - name: Run external HTTP tests - if: ${{ ! inputs.multisite && ! inputs.phpunit-test-groups }} - continue-on-error: ${{ inputs.allow-errors }} - run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group external-http - - # __fakegroup__ is excluded to force PHPUnit to ignore the settings in phpunit.xml.dist. - - name: Run (Xdebug) tests - if: ${{ inputs.php != '8.4' && ! inputs.phpunit-test-groups }} - 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: Ensure version-controlled files are not modified or deleted - run: git diff --exit-code - - - name: Checkout the WordPress Test Reporter - if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && inputs.report }} - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - repository: 'WordPress/phpunit-test-runner' - path: 'test-runner' - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Submit test results to the WordPress.org host test results - if: ${{ github.repository == 'WordPress/wordpress-develop' && 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-test-core-build-process.yml b/.github/workflows/reusable-test-core-build-process.yml deleted file mode 100644 index 4a887f3b69233..0000000000000 --- a/.github/workflows/reusable-test-core-build-process.yml +++ /dev/null @@ -1,124 +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-latest' - 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 grunt precommit:emoji script.' - required: false - type: 'boolean' - default: true - 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 }} - -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: Core running from ${{ inputs.directory }} / ${{ contains( inputs.os, 'macos-' ) && 'MacOS' || contains( inputs.os, 'windows-' ) && 'Windows' || 'Linux' }} - runs-on: ${{ inputs.os }} - timeout-minutes: 20 - - steps: - - name: Checkout repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Set up Node.js - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 - 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: Build WordPress to run from ${{ inputs.directory }} - run: npm run build${{ inputs.directory == 'src' && ':dev' || '' }} - - - 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' && 'ubuntu-latest' == inputs.os }} - run: zip -r wordpress.zip build/. - - - name: Clean after building to run from ${{ inputs.directory }} - run: npm run grunt clean${{ inputs.directory == 'src' && ' -- --dev' || '' }} - - - 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@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 - 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 ${{ github.event.number }} > ./pr-number/NR - - # 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@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 - 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 8e52b02236239..0000000000000 --- a/.github/workflows/reusable-test-gutenberg-build-process.yml +++ /dev/null @@ -1,92 +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-latest' - 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' - -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 Core npm dependencies. - # - Installs Gutenberg npm dependencies. - # - Runs the Gutenberg build process. - # - 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: Gutenberg running from ${{ inputs.directory }} / ${{ contains( inputs.os, 'macos-' ) && 'MacOS' || contains( inputs.os, 'windows-' ) && 'Windows' || 'Linux' }} - runs-on: ${{ inputs.os }} - timeout-minutes: 30 - - steps: - - name: Checkout repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Checkout Gutenberg plugin - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - repository: 'WordPress/gutenberg' - path: ${{ env.GUTENBERG_DIRECTORY }} - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Set up Node.js - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 - 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 Core Dependencies - run: npm ci - - - 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: Build WordPress to run from ${{ inputs.directory }} - run: npm run build${{ inputs.directory == 'src' && ':dev' || '' }} - - - 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-upgrade-testing.yml b/.github/workflows/reusable-upgrade-testing.yml deleted file mode 100644 index 6b285d190c6a3..0000000000000 --- a/.github/workflows/reusable-upgrade-testing.yml +++ /dev/null @@ -1,89 +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-latest' - wp: - description: 'The version of WordPress to start with.' - required: true - type: 'string' - new-version: - description: 'The version of WordPress 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' - -jobs: - # Runs upgrade tests on a build of WordPress. - # - # Performs the following steps: - # - Sets up PHP. - # - Starts the database server. - # - Downloads the specified version of WordPress. - # - Creates a `wp-config.php` file. - # - Installs WordPress. - # - Updates to the latest minor version. - # - Updates to the version of WordPress being tested. - upgrade-tests: - name: ${{ inputs.wp }} to ${{ inputs.new-version }} / PHP ${{ inputs.php }} with ${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.multisite && ' multisite' || '' }} - 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 --default-authentication-plugin=mysql_native_password" - - steps: - - name: Set up PHP ${{ inputs.php }} - uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1 - with: - php-version: '${{ inputs.php }}' - coverage: none - tools: wp-cli - - - name: Start the database server - run: | - sudo systemctl start ${{ inputs.db-type }} - - - name: Download WordPress ${{ inputs.wp }} - run: wp core download --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:${{ job.services.database.ports['3306'] }} - - - name: Install WordPress - run: wp core ${{ inputs.multisite && 'multisite-' || '' }}install --url=http://localhost/ --title="Upgrade Test" --admin_user=admin --admin_password=password --admin_email=me@example.org --skip-email - - - name: Update to the latest minor version - run: wp core update --minor - - - name: Upgrade to WordPress ${{ inputs.new-version }} - run: | - wp core update${{ 'latest' != inputs.new-version && format( ' --version={0}', inputs.new-version ) || '' }} diff --git a/.github/workflows/slack-notifications.yml b/.github/workflows/slack-notifications.yml deleted file mode 100644 index 2f125aef7a0f4..0000000000000 --- a/.github/workflows/slack-notifications.yml +++ /dev/null @@ -1,226 +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-latest - 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-conclusion.outputs.previous_conclusion }} - payload: ${{ steps.create-payload.outputs.payload }} - - steps: - - name: Determine the status of the previous attempt - id: previous-attempt-result - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 - with: - retries: 2 - retry-exempt-status-codes: 418 - script: | - const workflow_run = await github.rest.actions.getWorkflowRun({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: ${{ github.run_id }}, - }); - - if ( '${{ inputs.calling_status }}' == 'failure' && workflow_run.data.run_attempt == 1 ) { - return 'first-failure'; - } - - // When a workflow has been restarted, check the previous run attempt. Because workflows are automatically - // restarted once and a failure on the first run is not reported, failures on the second run should not be - // considered. - if ( workflow_run.data.run_attempt > 2 ) { - const previous_run = await github.rest.actions.getWorkflowRunAttempt({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: ${{ github.run_id }}, - 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: '${{ 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'; - - - name: Store previous conclusion as an output - id: previous-conclusion - run: echo "previous_conclusion=${{ steps.previous-attempt-result.outputs.result }}" >> $GITHUB_OUTPUT - - - name: Get the commit message - id: current-commit-message - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 - if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }} - with: - retries: 2 - retry-exempt-status-codes: 418 - script: | - const commit_details = await github.rest.repos.getCommit({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: '${{ github.sha }}' - }); - return commit_details.data.commit.message; - - - name: Prepare commit message. - id: commit-message - run: | - COMMIT_MESSAGE=$(cat <<'EOF' | awk 'NR==1' | sed 's/`/\\`/g' | sed 's/\"/\\\\\\"/g' | sed 's/\$/\\$/g' - ${{ ( github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) && fromJson( steps.current-commit-message.outputs.result ) || github.event.head_commit.message }} - EOF - ) - echo "commit_message_escaped=${COMMIT_MESSAGE}" >> $GITHUB_OUTPUT - - - name: Construct payload and store as an output - id: create-payload - run: echo "payload={\"workflow_name\":\"${{ github.workflow }}\",\"ref_name\":\"${{ env.CURRENT_BRANCH }}\",\"run_url\":\"https://github.com/WordPress/wordpress-develop/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}\",\"commit_message\":\"${{ steps.commit-message.outputs.commit_message_escaped }}\"}" >> $GITHUB_OUTPUT - - # Posts notifications when a workflow fails. - failure: - name: Failure notifications - runs-on: ubuntu-latest - continue-on-error: true - timeout-minutes: 5 - 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@37ebaef184d7626c5f204ab8d3baff4262dd30f0 # v1.27.0 - with: - payload: ${{ needs.prepare.outputs.payload }} - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }} - - # Posts notifications the first time a workflow run succeeds after previously failing. - fixed: - name: Fixed notifications - runs-on: ubuntu-latest - continue-on-error: true - timeout-minutes: 5 - 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@37ebaef184d7626c5f204ab8d3baff4262dd30f0 # v1.27.0 - with: - payload: ${{ needs.prepare.outputs.payload }} - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }} - - # Posts notifications when a workflow is successful. - success: - name: Success notifications - runs-on: ubuntu-latest - continue-on-error: true - timeout-minutes: 5 - needs: [ prepare ] - if: ${{ inputs.calling_status == 'success' && success() }} - - steps: - - name: Post success notifications to Slack - uses: slackapi/slack-github-action@37ebaef184d7626c5f204ab8d3baff4262dd30f0 # v1.27.0 - with: - payload: ${{ needs.prepare.outputs.payload }} - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }} - - # Posts notifications when a workflow is cancelled. - cancelled: - name: Cancelled notifications - runs-on: ubuntu-latest - continue-on-error: true - timeout-minutes: 5 - needs: [ prepare ] - if: ${{ inputs.calling_status == 'cancelled' || cancelled() }} - - steps: - - name: Post cancelled notifications to Slack - uses: slackapi/slack-github-action@37ebaef184d7626c5f204ab8d3baff4262dd30f0 # v1.27.0 - with: - payload: ${{ needs.prepare.outputs.payload }} - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }} 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 96379495c7fe1..0000000000000 --- a/.github/workflows/test-and-zip-default-themes.yml +++ /dev/null @@ -1,246 +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. - - '.nvm' - # 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/**' - # 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. - - '.nvm' - # 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/**' - # 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-latest - 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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - ref: ${{ github.event_name == 'workflow_dispatch' && inputs.branch || github.ref }} - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Check for zero-byte (empty) files - run: | - [[ ! $(find src/wp-content/themes/${{ matrix.theme }} -empty) ]] - - # Tests the build script for themes that have one. - # - # Performs the following steps: - # - 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-latest - permissions: - contents: read - timeout-minutes: 10 - if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} - strategy: - fail-fast: false - matrix: - theme: [ - 'twentytwentyone', - 'twentytwenty', - 'twentynineteen', - ] - - defaults: - run: - working-directory: src/wp-content/themes/${{ matrix.theme }} - - steps: - - name: Checkout repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - ref: ${{ github.event_name == 'workflow_dispatch' && inputs.branch || github.ref }} - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Set up Node.js - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 - 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: 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-latest - permissions: - contents: read - needs: [ check-for-empty-files, test-build-scripts ] - timeout-minutes: 10 - if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} - strategy: - fail-fast: false - matrix: - theme: [ - 'twentytwentyfive', - 'twentytwentyfour', - 'twentytwentythree', - 'twentytwentytwo', - 'twentytwentyone', - 'twentytwenty', - 'twentynineteen', - 'twentyseventeen', - 'twentysixteen', - 'twentyfifteen', - 'twentyfourteen', - 'twentythirteen', - 'twentytwelve', - 'twentyeleven', - 'twentyten' - ] - - steps: - - name: Checkout repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - ref: ${{ github.event_name == 'workflow_dispatch' && inputs.branch || github.ref }} - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Upload theme ZIP as an artifact - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 - with: - name: ${{ matrix.theme }} - path: src/wp-content/themes/${{ matrix.theme }} - if-no-files-found: error - include-hidden-files: true - - slack-notifications: - name: Slack Notifications - uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk - 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-latest - 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@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 - with: - retries: 2 - retry-exempt-status-codes: 418 - script: | - github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: 'failed-workflow.yml', - ref: 'trunk', - inputs: { - run_id: '${{ github.run_id }}' - } - }); diff --git a/.github/workflows/test-coverage.yml b/.github/workflows/test-coverage.yml deleted file mode 100644 index f6c68ff0afead..0000000000000 --- a/.github/workflows/test-coverage.yml +++ /dev/null @@ -1,240 +0,0 @@ -name: Code Coverage Report - -on: - # Verify - push: - branches: - - trunk - paths: - - '.github/workflows/test-coverage.yml' - - 'docker-compose.yml' - - 'phpunit.xml.dist' - - 'tests/phpunit/multisite.xml' - pull_request: - branches: - - trunk - paths: - - '.github/workflows/test-coverage.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: - -# 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: - # 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 as a single site. - # - Ensures version-controlled files are not modified or deleted. - # - Upload the single site code coverage report to Codecov.io. - # - Run the PHPUnit tests as a multisite installation. - # - Ensures version-controlled files are not modified or deleted. - # - Upload the multisite code coverage report to Codecov.io. - test-coverage-report: - name: ${{ matrix.multisite && 'Multisite' || 'Single site' }} report (${{ matrix.format }}) - runs-on: ubuntu-latest - permissions: - contents: read - timeout-minutes: 120 - if: ${{ github.repository == 'WordPress/wordpress-develop' }} - strategy: - fail-fast: false - matrix: - multisite: [ false, true ] - format: [ clover, html ] - - 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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Set up Node.js - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 - 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@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1 - with: - php-version: '7.4' - 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@57532f8be5bda426838819c5ee9afb8af389d51a # v3.0.0 - with: - custom-cache-suffix: $(/bin/date -u --date='last Mon' "+%F") - - - name: Install npm Dependencies - run: npm ci - - - name: Log debug information - run: | - echo "$GITHUB_REF" - echo "$GITHUB_EVENT_NAME" - 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 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 tests as a single site - if: ${{ ! matrix.multisite }} - run: npm run test:php -- --verbose -c phpunit.xml.dist --coverage-${{ 'html' == matrix.format && 'html' || 'clover' }} wp-code-coverage-single-${{ github.sha }}${{ 'clover' == matrix.format && '.xml' || '' }} - - - name: Ensure version-controlled files are not modified during the tests - run: git diff --exit-code - - - name: Upload single site report to Codecov - if: ${{ ! matrix.multisite && matrix.format == 'clover' && github.event_name != 'pull_request' }} - uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: wp-code-coverage-single-${{ github.sha }}${{ 'clover' == matrix.format && '.xml' || '' }} - flags: single,php - fail_ci_if_error: true - - - name: Upload single site HTML report as artifact - if: ${{ ! matrix.multisite && matrix.format == 'html' }} - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 - with: - name: wp-code-coverage-single-${{ github.sha }} - path: wp-code-coverage-single-${{ github.sha }} - overwrite: true - - - name: Run tests as a multisite install - if: ${{ matrix.multisite }} - run: npm run test:php -- --verbose -c tests/phpunit/multisite.xml --coverage-${{ 'html' == matrix.format && 'html' || 'clover' }} wp-code-coverage-multisite-${{ github.sha }}${{ 'clover' == matrix.format && '.xml' || '' }} - - - name: Ensure version-controlled files are not modified during the tests - run: git diff --exit-code - - - name: Upload multisite report to Codecov - if: ${{ matrix.multisite && matrix.format == 'clover' && github.event_name != 'pull_request' }} - uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: wp-code-coverage-multisite-${{ github.sha }}${{ 'clover' == matrix.format && '.xml' || '' }} - flags: multisite,php - fail_ci_if_error: true - - - name: Upload multisite HTML report as artifact - if: ${{ matrix.multisite && matrix.format == 'html' }} - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 - with: - name: wp-code-coverage-multisite-${{ github.sha }} - path: wp-code-coverage-multisite-${{ github.sha }} - overwrite: true - - slack-notifications: - name: Slack Notifications - uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk - 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-latest - 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@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 - with: - retries: 2 - retry-exempt-status-codes: 418 - script: | - github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: 'failed-workflow.yml', - ref: 'trunk', - inputs: { - run_id: '${{ github.run_id }}' - } - }); diff --git a/.github/workflows/test-old-branches.yml b/.github/workflows/test-old-branches.yml deleted file mode 100644 index d6a9b94c3d6de..0000000000000 --- a/.github/workflows/test-old-branches.yml +++ /dev/null @@ -1,134 +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 * *' - -# Disable permissions for all available scopes by default. -# Any needed permissions should be configured at the job level. -permissions: {} - -env: - CURRENTLY_SUPPORTED_BRANCH: '6.6' - -jobs: - dispatch-workflows-for-old-branches: - name: ${{ matrix.workflow }} for ${{ matrix.branch }} - runs-on: ubuntu-latest - 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.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', '4.6', '4.5', '4.4', '4.3', '4.2', '4.1' - ] - include: - # PHP Compatibility testing was introduced in 5.5. - - 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.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.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@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 - if: ${{ github.event_name == 'push' || 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: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk - 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 }} From a178b14680270aec10f29c50f1c2c7a0b273e938 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Mon, 6 Oct 2025 17:55:25 +0100 Subject: [PATCH 2/2] Trim the unit testing matrix. --- .github/workflows/phpunit-tests.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/phpunit-tests.yml b/.github/workflows/phpunit-tests.yml index 73583c85ca269..6d4bcb457a4b3 100644 --- a/.github/workflows/phpunit-tests.yml +++ b/.github/workflows/phpunit-tests.yml @@ -45,7 +45,8 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest ] - php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ] + # Test highest and lowest supported version of each major. + php: [ '7.2', '7.4', '8.0', '8.4' ] db-type: [ 'mysql' ] db-version: [ '5.7', '8.0', '8.4' ] tests-domain: [ 'example.org' ] @@ -116,7 +117,8 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest ] - php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ] + # Test highest and lowest supported version of each major. + php: [ '7.2', '7.4', '8.0', '8.4' ] db-type: [ 'mariadb' ] db-version: [ '10.4', '10.6', '10.11', '11.2' ] multisite: [ false, true ]