WordPress / phpunit-test-runner

GNU General Public License v2.0
67 stars 64 forks source link

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

Open desrosj opened 3 years ago

desrosj commented 3 years ago

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.

getsource commented 3 years ago

Thanks for the report!

Using environment variables to work around this makes sense to me.