Make WordPress Core

Changeset 53351


Ignore:
Timestamp:
05/04/2022 11:43:28 AM (4 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].

Merges [53349] to the 5.9 branch.
Fixes #55668.

Location:
branches/5.9
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/5.9

  • branches/5.9/docker-compose.yml

    r51868 r53351  
    4242      - PHP_FPM_UID=${PHP_FPM_UID-1000}
    4343      - PHP_FPM_GID=${PHP_FPM_GID-1000}
     44      - GITHUB_REF=${GITHUB_REF-false}
     45      - GITHUB_EVENT_NAME=${GITHUB_EVENT_NAME-false}
    4446
    4547    volumes:
  • branches/5.9/tests/phpunit/includes/abstract-testcase.php

    r51999 r53351  
    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                }
  • branches/5.9/tests/phpunit/tests/basic.php

    r52010 r53351  
    99
    1010        public function test_license() {
    11                 // This test is designed to only run on trunk/master.
     11                // This test is designed to only run on trunk.
    1212                $this->skipOnAutomatedBranches();
    1313
     
    1919
    2020        public function test_security_md() {
    21                 // This test is designed to only run on trunk/master.
     21                // This test is designed to only run on trunk.
    2222                $this->skipOnAutomatedBranches();
    2323
  • branches/5.9/tests/phpunit/tests/external-http/basic.php

    r52424 r53351  
    1111         */
    1212        public function test_readme_php_version() {
    13                 // This test is designed to only run on trunk/master.
     13                // This test is designed to only run on trunk.
    1414                $this->skipOnAutomatedBranches();
    1515
     
    3232         */
    3333        public function test_readme_mysql_version() {
    34                 // This test is designed to only run on trunk/master.
     34                // This test is designed to only run on trunk.
    3535                $this->skipOnAutomatedBranches();
    3636
     
    6464         */
    6565        public function test_readme_mariadb_version() {
    66                 // This test is designed to only run on trunk/master.
     66                // This test is designed to only run on trunk.
    6767                $this->skipOnAutomatedBranches();
    6868
  • branches/5.9/tests/phpunit/tests/theme.php

    r52630 r53351  
    214214         */
    215215        public function test_year_in_readme() {
    216                 // This test is designed to only run on trunk/master.
     216                // This test is designed to only run on trunk.
    217217                $this->skipOnAutomatedBranches();
    218218
Note: See TracChangeset for help on using the changeset viewer.