WordPress / WordPress/phpunit-test-runner

Allow commit message and revision to be passed through an environment variable

Open
#136 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement needs assignee tooling WCUS26
Dominant language
PHP
Stars
77
Forks
77
Avg merge
15d 15h
Merged PRs (30d)
4

Description

WordPress Core currently runs PHPUnit tests in two steps.

The first step checks out the WordPress repo, installs NPM, builds WP for use, and then zips everything to upload as an artifact on the workflow run. After that, individual jobs are created for various PHP/Memcached combinations to run the PHPUnit tests by downloading the previously built artifact. This prevents every job from needing to perform these steps.

However, the .git folder is not packaged and included in the artifact to save space (and it's no longer needed anyway).

When the test reporter submits results, it scans for .git and .svn directories to grab the commit message and revision number to associate the results with. In order for this to work successfully, the Git repo needs to be reconnected to the codebase (see Core revision 49786).

The GitHub Action runner provides this information through the github workflow context. In the case of a push trigger event, the context would be github.event.head_commit.message (see https://docs.github.com/en/free-pro-team@latest/developers/webhooks-and-events/webhook-events-and-payloads#push).

If the runner first checked for environment variables and fell back to searching for those directories as a second option, that information could be passed to the reporter without having to reestablish the directory as a Git repository.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the test reporter's existing .git and .svn lookup, then inspect the GitHub Actions workflow where github.event.head_commit.message is available. Done means the reporter can use environment-provided commit message and revision values while retaining directory scanning as a fallback.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, php
Domain
ci-cd, testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.