Make WordPress Core


Ignore:
Timestamp:
06/06/2024 03:27:31 PM (11 months ago)
Author:
desrosj
Message:

Build/Test Tools: Make use of new reusable workflows for 6.0.

This updates the 6.0 branch to utilize the new reusable workflows in trunk introduced in [58165].

This also includes backports for a some additional improvements and bug fixes that are necessary for the local development environment to continue working long term:

  • The image and platform properties for the mysql container have been updated to always prefer amd64 containers (#60822).
  • macos-13 is now pinned for MacOS jobs instead of macos-latest (#61340).
  • Run E2E tests with and without SCRIPT_DEBUG (#58661).
  • Migrating to Docker Compose V2 (#60901).
  • Removing the version property from docker-compose.yml (#59416).
  • Improvements to how artifacts and comments for Playground testing are generated.
  • Removing SVN related commands causing failures (#61216).
  • Updating the actions/github-scripts action to the latest version.
  • Move the Memcached container into the Docker Compose config (#55700).
  • Configure Xdebug modes in the local Docker environment (#56022).

Merges [53895], [53552], [56113], [56114], [57918], [58157], [57124], [57125], [57249] to the 6.0 branch.

Props johnbillion, joemcgill, swissspidy, thelovekesh, narenin, mukesh27, JeffPaul, peterwilsoncc, zieladam, ockham, SergeyBiryukov, jorbin, Clorith, afragen.
See #55700, #61340, #60822, #61216, #60901, #61101, #59416, #59805, #61213, #58661.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/6.0/.github/workflows/phpunit-tests.yml

    r55490 r58357  
    88      - '[4-9].[0-9]'
    99    tags:
    10       - '3.[7-9]*'
    11       - '[4-9].[0-9]*'
     10      - '[0-9]+.[0-9]'
     11      - '[0-9]+.[0-9].[0-9]+'
    1212  pull_request:
    1313    branches:
     
    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   # Note: Steps running tests for PHP 8.1 jobs are allowed to "continue-on-error".
    38   # This prevents workflow runs from being marked as "failed" when only PHP 8.1 fails.
     36  # Creates a PHPUnit test job for each PHP/MySQL combination.
    3937  #
    40   # Performs the following steps:
    41   # - Sets environment variables.
    42   # - Checks out the repository.
    43   # - Sets up Node.js.
    44   # - Sets up PHP.
    45   # - Installs Composer dependencies.
    46   # - Installs npm dependencies
    47   # - Logs general debug information about the runner.
    48   # - Logs Docker debug information (about the Docker installation within the runner).
    49   # - Starts the WordPress Docker container.
    50   # - Logs the running Docker containers.
    51   # - Logs debug information about what's installed within the WordPress Docker containers.
    52   # - Install WordPress within the Docker container.
    53   # - Run the PHPUnit tests.
    54   # - Ensures version-controlled files are not modified or deleted.
    55   # - Checks out the WordPress Test reporter repository.
    56   # - Submit the test results to the WordPress.org host test results.
    5738  test-php:
    58     name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
    59     runs-on: ${{ matrix.os }}
    60     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
    6144    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    6245    strategy:
    6346      fail-fast: false
    6447      matrix:
     48        os: [ ubuntu-latest ]
    6549        php: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1' ]
    66         os: [ ubuntu-latest ]
     50        db-type: [ 'mysql' ]
     51        db-version: [ '5.7' ]
     52        multisite: [ false, true ]
    6753        memcached: [ false ]
    68         split_slow: [ false ]
    69         multisite: [ false, true ]
     54
    7055        include:
    71           # Additional "slow" jobs for PHP 5.6.
    72           - php: '5.6'
    73             os: ubuntu-latest
     56          # Allow PHP 8.1 tests to have errors.
     57          - php: '8.1'
     58            allow-errors: true
     59          # Include jobs for PHP 7.4 with memcached.
     60          - os: ubuntu-latest
     61            php: '7.4'
     62            db-type: 'mysql'
     63            db-version: '5.7'
     64            multisite: false
     65            memcached: true
     66          - os: ubuntu-latest
     67            php: '7.4'
     68            db-type: 'mysql'
     69            db-version: '5.7'
     70            multisite: true
     71            memcached: true
     72          # Report the results of the PHP 7.4 without memcached job.
     73          - os: ubuntu-latest
     74            php: '7.4'
     75            db-type: 'mysql'
     76            db-version: '5.7'
     77            multisite: false
    7478            memcached: false
    75             multisite: false
    76             split_slow: true
    77           - php: '5.6'
    78             os: ubuntu-latest
    79             memcached: false
    80             multisite: true
    81             split_slow: true
    82           # Include jobs for PHP 7.4 with memcached.
    83           - php: '7.4'
    84             os: ubuntu-latest
    85             memcached: true
    86             multisite: false
    87           - php: '7.4'
    88             os: ubuntu-latest
    89             memcached: true
    90             multisite: true
    91           # Report the results of the PHP 7.4 without memcached job.
    92           - php: '7.4'
    93             os: ubuntu-latest
    94             memcached: false
    95             multisite: false
    9679            report: true
    97 
    98     env:
    99       LOCAL_PHP: ${{ matrix.php }}-fpm
    100       LOCAL_PHP_MEMCACHED: ${{ matrix.memcached }}
    101       PHPUNIT_CONFIG: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }}
    102 
    103     steps:
    104       - name: Configure environment variables
    105         run: |
    106           echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV
    107           echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV
    108 
    109       - name: Checkout repository
    110         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    111 
    112       - name: Set up Node.js
    113         uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
    114         with:
    115           node-version-file: '.nvmrc'
    116           cache: npm
    117 
    118       ##
    119       # This allows Composer dependencies to be installed using a single step.
    120       #
    121       # Since the tests are currently run within the Docker containers where the PHP version varies,
    122       # the same PHP version needs to be configured for the action runner machine so that the correct
    123       # dependency versions are installed and cached.
    124       ##
    125       - name: Set up PHP
    126         uses: shivammathur/setup-php@d30ad8b1843ace22e6698ab99bbafaa747b6bd0d # v2.24.0
    127         with:
    128           php-version: '${{ matrix.php }}'
    129           coverage: none
    130 
    131       # Since Composer dependencies are installed using `composer update` and no lock file is in version control,
    132       # passing a custom cache suffix ensures that the cache is flushed at least once per week.
    133       - name: Install Composer dependencies
    134         uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
    135         with:
    136           custom-cache-suffix: $(/bin/date -u --date='last Mon' "+%F")
    137 
    138       - name: Install npm dependencies
    139         run: npm ci
    140 
    141       - name: General debug information
    142         run: |
    143           npm --version
    144           node --version
    145           curl --version
    146           git --version
    147           svn --version
    148           composer --version
    149           locale -a
    150 
    151       - name: Docker debug information
    152         run: |
    153           docker -v
    154           docker-compose -v
    155 
    156       - name: Start Docker environment
    157         run: |
    158           npm run env:start
    159 
    160       - name: Log running Docker containers
    161         run: docker ps -a
    162 
    163       - name: WordPress Docker container debug information
    164         run: |
    165           docker-compose run --rm mysql mysql --version
    166           docker-compose run --rm php php --version
    167           docker-compose run --rm php php -m
    168           docker-compose run --rm php php -i
    169           docker-compose run --rm php locale -a
    170 
    171       - name: Install WordPress
    172         run: npm run env:install
    173 
    174       - name: Run slow PHPUnit tests
    175         if: ${{ matrix.split_slow }}
    176         run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }}
    177 
    178       - name: Run PHPUnit tests for single site excluding slow tests
    179         if: ${{ matrix.php < '7.0' && ! matrix.split_slow && ! matrix.multisite }}
    180         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
    181 
    182       - name: Run PHPUnit tests for Multisite excluding slow tests
    183         if: ${{ matrix.php < '7.0' && ! matrix.split_slow && matrix.multisite }}
    184         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
    185 
    186       - name: Run PHPUnit tests
    187         if: ${{ matrix.php >= '7.0' }}
    188         continue-on-error: ${{ matrix.php == '8.1' }}
    189         run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }}
    190 
    191       - name: Run AJAX tests
    192         if: ${{ ! matrix.split_slow }}
    193         continue-on-error: ${{ matrix.php == '8.1' }}
    194         run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax
    195 
    196       - name: Run ms-files tests as a multisite install
    197         if: ${{ matrix.multisite && ! matrix.split_slow }}
    198         continue-on-error: ${{ matrix.php == '8.1' }}
    199         run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c tests/phpunit/multisite.xml --group ms-files
    200 
    201       - name: Run external HTTP tests
    202         if: ${{ ! matrix.multisite && ! matrix.split_slow }}
    203         continue-on-error: ${{ matrix.php == '8.1' }}
    204         run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c phpunit.xml.dist --group external-http
    205 
    206       # __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
    207       - name: Run (xDebug) tests
    208         if: ${{ ! matrix.split_slow }}
    209         continue-on-error: ${{ matrix.php == '8.1' }}
    210         run: LOCAL_PHP_XDEBUG=true node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit -v --group xdebug --exclude-group __fakegroup__
    211 
    212       - name: Ensure version-controlled files are not modified or deleted
    213         run: git diff --exit-code
    214 
    215       - name: Checkout the WordPress Test Reporter
    216         if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }}
    217         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    218         with:
    219           repository: 'WordPress/phpunit-test-runner'
    220           path: 'test-runner'
    221 
    222       - name: Submit test results to the WordPress.org host test results
    223         if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }}
    224         env:
    225           WPT_REPORT_API_KEY: "${{ secrets.WPT_REPORT_API_KEY }}"
    226         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
     80    with:
     81      os: ${{ matrix.os }}
     82      php: ${{ matrix.php }}
     83      db-type: ${{ matrix.db-type }}
     84      db-version: ${{ matrix.db-version }}
     85      multisite: ${{ matrix.multisite }}
     86      memcached: ${{ matrix.memcached }}
     87      phpunit-config: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }}
     88      report: ${{ matrix.report || false }}
     89      allow-errors: ${{ matrix.allow-errors || false }}
    22790
    22891  slack-notifications:
    22992    name: Slack Notifications
    23093    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
     94    permissions:
     95      actions: read
     96      contents: read
    23197    needs: [ test-php ]
    23298    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
     
    242108    name: Failed workflow tasks
    243109    runs-on: ubuntu-latest
     110    permissions:
     111      actions: write
    244112    needs: [ test-php, slack-notifications ]
    245113    if: |
     
    254122    steps:
    255123      - name: Dispatch workflow run
    256         uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
     124        uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
    257125        with:
    258126          retries: 2
Note: See TracChangeset for help on using the changeset viewer.