Make WordPress Core

Changeset 49267


Ignore:
Timestamp:
10/21/2020 07:55:17 PM (4 years ago)
Author:
desrosj
Message:

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

This ensures that WP_UnitTestCase::skipOnAutomatedBranches() has access to these variables so that time sensitive tests can be skipped when appropriate.

This also updates that logic to be more clear.

Follow up to [49264].

Props ocean90, johnbillion.
See #50401, #49050, #47767.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/docker-compose.yml

    r47912 r49267  
    111111      TRAVIS_BRANCH: ${TRAVIS_BRANCH-false}
    112112      TRAVIS_PULL_REQUEST: ${TRAVIS_PULL_REQUEST-false}
     113      GITHUB_REF: ${GITHUB_REF-false}
     114      GITHUB_EVENT_NAME: ${GITHUB_EVENT_NAME-false}
    113115
    114116    volumes:
  • trunk/tests/phpunit/includes/abstract-testcase.php

    r49264 r49267  
    194194        $github_ref        = getenv( 'GITHUB_REF' );
    195195
    196         if ( ( ! $travis_branch || ! $travis_pull_request ) && ! $github_event_name ) {
    197             return;
    198         }
    199 
    200         if ( ( 'master' !== $travis_branch || 'false' !== $travis_pull_request ) && empty( $github_event_name ) ) {
    201             $this->markTestSkipped( 'For automated test runs, this test is only run on trunk/master' );
    202         } elseif ( in_array( $github_event_name, array( 'pull_request', 'pull_request_target' ), true ) || 'refs/heads/master' !== $github_ref ) {
    203             $this->markTestSkipped( 'For automated test runs, this test is only run on trunk/master' );
     196        if ( 'false' !== $github_event_name ) {
     197            // We're on GitHub Actions.
     198            $skipped = array( 'pull_request', 'pull_request_target' );
     199
     200            if ( in_array( $github_event_name, $skipped, true ) || 'refs/heads/master' !== $github_ref ) {
     201                $this->markTestSkipped( 'For automated test runs, this test is only run on trunk/master - GitHub only' );
     202            }
     203        } elseif ( 'false' !== $travis_branch ) {
     204            // We're on Travis CI.
     205            if ( 'master' !== $travis_branch || 'false' !== $travis_pull_request ) {
     206                $this->markTestSkipped( 'For automated test runs, this test is only run on trunk/master - Travis only' );
     207            }
    204208        }
    205209    }
Note: See TracChangeset for help on using the changeset viewer.