Try: Build once for PHP Unit.#12649
Conversation
| persist-credentials: false | ||
|
|
||
| - name: Set up Node.js | ||
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 |
There was a problem hiding this comment.
Pull request overview
This PR updates the PHPUnit GitHub Actions workflow to build WordPress once, upload the build as an artifact, and let the matrix test jobs reuse that artifact to avoid repeated builds.
Changes:
- Adds a dedicated
build-wordpressjob that builds and uploads awordpress-buildartifact. - Extends the reusable PHPUnit workflow with an input to optionally download/unzip the build artifact.
- Wires the PHPUnit matrix jobs to depend on the build job and (in most cases) enable artifact reuse.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| .github/workflows/reusable-phpunit-tests-v3.yml | Adds an input and conditional logic to download/unzip a prebuilt WordPress artifact instead of rebuilding. |
| .github/workflows/phpunit-tests.yml | Adds a build job that uploads a build artifact and updates test jobs to depend on it and enable reuse. |
Comments suppressed due to low confidence (2)
.github/workflows/reusable-phpunit-tests-v3.yml:159
- Skipping
Set up PHPwhen the build artifact is available breaks the subsequent Composer install (and can leavevendor/bin/phpunitmissing for the test runs). The build artifact only addresses built JS/CSS; the PHP/Composer toolchain is still required per test job.
- name: Set up PHP
if: ${{ ! inputs.wordpress-build-artifact-available }}
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
.github/workflows/reusable-phpunit-tests-v3.yml:168
- With
wordpress-build-artifact-availableenabled, this skips installing Composer dependencies, but the test commands invoke./vendor/bin/phpunit. Unlessvendor/is guaranteed to be present in the workspace, this will fail.
# Since Composer dependencies are installed using `composer update` and no lock file is in version control,
# passing a custom cache suffix ensures that the cache is flushed at least once per week.
- name: Install Composer dependencies
if: ${{ ! inputs.wordpress-build-artifact-available }}
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: Checkout repository | ||
| if: ${{ ! inputs.wordpress-build-artifact-available }} | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| - name: Create ZIP of built files | ||
| run: zip -q -r wordpress-build.zip . -x '.git/*' 'wordpress-build.zip' | ||
|
|
| uses: ./.github/workflows/reusable-phpunit-tests-v3.yml | ||
| needs: [ build-wordpress ] | ||
| permissions: | ||
| contents: read |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (4)
.github/workflows/reusable-phpunit-tests-v3.yml:156
- When
inputs.wordpress-build-artifact-availableis true, this step is skipped, but later steps still run PHPUnit via./vendor/bin/phpunit(see theRun PHPUnit testsstep). Sincevendor/is not in the repo by default, skipping PHP setup will prevent Composer dependencies from being installed correctly for the job.
This issue also appears on line 160 of the same file.
- name: Set up PHP
if: ${{ ! inputs.wordpress-build-artifact-available }}
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
php-version: '${{ inputs.php }}'
coverage: none
.github/workflows/reusable-phpunit-tests-v3.yml:164
vendor/bin/phpunitis invoked later in this workflow, but Composer dependencies are not installed whenwordpress-build-artifact-availableis true. The build artifact created inphpunit-tests.ymlonly runsnpm ci/build and does not generatevendor/, so the test job will fail without running this step.
- name: Install Composer dependencies
if: ${{ ! inputs.wordpress-build-artifact-available }}
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
with:
custom-cache-suffix: $(/bin/date -u --date='last Mon' "+%F")
.github/workflows/phpunit-tests.yml:186
- This job now depends on
build-wordpress, but it never enables the new artifact path (wordpress-build-artifact-available: true). As a result it will still do its own checkout/npm install/build inside the reusable workflow (duplicating work) while also waiting for the separate build job to complete.
test-with-mariadb:
name: PHP ${{ matrix.php }}
uses: ./.github/workflows/reusable-phpunit-tests-v3.yml
needs: [ build-wordpress ]
permissions:
contents: read
.github/workflows/phpunit-tests.yml:85
- The artifact zip is created from the entire working directory after
npm ci, which will includenode_modules/and any other build-time artifacts. With the large PHPUnit matrix, every downstream job will download this ZIP, which can significantly increase workflow time and artifact storage/transfer. Consider limiting the artifact contents to only what downstream jobs need (e.g., built assets) and letting each job restore/install dependencies via cache, or otherwise pruning large directories before zipping.
- name: Create ZIP of built files
run: zip -q -r wordpress-build.zip . -x '.git/*' 'wordpress-build.zip'
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (4)
.github/workflows/phpunit-tests.yml:173
wordpress-build-artifact-availableis passed into the reusable workflow, butreusable-phpunit-tests-v4.ymldoes not declare this as aworkflow_callinput. This will cause the calling job to fail workflow validation with an "Unexpected input" error.
This issue also appears in the following locations of the same file:
- line 272
- line 304
- line 366
memcached: ${{ matrix.memcached }}
phpunit-config: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }}
tests-domain: ${{ matrix.tests-domain }}
report: ${{ matrix.report || false }}
.github/workflows/phpunit-tests.yml:274
wordpress-build-artifact-availableis passed into the reusable workflow, butreusable-phpunit-tests-v4.ymldoes not declare this as aworkflow_callinput. This will cause the calling job to fail workflow validation with an "Unexpected input" error.
report: false
#
.github/workflows/phpunit-tests.yml:308
wordpress-build-artifact-availableis passed into the reusable workflow, butreusable-phpunit-tests-v4.ymldoes not declare this as aworkflow_callinput. This will cause the calling job to fail workflow validation with an "Unexpected input" error.
db-version: ${{ matrix.db-version }}
phpunit-test-groups: ${{ matrix.phpunit-test-groups }}
#
# Runs unit tests for forks.
.github/workflows/phpunit-tests.yml:370
wordpress-build-artifact-availableis passed into the reusable workflow, butreusable-phpunit-tests-v4.ymldoes not declare this as aworkflow_callinput. This will cause the calling job to fail workflow validation with an "Unexpected input" error.
phpunit-test-groups: ${{ matrix.phpunit-test-groups || '' }}
slack-notifications:
name: Slack Notifications
uses: ./.github/workflows/slack-notifications.yml
| - name: Set up Node.js | ||
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | ||
| with: | ||
| node-version-file: '.nvmrc' | ||
| cache: npm | ||
|
|
| # Performs the following steps: | ||
| # - Sets environment variables. | ||
| # - Checks out the repository. | ||
| # - Sets up Node.js. | ||
| # - Sets up PHP. | ||
| # - Installs Composer dependencies. | ||
| # - Installs npm dependencies | ||
| # - Logs general debug information about the runner. | ||
| # - Logs Docker debug information (about the Docker installation within the runner). | ||
| # - Starts the WordPress Docker container. | ||
| # - Logs the running Docker containers. | ||
| # - Logs debug information about what's installed within the WordPress Docker containers. | ||
| # - Install WordPress within the Docker container. | ||
| # - Run the PHPUnit tests. | ||
| # - Upload the code coverage report to Codecov.io. | ||
| # - 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. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (2)
.github/workflows/reusable-phpunit-tests-v4.yml:154
- This workflow no longer installs Composer dependencies, but it still runs PHPUnit from ./vendor/bin/phpunit. Since vendor/ is not in the repository, the test commands will fail with "No such file or directory" unless Composer dependencies are installed in this job (as was done in reusable-phpunit-tests-v3.yml).
- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version-file: '.nvmrc'
cache: npm
- name: General debug information
run: |
npm --version
node --version
curl --version
git --version
composer --version
locale -a
.github/workflows/reusable-phpunit-tests-v4.yml:105
- The "Performs the following steps" list is now out of sync with what the workflow actually does (it no longer checks out the repo, builds WordPress, installs npm deps, or runs a git diff check). Updating this comment block will make the workflow easier to maintain.
# Performs the following steps:
# - Sets environment variables.
# - Checks out the repository.
# - Sets up Node.js.
# - Sets up PHP.
| build-wordpress: | ||
| name: Build WordPress | ||
| runs-on: ubuntu-24.04 | ||
| permissions: | ||
| contents: read | ||
| timeout-minutes: 20 | ||
|
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (2)
.github/workflows/phpunit-tests.yml:88
- The build artifact is created by zipping the entire repository root (".") after
npm ci, which will include ignored directories likenode_modules/(see .gitignore:20) and significantly increase artifact size and download/unzip time for every matrix job. It also makes the artifact (and thus the test jobs) implicitly OS/arch-specific.
- name: Create ZIP of built files
run: zip -q -r wordpress-build.zip . -x '.git/*' 'wordpress-build.zip'
.github/workflows/reusable-phpunit-tests-v4.yml:255
- The header comment lists “Ensures version-controlled files are not modified or deleted”, but the workflow no longer performs that check (it existed in v3). Reintroducing the
git diff --exit-codeguard helps catch unexpected file changes during env setup/tests.
- name: Upload test coverage report to Codecov
if: ${{ inputs.coverage-report }}
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: wp-code-coverage${{ inputs.multisite && '-multisite' || '-single' }}-${{ github.sha }}.xml
flags: ${{ inputs.multisite && 'multisite' || 'single' }},php
fail_ci_if_error: true
| - name: Set up Node.js | ||
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | ||
| with: | ||
| node-version-file: '.nvmrc' | ||
| cache: npm | ||
|
|
| - name: Sparse checkout repository metadata | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| with: | ||
| fetch-depth: 1 | ||
| show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} | ||
| persist-credentials: false | ||
| sparse-checkout: | | ||
| .github | ||
|
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (4)
.github/workflows/reusable-phpunit-tests-v4.yml:118
- The job header comment lists steps (PHP setup, Composer install, npm ci, build, and a post-test git diff) that are no longer performed in this workflow. This makes the workflow misleading to maintainers and reviewers.
# Performs the following steps:
# - Sets environment variables.
# - Checks out the repository.
# - Sets up Node.js.
# - Sets up PHP.
# - Installs Composer dependencies.
# - Installs npm dependencies
# - Logs general debug information about the runner.
# - Logs Docker debug information (about the Docker installation within the runner).
# - Starts the WordPress Docker container.
# - Logs the running Docker containers.
# - Logs debug information about what's installed within the WordPress Docker containers.
# - Install WordPress within the Docker container.
# - Run the PHPUnit tests.
# - Upload the code coverage report to Codecov.io.
# - 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.
.github/workflows/reusable-phpunit-tests-v4.yml:136
- The sparse checkout into "repo-metadata" is currently unused (no later step references that path), and it also means the workspace doesn’t have a .git directory. That prevents restoring the post-test "git diff --exit-code" guard that exists in reusable-phpunit-tests-v3.yml:271, and it makes it harder to debug CI failures locally. Consider doing a normal checkout into the workspace root, and unzip with overwrite enabled.
- name: Sparse checkout repository metadata
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
path: 'repo-metadata'
fetch-depth: 1
.github/workflows/reusable-phpunit-tests-v4.yml:257
- reusable-phpunit-tests-v3.yml includes a post-test "git diff --exit-code" check (v3:271) to ensure tests/build steps don’t modify tracked files. This workflow drops that guard. If you switch back to a normal checkout (so .git exists), you can restore the check just before bringing in the external test-runner repo.
- name: Checkout the WordPress Test Reporter
.github/workflows/phpunit-tests.yml:88
- The ZIP artifact is created from the entire workspace ("zip -r ... ."), which will also include large, generated directories like node_modules/ from the build step. Because every matrix job downloads/unzips this artifact, this can significantly increase CI time and bandwidth and risks hitting artifact size limits.
- name: Create ZIP of built files
run: zip -q -r wordpress-build.zip . -x '.git/*' 'wordpress-build.zip'
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (3)
.github/workflows/reusable-phpunit-tests-v4.yml:105
- The step list in this header comment is now inaccurate: the workflow no longer checks out the full repository or sets up PHP / installs Composer + npm dependencies (it downloads and unzips a prebuilt artifact instead). Please update the comment to match the actual steps so future changes don’t rely on stale guidance.
# Performs the following steps:
# - Sets environment variables.
# - Checks out the repository.
# - Sets up Node.js.
# - Sets up PHP.
.github/workflows/reusable-phpunit-tests-v4.yml:136
- The “Sparse checkout repository metadata” step checks out
.githubintorepo-metadata/, but nothing in this workflow referencesrepo-metadataafterward. This adds time and complexity without affecting the job outcome.
- name: Sparse checkout repository metadata
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
path: 'repo-metadata'
fetch-depth: 1
.github/workflows/phpunit-tests.yml:87
zip -r wordpress-build.zip .will include everything in the workspace afternpm ciandnpm run build:dev, includingnode_modules/(and any other build byproducts). That will likely create a very large artifact that must be downloaded/unzipped by every matrix job, which can negate the benefit of “build once” and may hit artifact size/time limits.
- name: Create ZIP of built files
run: zip -q -r wordpress-build.zip . -x '.git/*' 'wordpress-build.zip'
| - name: Upload test coverage report to Codecov | ||
| if: ${{ inputs.coverage-report }} | ||
| uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 | ||
| with: | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||
| files: wp-code-coverage${{ inputs.multisite && '-multisite' || '-single' }}-${{ github.sha }}.xml | ||
| flags: ${{ inputs.multisite && 'multisite' || 'single' }},php | ||
| fail_ci_if_error: true | ||
|
|
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (6)
tests/phpunit/tests/peter-is-testing-this-pr.php:21
- This test will fail when the PHPUnit suite is run outside GitHub Actions (e.g., locally or on other CI) because it hard-requires GITHUB_* env vars. To keep the core test suite portable, skip these assertions when not running in GitHub Actions.
public function test_github_environment_variable_defined( $variable, $expected_value = null ) {
$variable_value = getenv( $variable );
$this->assertNotFalse( $variable_value, "Environment variable $variable is not defined." );
if ( $expected_value !== null ) {
$this->assertSame( $expected_value, $variable_value, "Environment variable $variable does not have the expected value." );
}
tests/phpunit/tests/peter-is-testing-this-pr.php:46
- Several variables asserted here are only set for specific event types (e.g., GITHUB_HEAD_REF/GITHUB_BASE_REF are only present for pull_request), and expecting GITHUB_EVENT_NAME to always be "pull_request" will break push/schedule runs of
.github/workflows/phpunit-tests.yml. Consider only asserting PR-specific variables when the event is actually a PR, and avoid hard-coding the event name.
public function data_github_environment_variable_defined() {
return array(
array( 'GITHUB_ACTIONS', 'true' ),
array( 'GITHUB_WORKFLOW' ),
array( 'GITHUB_RUN_ID' ),
array( 'GITHUB_RUN_NUMBER' ),
array( 'GITHUB_JOB' ),
array( 'GITHUB_ACTION' ),
array( 'GITHUB_ACTOR' ),
array( 'GITHUB_REPOSITORY' ),
array( 'GITHUB_EVENT_NAME', 'pull_request' ),
array( 'GITHUB_EVENT_PATH' ),
array( 'GITHUB_WORKSPACE' ),
array( 'GITHUB_SHA' ),
array( 'GITHUB_REF' ),
array( 'GITHUB_HEAD_REF' ),
array( 'GITHUB_BASE_REF' ),
);
.github/workflows/reusable-phpunit-tests-v4.yml:107
- The step list in this job comment no longer matches what the workflow actually does (it no longer checks out the full repo, sets up PHP on the runner, installs Composer deps, runs
npm ci, builds WordPress, or runsgit diff). Please update the comment so future edits/debugging aren’t based on incorrect documentation.
# Performs the following steps:
# - Sets environment variables.
# - Checks out the repository.
# - Sets up Node.js.
# - Sets up PHP.
# - Installs Composer dependencies.
# - Installs npm dependencies
.github/workflows/reusable-phpunit-tests-v4.yml:162
- This workflow invokes
php ./vendor/bin/phpunit, but it no longer installs Composer dependencies on the runner (and the new build job only runsnpm ci/npm run build:dev, sovendor/is unlikely to exist after unzipping the artifact). Re-introduce a Composer install step (or ensurevendor/is included in the artifact) so the PHPUnit binary is available.
- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version-file: '.nvmrc'
cache: npm
- name: General debug information
run: |
npm --version
node --version
curl --version
git --version
locale -a
.github/workflows/phpunit-tests.yml:88
zip -r wordpress-build.zip .will package the entire working directory afternpm ci, includingnode_modules/, which can make the artifact very large and slow to upload/download across every matrix job. Consider excludingnode_modules/and re-installing with the existing npm cache in each test job, or otherwise limiting the artifact contents to only what the reusable PHPUnit workflow needs.
- name: Create ZIP of built files
run: zip -q -r wordpress-build.zip . -x '.git/*' 'wordpress-build.zip'
.github/workflows/phpunit-tests.yml:63
build-wordpresscurrently runs unconditionally for any event that triggers the workflow. In forks, this means it can run onpushevents even though all downstream test jobs are skipped (theirif:only allows PRs for non-WordPress repos). Consider adding anif:to align the build job with the conditions under which test jobs will actually run.
build-wordpress:
name: Build WordPress
runs-on: ubuntu-24.04
permissions:
contents: read
timeout-minutes: 20
| /** | ||
| * Peter is testing this PR. | ||
| */ | ||
| class Tests_Peter_Is_Testing_This_PR extends WP_UnitTestCase { |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (3)
tests/phpunit/tests/peter-is-testing-this-pr.php:44
GITHUB_EVENT_NAMEis not alwayspull_request(this workflow also runs onpushandschedule), so this assertion will fail in CI for non-PR runs.
array( 'GITHUB_BASE_REF' ),
array( 'GITHUB_ENV' ),
array( 'GITHUB_EVENT_NAME', 'pull_request' ),
array( 'GITHUB_EVENT_PATH' ),
.github/workflows/reusable-phpunit-tests-v4.yml:105
- The step list in this header comment is now inaccurate (it mentions checking out the full repo, setting up PHP, and installing Composer/npm deps). In v4 the job downloads and unzips a pre-built artifact instead, so the comment should be updated to reflect the actual steps.
# Performs the following steps:
# - Sets environment variables.
# - Checks out the repository.
# - Sets up Node.js.
# - Sets up PHP.
.github/workflows/phpunit-tests.yml:87
zip -r wordpress-build.zip .will package the entire working directory, includingnode_modules/produced bynpm ci. With this workflow's large test matrix, repeatedly uploading/downloading a huge artifact can be slower and risks hitting artifact size/time limits. The repo already uses a narrower build artifact elsewhere (e.g..github/workflows/reusable-test-core-build-process.yml:125-128zips onlybuild/).
- name: Create ZIP of built files
run: zip -q -r wordpress-build.zip . -x '.git/*' 'wordpress-build.zip'
| public function test_github_environment_variable_defined( $variable, $expected_value = null ) { | ||
| $variable_value = getenv( $variable ); | ||
| $this->assertNotFalse( $variable_value, "Environment variable $variable is not defined." ); | ||
|
|
||
| if ( $expected_value !== null ) { | ||
| $this->assertSame( $expected_value, $variable_value, "Environment variable $variable does not have the expected value." ); | ||
| } | ||
| } |
| - name: Sparse checkout repository metadata | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| with: | ||
| path: 'repo-metadata' | ||
| fetch-depth: 1 | ||
| show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} | ||
| persist-credentials: false | ||
| sparse-checkout: | | ||
| .github | ||
|
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (3)
.github/workflows/reusable-phpunit-tests-v4.yml:108
- The step list in this job header is out of sync with what the workflow actually does (it no longer checks out the full repo, sets up PHP, installs npm deps, or builds). This makes the workflow harder to maintain because readers will assume those steps still exist.
# 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.
.github/workflows/phpunit-tests.yml:62
build-wordpresscurrently runs unconditionally, but all the downstream test jobs are gated to WordPress/* repos (and PRs). On forks/non-WordPress repos this will spend CI time building and uploading a large artifact even though no test jobs run. Consider applying the sameif:gate used by the matrix jobs.
build-wordpress:
name: Build WordPress
runs-on: ubuntu-24.04
permissions:
contents: read
timeout-minutes: 20
.github/workflows/phpunit-tests.yml:94
- Uploading a ~250MB artifact on every run can put noticeable pressure on org storage/retention. If the intent is strictly intra-run reuse, set a short artifact retention period to reduce storage footprint.
- name: Upload ZIP as a GitHub Actions artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: wordpress-build
path: wordpress-build.zip
if-no-files-found: error
| - name: Run GitHub Actions environment variable tests (do not include this in any merge) | ||
| if: ${{ ! inputs.phpunit-test-groups && ! inputs.coverage-report }} | ||
| continue-on-error: ${{ inputs.allow-errors }} | ||
| run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c "${PHPUNIT_CONFIG}" --group this-should-never-be-committed-to-trunk-but-some-of-it-might-be-helpful |
This is a POC to build WordPress once for use during the PHP Unit workflow.
Choosing a PR to trunk at random, the machine time for PHPUnit is dropping by about 3 hours. As trunk runs additional tests, this will save additional time there.
A space checkout is retained as that will set up the GHA environment variables needed for the unit test suite to determine if tests that target only trunk are, in fact, targetting trunk. It's also needed for the actions that report back to WP.org.
Questions:
Risks/issues:
Trac ticket:
Use of AI Tools
AI assistance: Yes
Tool(s): VS Code/GitHub Copilot
Model(s): GPT-5.3-Codex
Used for: Most of it as this is a POC.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.