Make WordPress Core


Ignore:
Timestamp:
08/31/2026 05:29:41 PM (3 weeks ago)
Author:
lancewillett
Message:

Build/Test Tools: Flag slow PHPUnit tests in GitHub Actions.

The canonical PHP 8.5 reporting job now emits warning annotations and a run-summary table for tests that exceed one second. The advisory step runs after successful or failed test runs and skips cancelled jobs.

The annotation pass reuses the streaming JUnit parser introduced in [63410] and passes its six aggregate metrics to CodeVitals through a temporary file. This keeps the workflow to one traversal of the report.

Developed in: https://github.com/WordPress/wordpress-develop/pull/13212

Props adrianmoldovanwp.
See #65887.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/.github/workflows/reusable-phpunit-tests-v3.yml

    r63410 r63412  
    127127  # - Install WordPress within the Docker container.
    128128  # - Run the PHPUnit tests.
     129  # - Flags slow PHPUnit tests with GitHub Actions annotations and a run summary.
    129130  # - Publish PHPUnit timing metrics to CodeVitals.
    130131  # - Upload the code coverage report to Codecov.io.
     
    274275          MULTISITE_FLAG: ${{ inputs.multisite && 'multisite' || 'single' }}
    275276
     277      - name: Flag slow PHPUnit tests
     278        # Runs when the test step succeeds or fails, but skips cancelled jobs.
     279        # This step never fails the job itself (continue-on-error), because the
     280        # slow-test signal is advisory only.
     281        if: >-
     282          ${{
     283            ! cancelled() && inputs.report && inputs.php == '8.5' &&
     284            ( github.event_name == 'pull_request' ||
     285              ( github.event_name == 'push' && github.ref == 'refs/heads/trunk' ) )
     286          }}
     287        continue-on-error: true
     288        run: |
     289          if [ -f tests/phpunit/build/logs/junit.xml ]; then
     290            php tests/phpunit/prepare-slow-test-annotations.php \
     291              tests/phpunit/build/logs/junit.xml \
     292              1.0 \
     293              20 \
     294              "$RUNNER_TEMP/phpunit-timing-metrics.json"
     295          else
     296            echo 'PHPUnit JUnit report not found; skipping slow-test annotations.'
     297          fi
     298
    276299      - name: Publish PHPUnit timing metrics
    277300        continue-on-error: true
     
    296319              "$GITHUB_SHA" \
    297320              "$COMMITTED_AT" \
     321              "$RUNNER_TEMP/phpunit-timing-metrics.json" \
    298322              | curl --fail-with-body --silent --show-error \
    299323                --request POST \
Note: See TracChangeset for help on using the changeset viewer.