Make WordPress Core


Ignore:
Timestamp:
05/04/2022 12:38:18 AM (3 years ago)
Author:
SergeyBiryukov
Message:

Build/Test Tools: Pass GitHub Actions environment variables to the Docker container.

This ensures that WP_UnitTestCase::skipOnAutomatedBranches() has access to the GITHUB_REF and GITHUB_EVENT_NAME variables, so that some tests can be skipped when appropriate.

Additionally, account for renaming the master branch to trunk in November 2021.

Follow-up to [40241], [46999], [49264], [49267], [51868].

Fixes #55668.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/abstract-testcase.php

    r51999 r53349  
    203203     * Allows tests to be skipped on some automated runs.
    204204     *
    205      * For test runs on GitHub Actions for something other than trunk/master,
    206      * we want to skip tests that only need to run for master.
     205     * For test runs on GitHub Actions for something other than trunk,
     206     * we want to skip tests that only need to run for trunk.
    207207     */
    208208    public function skipOnAutomatedBranches() {
     
    211211        $github_ref        = getenv( 'GITHUB_REF' );
    212212
    213         if ( $github_event_name && 'false' !== $github_event_name ) {
     213        if ( $github_event_name ) {
    214214            // We're on GitHub Actions.
    215215            $skipped = array( 'pull_request', 'pull_request_target' );
    216216
    217             if ( in_array( $github_event_name, $skipped, true ) || 'refs/heads/master' !== $github_ref ) {
    218                 $this->markTestSkipped( 'For automated test runs, this test is only run on trunk/master' );
     217            if ( in_array( $github_event_name, $skipped, true ) || 'refs/heads/trunk' !== $github_ref ) {
     218                $this->markTestSkipped( 'For automated test runs, this test is only run on trunk' );
    219219            }
    220220        }
Note: See TracChangeset for help on using the changeset viewer.