Make WordPress Core

Changeset 58610


Ignore:
Timestamp:
07/01/2024 06:48:38 PM (4 months ago)
Author:
desrosj
Message:

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

This updates the 5.5 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).
  • 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.
  • Cache the results of PHP_CodeSniffer runs (#49783).
  • Move the Memcached container into the Docker Compose config (#55700).
  • Improvements to the healthcheck command for the mysql container (#58867).
  • A fix to grunt clean to prevent script-loader-packages.php from being deleted (#53606).
  • Skip some tests when not in the primary branch (#50401).

Merges [49264], [51355], [51673], [52179], [53552], [53895], [56464], [57918], [58157], [57124], [57125], [57249] to the 5.5 branch.

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

Location:
branches/5.5
Files:
2 added
1 deleted
15 edited
1 moved

Legend:

Unmodified
Added
Removed
  • branches/5.5

  • branches/5.5/.github/workflows/coding-standards.yml

    r55520 r58610  
    4141  cancel-in-progress: true
    4242
     43# Disable permissions for all available scopes by default.
     44# Any needed permissions should be configured at the job level.
     45permissions: {}
     46
    4347jobs:
    4448  # Runs PHP coding standards checks.
    45   #
    46   # Violations are reported inline with annotations.
    47   #
    48   # Performs the following steps:
    49   # - Checks out the repository.
    50   # - Sets up PHP.
    51   # - Logs debug information.
    52   # - Installs Composer dependencies (use cache if possible).
    53   # - Make Composer packages available globally.
    54   # - Logs PHP_CodeSniffer debug information.
    55   # - Runs PHPCS on the full codebase with warnings suppressed.
    56   # - Runs PHPCS on the `tests` directory without warnings suppressed.
    5749  phpcs:
    5850    name: PHP coding standards
    59     runs-on: ubuntu-latest
    60     timeout-minutes: 20
     51    uses: WordPress/wordpress-develop/.github/workflows/reusable-coding-standards-php.yml@trunk
     52    permissions:
     53      contents: read
    6154    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    62 
    63     steps:
    64       - name: Checkout repository
    65         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    66 
    67       - name: Set up PHP
    68         uses: shivammathur/setup-php@d30ad8b1843ace22e6698ab99bbafaa747b6bd0d # v2.24.0
    69         with:
    70           php-version: '7.4'
    71           coverage: none
    72           tools: composer, cs2pr
    73 
    74       - name: Log debug information
    75         run: |
    76           php --version
    77           composer --version
    78 
    79       - name: Install Composer dependencies
    80         uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
    81         with:
    82           composer-options: "--no-progress --no-ansi"
    83 
    84       - name: Make Composer packages available globally
    85         run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
    86 
    87       - name: Log PHPCS debug information
    88         run: phpcs -i
    89 
    90       - name: Run PHPCS on all Core files
    91         run: phpcs -q -n --report=checkstyle | cs2pr
    92 
    93       - name: Check test suite files for warnings
    94         run: phpcs tests -q --report=checkstyle | cs2pr
     55    with:
     56      php-version: '7.4'
    9557
    9658  # Runs the JavaScript coding standards checks.
    97   #
    98   # JSHint violations are not currently reported inline with annotations.
    99   #
    100   # Performs the following steps:
    101   # - Checks out the repository.
    102   # - Logs debug information about the GitHub Action runner.
    103   # - Installs Node.js.
    104   # - Logs updated debug information.
    105   # _ Installs npm dependencies.
    106   # - Run the WordPress JSHint checks.
    10759  jshint:
    10860    name: JavaScript coding standards
    109     runs-on: ubuntu-latest
    110     timeout-minutes: 20
     61    uses: WordPress/wordpress-develop/.github/workflows/reusable-coding-standards-javascript.yml@trunk
     62    permissions:
     63      contents: read
    11164    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    112     env:
    113       PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
    114 
    115     steps:
    116       - name: Checkout repository
    117         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    118 
    119       - name: Log debug information
    120         run: |
    121           npm --version
    122           node --version
    123           git --version
    124           svn --version
    125 
    126       - name: Install Node.js
    127         uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
    128         with:
    129           node-version-file: '.nvmrc'
    130           cache: npm
    131 
    132       - name: Log debug information
    133         run: |
    134           npm --version
    135           node --version
    136 
    137       - name: Install Dependencies
    138         run: npm ci
    139 
    140       - name: Run JSHint
    141         run: npm run grunt jshint
    14265
    14366  slack-notifications:
    14467    name: Slack Notifications
    14568    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
     69    permissions:
     70      actions: read
     71      contents: read
    14672    needs: [ phpcs, jshint ]
    14773    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
     
    15783    name: Failed workflow tasks
    15884    runs-on: ubuntu-latest
     85    permissions:
     86      actions: write
    15987    needs: [ phpcs, jshint, slack-notifications ]
    16088    if: |
     
    17098    steps:
    17199      - name: Dispatch workflow run
    172         uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
     100        uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
    173101        with:
    174102          retries: 2
  • branches/5.5/.github/workflows/javascript-tests.yml

    r55520 r58610  
    3939  cancel-in-progress: true
    4040
     41# Disable permissions for all available scopes by default.
     42# Any needed permissions should be configured at the job level.
     43permissions: {}
     44
    4145jobs:
    4246  # Runs the QUnit tests for WordPress.
    43   #
    44   # Performs the following steps:
    45   # - Checks out the repository.
    46   # - Logs debug information about the GitHub Action runner.
    47   # - Installs Node.js.
    48   # - Logs updated debug information.
    49   # _ Installs npm dependencies.
    50   # - Run the WordPress QUnit tests.
    5147  test-js:
    5248    name: QUnit Tests
    53     runs-on: ubuntu-latest
    54     timeout-minutes: 20
     49    uses: WordPress/wordpress-develop/.github/workflows/reusable-javascript-tests.yml@trunk
     50    permissions:
     51      contents: read
    5552    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    56 
    57     steps:
    58       - name: Checkout repository
    59         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    60 
    61       - name: Log debug information
    62         run: |
    63           npm --version
    64           node --version
    65           git --version
    66           svn --version
    67 
    68       - name: Set up Node.js
    69         uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
    70         with:
    71           node-version-file: '.nvmrc'
    72           cache: npm
    73 
    74       - name: Log debug information
    75         run: |
    76           npm --version
    77           node --version
    78 
    79       - name: Install Dependencies
    80         run: npm ci
    81 
    82       - name: Run QUnit tests
    83         run: npm run grunt qunit:compiled
    8453
    8554  slack-notifications:
    8655    name: Slack Notifications
    8756    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
     57    permissions:
     58      actions: read
     59      contents: read
    8860    needs: [ test-js ]
    8961    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
     
    9971    name: Failed workflow tasks
    10072    runs-on: ubuntu-latest
     73    permissions:
     74      actions: write
    10175    needs: [ test-js, slack-notifications ]
    10276    if: |
     
    11185    steps:
    11286      - name: Dispatch workflow run
    113         uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
     87        uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
    11488        with:
    11589          retries: 2
  • branches/5.5/.github/workflows/php-compatibility.yml

    r55520 r58610  
    2323      # These files configure Composer. Changes could affect the outcome.
    2424      - 'composer.*'
    25       # This file configures PHP Compatibility scanning. Changes could affect the outcome.
     25      # This file configures PHP compatibility scanning. Changes could affect the outcome.
    2626      - 'phpcompat.xml.dist'
    2727      # Changes to workflow files should always verify all workflows are successful.
     
    3636  cancel-in-progress: true
    3737
     38# Disable permissions for all available scopes by default.
     39# Any needed permissions should be configured at the job level.
     40permissions: {}
     41
    3842jobs:
    39 
    4043  # Runs PHP compatibility testing.
    41   #
    42   # Violations are reported inline with annotations.
    43   #
    44   # Performs the following steps:
    45   # - Checks out the repository.
    46   # - Sets up PHP.
    47   # - Logs debug information about the GitHub Action runner.
    48   # - Installs Composer dependencies (use cache if possible).
    49   # - Make Composer packages available globally.
    50   # - Logs PHP_CodeSniffer debug information.
    51   # - Runs the PHP compatibility tests.
    5244  php-compatibility:
    5345    name: Check PHP compatibility
    54     runs-on: ubuntu-latest
    55     timeout-minutes: 20
     46    uses: WordPress/wordpress-develop/.github/workflows/reusable-php-compatibility.yml@trunk
     47    permissions:
     48      contents: read
    5649    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    57 
    58     steps:
    59       - name: Checkout repository
    60         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    61 
    62       - name: Set up PHP
    63         uses: shivammathur/setup-php@d30ad8b1843ace22e6698ab99bbafaa747b6bd0d # v2.24.0
    64         with:
    65           php-version: '7.4'
    66           coverage: none
    67           tools: composer, cs2pr
    68 
    69       - name: Log debug information
    70         run: |
    71           php --version
    72           composer --version
    73 
    74       - name: Install Composer dependencies
    75         uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
    76         with:
    77           composer-options: "--no-progress --no-ansi"
    78 
    79       - name: Make Composer packages available globally
    80         run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
    81 
    82       - name: Log PHPCS debug information
    83         run: phpcs -i
    84 
    85       - name: Run PHP compatibility tests
    86         run: phpcs --standard=phpcompat.xml.dist -q --report=checkstyle | cs2pr
     50    with:
     51      php-version: '7.4'
    8752
    8853  slack-notifications:
    8954    name: Slack Notifications
    9055    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
     56    permissions:
     57      actions: read
     58      contents: read
    9159    needs: [ php-compatibility ]
    9260    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
     
    10270    name: Failed workflow tasks
    10371    runs-on: ubuntu-latest
     72    permissions:
     73      actions: write
    10474    needs: [ php-compatibility, slack-notifications ]
    10575    if: |
     
    11484    steps:
    11585      - name: Dispatch workflow run
    116         uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
     86        uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
    11787        with:
    11888          retries: 2
  • branches/5.5/.github/workflows/phpunit-tests.yml

    r55520 r58610  
    2727  cancel-in-progress: true
    2828
    29 env:
    30   PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
    31   # Controls which npm script to use for running PHPUnit tests. Options ar `php` and `php-composer`.
    32   PHPUNIT_SCRIPT: php
    33   LOCAL_PHP_MEMCACHED: ${{ false }}
    34   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: {}
    3532
    3633jobs:
    37   # Runs the PHPUnit tests for WordPress.
    38   #
    39   # Performs the following steps:
    40   # - Sets environment variables.
    41   # - Sets up the environment variables needed for testing with memcached (if desired).
    42   # - Installs Node.js.
    43   # - Installs npm dependencies
    44   # - Configures caching for Composer.
    45   # - Installs Composer dependencies.
    46   # - Logs Docker debug information (about the Docker installation within the runner).
    47   # - Starts the WordPress Docker container.
    48   # - Starts the Memcached server after the Docker network has been created (if desired).
    49   # - Logs general debug information about the runner.
    50   # - Logs the running Docker containers.
    51   # - Logs debug information from inside the WordPress Docker container.
    52   # - Logs debug information about what's installed within the WordPress Docker containers.
    53   # - Install WordPress within the Docker container.
    54   # - Run the PHPUnit tests.
    55   # - Checks out the WordPress Test reporter repository.
    56   # - Reconnect the directory to the Git repository.
    57   # - Submit the test results to the WordPress.org host test results.
     34  # Creates PHPUnit test jobs.
    5835  test-php:
    59     name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
    60     runs-on: ${{ matrix.os }}
    61     timeout-minutes: 20
     36    name: PHP ${{ matrix.php }}
     37    uses: WordPress/wordpress-develop/.github/workflows/reusable-phpunit-tests-v2.yml@trunk
     38    permissions:
     39      contents: read
     40    secrets: inherit
    6241    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    6342    strategy:
    6443      fail-fast: false
    6544      matrix:
     45        os: [ ubuntu-latest ]
    6646        php: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4' ]
    67         os: [ ubuntu-latest ]
     47        multisite: [ false, true ]
     48        split_slow: [ false ]
    6849        memcached: [ false ]
    69         split_slow: [ false ]
    70         multisite: [ false, true ]
    7150        include:
    7251          # Additional "slow" jobs for PHP 5.6.
    73           - php: '5.6.20'
     52          - php: '5.6'
    7453            os: ubuntu-latest
    7554            memcached: false
    7655            multisite: false
    7756            split_slow: true
    78           - php: '5.6.20'
     57          - php: '5.6'
    7958            os: ubuntu-latest
    8059            memcached: false
     
    8665            memcached: true
    8766            multisite: false
     67            split_slow: false
    8868          - php: '7.4'
    8969            os: ubuntu-latest
    9070            memcached: true
    9171            multisite: true
    92           # Report the results of the PHP 7.4 without memcached job.
    93           - php: '7.4'
    94             os: ubuntu-latest
    95             memcached: false
    96             multisite: false
    97             report: true
    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: Install Node.js
    113         uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
    114         with:
    115           node-version-file: '.nvmrc'
    116           cache: npm
    117 
    118       - name: Install npm dependencies
    119         run: npm ci
    120 
    121       - name: Get Composer cache directory
    122         id: composer-cache
    123         run: echo "composer_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
    124 
    125       - name: Cache Composer dependencies
    126         uses: actions/cache@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3
    127         env:
    128           cache-name: cache-composer-dependencies
    129         with:
    130           path: ${{ steps.composer-cache.outputs.composer_dir }}
    131           key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
    132 
    133       - name: Install Composer dependencies
    134         run: |
    135           if [ ${{ env.LOCAL_PHP }} == '7.1-fpm' ]; then
    136             docker-compose run --rm php composer update
    137             git checkout -- composer.lock
    138           elif [[ ${{ env.LOCAL_PHP }} == '5.6.20-fpm' || ${{ env.LOCAL_PHP }} == '5.6-fpm' || ${{ env.LOCAL_PHP }} == '7.0-fpm' ]]; then
    139             docker-compose run --rm php composer require --dev phpunit/phpunit:"^5.7" --update-with-dependencies
    140             git checkout -- composer.lock composer.json
    141           else
    142             docker-compose run --rm php composer install
    143           fi
    144 
    145       - name: Docker debug information
    146         run: |
    147           docker -v
    148           docker-compose -v
    149 
    150       - name: Start Docker environment
    151         run: |
    152           npm run env:start
    153 
    154       # The memcached server needs to start after the Docker network has been set up with `npm run env:start`.
    155       - name: Start the Memcached server.
    156         if: ${{ matrix.memcached }}
    157         run: |
    158           cp tests/phpunit/includes/object-cache.php src/wp-content/object-cache.php
    159           docker run --name memcached --net $(basename "$PWD")_wpdevnet -d memcached
    160 
    161       - name: General debug information
    162         run: |
    163           npm --version
    164           node --version
    165           curl --version
    166           git --version
    167           svn --version
    168 
    169       - name: Log running Docker containers
    170         run: docker ps -a
    171 
    172       - name: WordPress Docker container debug information
    173         run: |
    174           docker-compose run --rm mysql mysql --version
    175           docker-compose run --rm php php --version
    176           docker-compose run --rm php php -m
    177           docker-compose run --rm php php -i
    178           docker-compose run --rm php locale -a
    179 
    180       - name: Install WordPress
    181         run: npm run env:install
    182 
    183       - name: Run slow PHPUnit tests
    184         if: ${{ matrix.split_slow }}
    185         run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }}
    186 
    187       - name: Run PHPUnit tests for single site excluding slow tests
    188         if: ${{ matrix.php < '7.0' && ! matrix.split_slow && ! matrix.multisite }}
    189         run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-required
    190 
    191       - name: Run PHPUnit tests for Multisite excluding slow tests
    192         if: ${{ matrix.php < '7.0' && ! matrix.split_slow && matrix.multisite }}
    193         run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-excluded,oembed-headers
    194 
    195       - name: Run PHPUnit tests
    196         if: ${{ matrix.php >= '7.0' }}
    197         run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }}
    198 
    199       - name: Run AJAX tests
    200         if: ${{ ! matrix.split_slow && ! matrix.multisite }}
    201         run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax
    202 
    203       - name: Run ms-files tests as a multisite install
    204         if: ${{ matrix.multisite && ! matrix.split_slow }}
    205         run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml --group ms-files
    206 
    207       - name: Run external HTTP tests
    208         if: ${{ ! matrix.multisite && ! matrix.split_slow }}
    209         run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --group external-http
    210 
    211       # __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
    212       - name: Run (xDebug) tests
    213         if: ${{ ! matrix.split_slow }}
    214         run: LOCAL_PHP_XDEBUG=true npm run test:${{ env.PHPUNIT_SCRIPT }} -- -v --group xdebug --exclude-group __fakegroup__
    215 
    216       - name: Checkout the WordPress Test Reporter
    217         if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }}
    218         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    219         with:
    220           repository: 'WordPress/phpunit-test-runner'
    221           path: 'test-runner'
    222 
    223       - name: Submit test results to the WordPress.org host test results
    224         if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }}
    225         env:
    226           WPT_REPORT_API_KEY: "${{ secrets.WPT_REPORT_API_KEY }}"
    227         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
     72            split_slow: false
     73    with:
     74      os: ${{ matrix.os }}
     75      php: ${{ matrix.php }}
     76      multisite: ${{ matrix.multisite }}
     77      split_slow: ${{ matrix.split_slow }}
     78      test_ajax: ${{ ! matrix.multisite }}
     79      memcached: ${{ matrix.memcached }}
     80      phpunit-config: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }}
    22881
    22982  slack-notifications:
    23083    name: Slack Notifications
    23184    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
     85    permissions:
     86      actions: read
     87      contents: read
    23288    needs: [ test-php ]
    23389    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
    23490    with:
    235       calling_status: ${{ needs.test-php.result == 'success' && 'success' || needs.test-php.result == 'cancelled' && 'cancelled' || 'failure' }}
     91      calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }}
    23692    secrets:
    23793      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
     
    24399    name: Failed workflow tasks
    244100    runs-on: ubuntu-latest
    245     needs: [ test-php, slack-notifications ]
     101    permissions:
     102      actions: write
     103    needs: [ slack-notifications ]
    246104    if: |
    247105      always() &&
     
    250108      github.run_attempt < 2 &&
    251109      (
    252         needs.test-php.result == 'cancelled' || needs.test-php.result == 'failure'
     110        contains( needs.*.result, 'cancelled' ) ||
     111        contains( needs.*.result, 'failure' )
    253112      )
    254113
    255114    steps:
    256115      - name: Dispatch workflow run
    257         uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
     116        uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
    258117        with:
    259118          retries: 2
  • branches/5.5/.github/workflows/test-build-processes.yml

    r58609 r58610  
    1 name: Test npm
     1name: Test Build Processes
    22
    33on:
     
    3434  cancel-in-progress: true
    3535
    36 env:
    37   PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
     36# Disable permissions for all available scopes by default.
     37# Any needed permissions should be configured at the job level.
     38permissions: {}
    3839
    3940jobs:
    40   # Verifies that installing npm dependencies and building WordPress works as expected.
    41   #
    42   # Performs the following steps:
    43   # - Checks out the repository.
    44   # - Logs debug information about the GitHub Action runner.
    45   # - Installs Node.js.
    46   # _ Installs npm dependencies.
    47   # - Builds WordPress to run from the `build` directory.
    48   # - Cleans up after building WordPress to the `build` directory.
    49   # - Builds WordPress to run from the `src` directory.
    50   # - Cleans up after building WordPress to the `src` directory.
    51   test-npm:
    52     name: Test npm on ${{ matrix.os }}
    53     runs-on: ${{ matrix.os }}
    54     timeout-minutes: 20
     41  # Tests the WordPress Core build process on multiple operating systems.
     42  test-core-build-process:
     43    name: Core running from ${{ matrix.directory }}
     44    uses: WordPress/wordpress-develop/.github/workflows/reusable-test-core-build-process.yml@trunk
     45    permissions:
     46      contents: read
    5547    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    5648    strategy:
     
    5850      matrix:
    5951        os: [ ubuntu-latest, windows-latest ]
     52        directory: [ 'src', 'build' ]
     53        include:
     54          # Only prepare artifacts once.
     55          - os: ubuntu-latest
     56            directory: 'build'
     57            prepare-playground: true
     58    with:
     59      os: ${{ matrix.os }}
     60      directory: ${{ matrix.directory }}
     61      prepare-playground: ${{ matrix.prepare-playground && matrix.prepare-playground || false }}
     62      test-emoji: false
    6063
    61     steps:
    62       - name: Checkout repository
    63         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    64 
    65       - name: Log debug information
    66         run: |
    67           npm --version
    68           node --version
    69           curl --version
    70           git --version
    71           svn --version
    72 
    73       - name: Install Node.js
    74         uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
    75         with:
    76           node-version-file: '.nvmrc'
    77           cache: npm
    78 
    79       - name: Install Dependencies
    80         run: npm ci
    81 
    82       - name: Build WordPress
    83         run: npm run build
    84 
    85       - name: Clean after building
    86         run: npm run grunt clean
    87 
    88       - name: Build WordPress in /src
    89         run: npm run build:dev
    90 
    91       - name: Clean after building in /src
    92         run: npm run grunt clean -- --dev
    93 
    94   # Verifies that installing npm dependencies and building WordPress works as expected on MacOS.
     64  # Tests the WordPress Core build process on MacOS.
    9565  #
    96   # This is separate from the job above in order to use stricter conditions about when to run.
     66  # This is separate from the job above in order to use stricter conditions when determining when to run.
    9767  # This avoids unintentionally consuming excessive minutes, as MacOS jobs consume minutes at a 10x rate.
    9868  #
     
    10070  # currently no way to determine the OS being used on a given job.
    10171  # See https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability.
    102   #
    103   # Performs the following steps:
    104   # - Checks out the repository.
    105   # - Logs debug information about the GitHub Action runner.
    106   # - Installs Node.js.
    107   # _ Installs npm dependencies.
    108   # - Builds WordPress to run from the `build` directory.
    109   # - Cleans up after building WordPress to the `build` directory.
    110   # - Builds WordPress to run from the `src` directory.
    111   # - Cleans up after building WordPress to the `src` directory.
    112   test-npm-macos:
    113     name: Test npm on MacOS
    114     runs-on: macos-latest
    115     timeout-minutes: 30
     72  test-core-build-process-macos:
     73    name: Core running from ${{ matrix.directory }}
     74    uses: WordPress/wordpress-develop/.github/workflows/reusable-test-core-build-process.yml@trunk
     75    permissions:
     76      contents: read
    11677    if: ${{ github.repository == 'WordPress/wordpress-develop' }}
    117     steps:
    118       - name: Checkout repository
    119         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    120 
    121       - name: Log debug information
    122         run: |
    123           npm --version
    124           node --version
    125           curl --version
    126           git --version
    127           svn --version
    128 
    129       - name: Install Node.js
    130         uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
    131         with:
    132           node-version-file: '.nvmrc'
    133           cache: npm
    134 
    135       - name: Install Dependencies
    136         run: npm ci
    137 
    138       - name: Build WordPress
    139         run: npm run build
    140 
    141       - name: Clean after building
    142         run: npm run grunt clean
    143 
    144       - name: Build WordPress in /src
    145         run: npm run build:dev
    146 
    147       - name: Clean after building in /src
    148         run: npm run grunt clean -- --dev
     78    strategy:
     79      fail-fast: false
     80      matrix:
     81        os: [ macos-13 ]
     82        directory: [ 'src', 'build' ]
     83    with:
     84      os: ${{ matrix.os }}
     85      directory: ${{ matrix.directory }}
     86      test-emoji: false
    14987
    15088  slack-notifications:
    15189    name: Slack Notifications
    15290    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
    153     needs: [ test-npm, test-npm-macos ]
     91    permissions:
     92      actions: read
     93      contents: read
     94    needs: [ test-core-build-process, test-core-build-process-macos ]
    15495    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
    15596    with:
    156       calling_status: ${{ needs.test-npm.result == 'success' && needs.test-npm-macos.result == 'success' && 'success' || ( needs.test-npm.result == 'cancelled' || needs.test-npm-macos.result == 'cancelled' ) && 'cancelled' || 'failure' }}
     97      calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }}
    15798    secrets:
    15899      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
     
    164105    name: Failed workflow tasks
    165106    runs-on: ubuntu-latest
    166     needs: [ test-npm, test-npm-macos, slack-notifications ]
     107    permissions:
     108      actions: write
     109    needs: [ slack-notifications ]
    167110    if: |
    168111      always() &&
     
    171114      github.run_attempt < 2 &&
    172115      (
    173         needs.test-npm.result == 'cancelled' || needs.test-npm.result == 'failure' ||
    174         needs.test-npm-macos.result == 'cancelled' || needs.test-npm-macos.result == 'failure'
     116        contains( needs.*.result, 'cancelled' ) ||
     117        contains( needs.*.result, 'failure' )
    175118      )
    176119
    177120    steps:
    178121      - name: Dispatch workflow run
    179         uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
     122        uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
    180123        with:
    181124          retries: 2
  • branches/5.5/.gitignore

    r47497 r58610  
    1010/.phpcs.xml
    1111/phpcs.xml
     12.cache/*
    1213/tests/phpunit/data/plugins/wordpress-importer
    1314/tests/phpunit/data/.trac-ticket-cache*
  • branches/5.5/Gruntfile.js

    r50603 r58610  
    123123            ],
    124124            'webpack-assets': [
    125                 WORKING_DIR + 'wp-includes/assets/'
     125                WORKING_DIR + 'wp-includes/assets/*',
     126                '!' + WORKING_DIR + 'wp-includes/assets/script-loader-packages.php'
    126127            ],
    127128            dynamic: {
  • branches/5.5/docker-compose.yml

    r55520 r58610  
    1 version: '3.7'
    2 
    31services:
    42
     
    2624
    2725    depends_on:
    28       - php
     26      php:
     27        condition: service_started
     28      mysql:
     29        condition: service_healthy
    2930
    3031  ##
     
    3839
    3940    environment:
    40       LOCAL_PHP_XDEBUG: ${LOCAL_PHP_XDEBUG-false}
    41       LOCAL_PHP_MEMCACHED: ${LOCAL_PHP_MEMCACHED-false}
    42       PHP_FPM_UID: ${PHP_FPM_UID-1000}
    43       PHP_FPM_GID: ${PHP_FPM_GID-1000}
     41      - LOCAL_PHP_XDEBUG=${LOCAL_PHP_XDEBUG-false}
     42      - LOCAL_PHP_MEMCACHED=${LOCAL_PHP_MEMCACHED-false}
     43      - PHP_FPM_UID=${PHP_FPM_UID-1000}
     44      - PHP_FPM_GID=${PHP_FPM_GID-1000}
     45      - GITHUB_REF=${GITHUB_REF-false}
     46      - GITHUB_EVENT_NAME=${GITHUB_EVENT_NAME-false}
    4447
    4548    volumes:
     
    4750      - ./:/var/www
    4851
    49     depends_on:
    50       - mysql
     52    # Copy or delete the Memcached dropin plugin file as appropriate.
     53    command: /bin/sh -c "if [ $LOCAL_PHP_MEMCACHED = true ]; then cp -n /var/www/tests/phpunit/includes/object-cache.php /var/www/src/wp-content/object-cache.php; else rm -f /var/www/src/wp-content/object-cache.php; fi && exec php-fpm"
     54
     55    # The init directive ensures the command runs with a PID > 1, so Ctrl+C works correctly.
     56    init: true
     57
     58    extra_hosts:
     59      - localhost:host-gateway
    5160
    5261  ##
     
    5463  ##
    5564  mysql:
    56     image: amd64/${LOCAL_DB_TYPE-mysql}:${LOCAL_DB_VERSION-latest}
     65    image: ${LOCAL_DB_TYPE-mysql}:${LOCAL_DB_VERSION-latest}
     66    platform: linux/amd64
    5767
    5868    networks:
     
    7282    command: --default-authentication-plugin=mysql_native_password
    7383
     84    healthcheck:
     85      test: [ "CMD-SHELL", "if [ \"$LOCAL_DB_TYPE\" = \"mariadb\" ]; then mariadb-admin ping -h localhost; else mysqladmin ping -h localhost; fi" ]
     86      timeout: 5s
     87      interval: 5s
     88      retries: 10
     89
    7490  ##
    7591  # The WP CLI container.
    7692  ##
    7793  cli:
    78     image: wordpressdevelop/cli:${LOCAL_PHP-latest}
     94    image: wordpressdevelop/cli:${LOCAL_PHP-7.4-fpm}
    7995
    8096    networks:
     
    8298
    8399    environment:
    84       LOCAL_PHP_XDEBUG: ${LOCAL_PHP_XDEBUG-false}
    85       LOCAL_PHP_MEMCACHED: ${LOCAL_PHP_MEMCACHED-false}
    86       PHP_FPM_UID: ${PHP_FPM_UID-1000}
    87       PHP_FPM_GID: ${PHP_FPM_GID-1000}
     100      - LOCAL_PHP_XDEBUG=${LOCAL_PHP_XDEBUG-false}
     101      - LOCAL_PHP_MEMCACHED=${LOCAL_PHP_MEMCACHED-false}
     102      - PHP_FPM_UID=${PHP_FPM_UID-1000}
     103      - PHP_FPM_GID=${PHP_FPM_GID-1000}
    88104
    89105    volumes:
     
    92108    # The init directive ensures the command runs with a PID > 1, so Ctrl+C works correctly.
    93109    init: true
     110
     111    extra_hosts:
     112      - localhost:host-gateway
     113
     114    depends_on:
     115      php:
     116        condition: service_started
     117      mysql:
     118        condition: service_healthy
    94119
    95120  ##
     
    103128
    104129    environment:
    105       LOCAL_PHP_XDEBUG: ${LOCAL_PHP_XDEBUG-false}
    106       LOCAL_PHP_MEMCACHED: ${LOCAL_PHP_MEMCACHED-false}
    107       LOCAL_DIR: ${LOCAL_DIR-src}
    108       WP_MULTISITE: ${WP_MULTISITE-false}
    109       PHP_FPM_UID: ${PHP_FPM_UID-1000}
    110       PHP_FPM_GID: ${PHP_FPM_GID-1000}
    111       TRAVIS_BRANCH: ${TRAVIS_BRANCH-false}
    112       TRAVIS_PULL_REQUEST: ${TRAVIS_PULL_REQUEST-false}
     130      - LOCAL_PHP_XDEBUG=${LOCAL_PHP_XDEBUG-false}
     131      - LOCAL_PHP_MEMCACHED=${LOCAL_PHP_MEMCACHED-false}
     132      - PHP_FPM_UID=${PHP_FPM_UID-1000}
     133      - PHP_FPM_GID=${PHP_FPM_GID-1000}
     134      - LOCAL_DIR=${LOCAL_DIR-src}
     135      - WP_MULTISITE=${WP_MULTISITE-false}
     136      - GITHUB_REF=${GITHUB_REF-false}
     137      - GITHUB_EVENT_NAME=${GITHUB_EVENT_NAME-false}
    113138
    114139    volumes:
     
    121146
    122147    depends_on:
    123       - mysql
     148      php:
     149        condition: service_started
     150      mysql:
     151        condition: service_healthy
     152
     153  ##
     154  # The Memcached container.
     155  ##
     156  memcached:
     157    image: memcached
     158
     159    networks:
     160      - wpdevnet
     161
     162    ports:
     163      - 11211:11211
     164
     165    depends_on:
     166      php:
     167        condition: service_started
    124168
    125169volumes:
  • branches/5.5/package-lock.json

    r58513 r58610  
    25832583        },
    25842584        "@types/mime-types": {
    2585             "version": "2.1.1",
    2586             "resolved": "https://registry.npmjs.org/@types/mime-types/-/mime-types-2.1.1.tgz",
    2587             "integrity": "sha512-vXOTGVSLR2jMw440moWTC7H19iUyLtP3Z1YTj7cSsubOICinjMxFeb/V57v9QdyyPGbbWolUFSSmSiRSn94tFw==",
     2585            "version": "2.1.4",
     2586            "resolved": "https://registry.npmjs.org/@types/mime-types/-/mime-types-2.1.4.tgz",
     2587            "integrity": "sha512-lfU4b34HOri+kAY5UheuFMWPDOI+OPceBSHZKp69gEyTL/mmJ4cnU6Y/rlme3UL3GyOn6Y42hyIEw0/q8sWx5w==",
    25882588            "dev": true
    25892589        },
     
    2024920249            "dependencies": {
    2025020250                "debug": {
    20251                     "version": "4.3.4",
    20252                     "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
    20253                     "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
     20251                    "version": "4.3.5",
     20252                    "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz",
     20253                    "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==",
    2025420254                    "dev": true,
    2025520255                    "requires": {
  • branches/5.5/phpcompat.xml.dist

    r47902 r58610  
    1212
    1313    <!-- Whenever possible, cache the scan results and re-use those for unchanged files on the next scan. -->
    14     <arg name="cache"/>
     14    <arg name="cache" value=".cache/phpcompat.json"/>
    1515
    1616    <!-- Set the memory limit to 256M.
  • branches/5.5/phpcs.xml.dist

    r48072 r58610  
    77
    88    <!-- Whenever possible, cache the scan results and re-use those for unchanged files on the next scan. -->
    9     <arg name="cache"/>
     9    <arg name="cache" value=".cache/phpcs.json"/>
    1010
    1111    <!-- Set the memory limit to 256M.
  • branches/5.5/tests/phpunit/includes/abstract-testcase.php

    r50603 r58610  
    184184
    185185    /**
    186      * Allow tests to be skipped on some automated runs.
    187      *
    188      * For test runs on Travis for something other than trunk/master
    189      * we want to skip tests that only need to run for master.
     186     * Allows tests to be skipped on some automated runs.
     187     *
     188     * For test runs on GitHub Actions for something other than trunk,
     189     * we want to skip tests that only need to run for trunk.
    190190     */
    191191    public function skipOnAutomatedBranches() {
    192         // https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables
    193         $travis_branch       = getenv( 'TRAVIS_BRANCH' );
    194         $travis_pull_request = getenv( 'TRAVIS_PULL_REQUEST' );
    195 
    196         if ( ! $travis_branch || ! $travis_pull_request ) {
    197             return;
    198         }
    199 
    200         if ( 'master' !== $travis_branch || 'false' !== $travis_pull_request ) {
    201             $this->markTestSkipped( 'For automated test runs, this test is only run on trunk/master' );
     192        // https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
     193        $github_event_name = getenv( 'GITHUB_EVENT_NAME' );
     194        $github_ref        = getenv( 'GITHUB_REF' );
     195
     196        if ( $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/trunk' !== $github_ref ) {
     201                $this->markTestSkipped( 'For automated test runs, this test is only run on trunk' );
     202            }
    202203        }
    203204    }
  • branches/5.5/tools/local-env/scripts/docker.js

    r49363 r58610  
    55dotenvExpand( dotenv.config() );
    66
    7 // Execute any docker-compose command passed to this script.
    8 execSync( 'docker-compose ' + process.argv.slice( 2 ).join( ' ' ), { stdio: 'inherit' } );
     7// Execute any docker compose command passed to this script.
     8execSync( 'docker compose ' + process.argv.slice( 2 ).join( ' ' ), { stdio: 'inherit' } );
  • branches/5.5/tools/local-env/scripts/install.js

    r50302 r58610  
    4646 */
    4747function wp_cli( cmd ) {
    48     execSync( `docker-compose run --rm cli ${cmd}`, { stdio: 'inherit' } );
     48    execSync( `docker compose run --rm cli ${cmd}`, { stdio: 'inherit' } );
    4949}
    5050
     
    5555    const test_plugin_directory = 'tests/phpunit/data/plugins/wordpress-importer';
    5656
    57     execSync( `docker-compose exec -T php rm -rf ${test_plugin_directory} && svn checkout -r ${process.env.WP_IMPORTER_REVISION} https://plugins.svn.wordpress.org/wordpress-importer/trunk/ ${test_plugin_directory}`, { stdio: 'inherit' } );
     57    execSync( `docker compose exec -T php rm -rf ${test_plugin_directory} && svn checkout -r ${process.env.WP_IMPORTER_REVISION} https://plugins.svn.wordpress.org/wordpress-importer/trunk/ ${test_plugin_directory}`, { stdio: 'inherit' } );
    5858}
  • branches/5.5/tools/local-env/scripts/start.js

    r49363 r58610  
    66
    77// Start the local-env containers.
    8 execSync( 'docker-compose up -d wordpress-develop', { stdio: 'inherit' } );
     8const containers = ( process.env.LOCAL_PHP_MEMCACHED === 'true' )
     9    ? 'wordpress-develop memcached'
     10    : 'wordpress-develop';
     11execSync( `docker compose up -d -- ${containers}`, { stdio: 'inherit' } );
    912
    1013// If Docker Toolbox is being used, we need to manually forward LOCAL_PORT to the Docker VM.
Note: See TracChangeset for help on using the changeset viewer.