Make WordPress Core


Ignore:
Timestamp:
06/03/2024 05:36:35 PM (4 months ago)
Author:
desrosj
Message:

Build/Test Tools: Include files missed in [58301].

Unprops desrosj.
See #61340, #60822, #61216, #60901, #61101, #59416, #59805, #61213.

Location:
branches/6.2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.2

  • branches/6.2/.github/workflows/phpunit-tests.yml

    r55487 r58302  
    2727  cancel-in-progress: true
    2828
    29 env:
    30   PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
    31   LOCAL_PHP_MEMCACHED: ${{ false }}
    32   SLOW_TESTS: 'external-http,media,restapi'
     29# Disable permissions for all available scopes by default.
     30# Any needed permissions should be configured at the job level.
     31permissions: {}
     32
    3333
    3434jobs:
    35   # Runs the PHPUnit tests for WordPress.
    3635  #
    37   # Performs the following steps:
    38   # - Sets environment variables.
    39   # - Checks out the repository.
    40   # - Sets up Node.js.
    41   # - Sets up PHP.
    42   # - Installs Composer dependencies.
    43   # - Installs npm dependencies
    44   # - Logs general debug information about the runner.
    45   # - Logs Docker debug information (about the Docker installation within the runner).
    46   # - Starts the WordPress Docker container.
    47   # - Logs the running Docker containers.
    48   # - Logs debug information about what's installed within the WordPress Docker containers.
    49   # - Install WordPress within the Docker container.
    50   # - Run the PHPUnit tests.
    51   # - Ensures version-controlled files are not modified or deleted.
    52   # - Checks out the WordPress Test reporter repository.
    53   # - Submit the test results to the WordPress.org host test results.
     36  # Creates a PHPUnit test job for each PHP/MySQL combination.
     37  #
    5438  test-php:
    55     name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
    56     runs-on: ${{ matrix.os }}
    57     timeout-minutes: 20
     39    name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
     40    uses: WordPress/wordpress-develop/.github/workflows/reusable-phpunit-tests.yml@trunk
     41    permissions:
     42      contents: read
     43    secrets: inherit
    5844    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    5945    strategy:
    6046      fail-fast: false
    6147      matrix:
     48        os: [ ubuntu-latest ]
    6249        php: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ]
    63         os: [ ubuntu-latest ]
     50        db-type: [ 'mysql' ]
     51        db-version: [ '5.7' ]
     52        multisite: [ false, true ]
    6453        memcached: [ false ]
    65         split_slow: [ false ]
    66         multisite: [ false, true ]
     54
    6755        include:
    68           # Additional "slow" jobs for PHP 5.6.
    69           - php: '5.6'
    70             os: ubuntu-latest
     56          # Include jobs for PHP 7.4 with memcached.
     57          - os: ubuntu-latest
     58            php: '7.4'
     59            db-type: 'mysql'
     60            db-version: '5.7'
     61            multisite: false
     62            memcached: true
     63          - os: ubuntu-latest
     64            php: '7.4'
     65            db-type: 'mysql'
     66            db-version: '5.7'
     67            multisite: true
     68            memcached: true
     69          # Report the results of the PHP 7.4 without memcached job.
     70          - os: ubuntu-latest
     71            php: '7.4'
     72            db-type: 'mysql'
     73            db-version: '5.7'
     74            multisite: false
    7175            memcached: false
    72             multisite: false
    73             split_slow: true
    74           - php: '5.6'
    75             os: ubuntu-latest
    76             memcached: false
    77             multisite: true
    78             split_slow: true
    79           # Include jobs for PHP 7.4 with memcached.
    80           - php: '7.4'
    81             os: ubuntu-latest
    82             memcached: true
    83             multisite: false
    84           - php: '7.4'
    85             os: ubuntu-latest
    86             memcached: true
    87             multisite: true
    88           # Report the results of the PHP 7.4 without memcached job.
    89           - php: '7.4'
    90             os: ubuntu-latest
    91             memcached: false
    92             multisite: false
    9376            report: true
    94 
    95     env:
    96       LOCAL_PHP: ${{ matrix.php }}-fpm
    97       LOCAL_PHP_MEMCACHED: ${{ matrix.memcached }}
    98       PHPUNIT_CONFIG: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }}
    99 
    100     steps:
    101       - name: Configure environment variables
    102         run: |
    103           echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV
    104           echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV
    105 
    106       - name: Checkout repository
    107         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    108 
    109       - name: Set up Node.js
    110         uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
    111         with:
    112           node-version-file: '.nvmrc'
    113           cache: npm
    114 
    115       ##
    116       # This allows Composer dependencies to be installed using a single step.
    117       #
    118       # Since the tests are currently run within the Docker containers where the PHP version varies,
    119       # the same PHP version needs to be configured for the action runner machine so that the correct
    120       # dependency versions are installed and cached.
    121       ##
    122       - name: Set up PHP
    123         uses: shivammathur/setup-php@d30ad8b1843ace22e6698ab99bbafaa747b6bd0d # v2.24.0
    124         with:
    125           php-version: '${{ matrix.php }}'
    126           coverage: none
    127 
    128       # Since Composer dependencies are installed using `composer update` and no lock file is in version control,
    129       # passing a custom cache suffix ensures that the cache is flushed at least once per week.
    130       - name: Install Composer dependencies
    131         uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
    132         with:
    133           custom-cache-suffix: $(/bin/date -u --date='last Mon' "+%F")
    134 
    135       - name: Install npm dependencies
    136         run: npm ci
    137 
    138       - name: General debug information
    139         run: |
    140           npm --version
    141           node --version
    142           curl --version
    143           git --version
    144           svn --version
    145           composer --version
    146           locale -a
    147 
    148       - name: Docker debug information
    149         run: |
    150           docker -v
    151           docker-compose -v
    152 
    153       - name: Start Docker environment
    154         run: |
    155           npm run env:start
    156 
    157       - name: Log running Docker containers
    158         run: docker ps -a
    159 
    160       - name: WordPress Docker container debug information
    161         run: |
    162           docker-compose run --rm mysql mysql --version
    163           docker-compose run --rm php php --version
    164           docker-compose run --rm php php -m
    165           docker-compose run --rm php php -i
    166           docker-compose run --rm php locale -a
    167 
    168       - name: Install WordPress
    169         run: npm run env:install
    170 
    171       - name: Run slow PHPUnit tests
    172         if: ${{ matrix.split_slow }}
    173         run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }}
    174 
    175       - name: Run PHPUnit tests for single site excluding slow tests
    176         if: ${{ matrix.php < '7.0' && ! matrix.split_slow && ! matrix.multisite }}
    177         run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-required
    178 
    179       - name: Run PHPUnit tests for Multisite excluding slow tests
    180         if: ${{ matrix.php < '7.0' && ! matrix.split_slow && matrix.multisite }}
    181         run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-excluded,oembed-headers
    182 
    183       - name: Run PHPUnit tests
    184         if: ${{ matrix.php >= '7.0' }}
    185         run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }}
    186 
    187       - name: Run AJAX tests
    188         if: ${{ ! matrix.split_slow }}
    189         run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax
    190 
    191       - name: Run ms-files tests as a multisite install
    192         if: ${{ matrix.multisite && ! matrix.split_slow }}
    193         run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c tests/phpunit/multisite.xml --group ms-files
    194 
    195       - name: Run external HTTP tests
    196         if: ${{ ! matrix.multisite && ! matrix.split_slow }}
    197         run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c phpunit.xml.dist --group external-http
    198 
    199       # __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
    200       - name: Run (Xdebug) tests
    201         if: ${{ ! matrix.split_slow }}
    202         run: LOCAL_PHP_XDEBUG=true node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit -v --group xdebug --exclude-group __fakegroup__
    203 
    204       - name: Ensure version-controlled files are not modified or deleted
    205         run: git diff --exit-code
    206 
    207       - name: Checkout the WordPress Test Reporter
    208         if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }}
    209         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    210         with:
    211           repository: 'WordPress/phpunit-test-runner'
    212           path: 'test-runner'
    213 
    214       - name: Submit test results to the WordPress.org host test results
    215         if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }}
    216         env:
    217           WPT_REPORT_API_KEY: "${{ secrets.WPT_REPORT_API_KEY }}"
    218         run: docker-compose run --rm -e WPT_REPORT_API_KEY -e WPT_PREPARE_DIR=/var/www -e WPT_TEST_DIR=/var/www php php test-runner/report.php
     77    with:
     78      os: ${{ matrix.os }}
     79      php: ${{ matrix.php }}
     80      db-type: ${{ matrix.db-type }}
     81      db-version: ${{ matrix.db-version }}
     82      multisite: ${{ matrix.multisite }}
     83      memcached: ${{ matrix.memcached }}
     84      phpunit-config: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }}
     85      report: ${{ matrix.report || false }}
    21986
    22087  slack-notifications:
    22188    name: Slack Notifications
    22289    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
     90    permissions:
     91      actions: read
     92      contents: read
    22393    needs: [ test-php ]
    22494    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
     
    234104    name: Failed workflow tasks
    235105    runs-on: ubuntu-latest
     106    permissions:
     107      actions: write
    236108    needs: [ test-php, slack-notifications ]
    237109    if: |
Note: See TracChangeset for help on using the changeset viewer.