Make WordPress Core

Changeset 58626

Timestamp:
07/02/2024 07:43:50 PM (2 weeks ago)
Author:
desrosj
Message:

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

This updates the 5.1 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).
  • Skip some tests when not in the primary branch (#50401).

Merges [49264], [51673], [52179], [53552], [53895], [56464], [57918], [58157], [57124], [57125], [57249] to the 5.1 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.

Location:
branches/5.1
Files:
2 added
1 deleted
10 edited
1 moved

Legend:

Unmodified
Added
Removed
  • branches/5.1

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

    r55524 r58626  
    4141  cancel-in-progress: true
    4242
     43
     44
     45
     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
     51    uses: WordPress/wordpress-develop/.github/workflows/reusable-coding-standards-php.yml@trunk
     52    permissions:
     53      contents: read
    6054    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    61 
    62     steps:
    63       - name: Checkout repository
    64         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    65 
    66       - name: Set up PHP
    67         uses: shivammathur/setup-php@d30ad8b1843ace22e6698ab99bbafaa747b6bd0d # v2.24.0
    68         with:
    69           php-version: '7.2'
    70           coverage: none
    71           tools: composer, cs2pr
    72 
    73       - name: Log debug information
    74         run: |
    75           php --version
    76           composer --version
    77 
    78       - name: Install Composer dependencies
    79         uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
    80         with:
    81           composer-options: "--no-progress --no-ansi"
    82 
    83       - name: Make Composer packages available globally
    84         run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
    85 
    86       - name: Log PHPCS debug information
    87         run: phpcs -i
    88 
    89       - name: Run PHPCBF on all Core files
    90         run: phpcbf
     55    with:
     56      php-version: '7.2'
     57      old-branch: true
    9158
    9259  # Runs the JavaScript coding standards checks.
    93   #
    94   # JSHint violations are not currently reported inline with annotations.
    95   #
    96   # Performs the following steps:
    97   # - Checks out the repository.
    98   # - Logs debug information about the GitHub Action runner.
    99   # - Installs NodeJS.
    100   # - Logs updated debug information.
    101   # _ Installs npm dependencies.
    102   # - Run the WordPress JSHint checks.
    10360  jshint:
    10461    name: JavaScript coding standards
    105     runs-on: ubuntu-latest
    106     timeout-minutes: 20
     62    uses: WordPress/wordpress-develop/.github/workflows/reusable-coding-standards-javascript.yml@trunk
     63    permissions:
     64      contents: read
    10765    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    108     env:
    109       PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
    110 
    111     steps:
    112       - name: Checkout repository
    113         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    114 
    115       - name: Log debug information
    116         run: |
    117           npm --version
    118           node --version
    119           git --version
    120           svn --version
    121 
    122       - name: Set up Node.js
    123         uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
    124         with:
    125           node-version-file: '.nvmrc'
    126           cache: npm
    127 
    128       - name: Log debug information
    129         run: |
    130           npm --version
    131           node --version
    132 
    133       - name: Install Dependencies
    134         run: npm ci
    135 
    136       - name: Run JSHint
    137         run: npm run grunt jshint
    13866
    13967  slack-notifications:
    14068    name: Slack Notifications
    14169    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
     70
     71
     72
    14273    needs: [ phpcs, jshint ]
    14374    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
     
    15384    name: Failed workflow tasks
    15485    runs-on: ubuntu-latest
     86
     87
    15588    needs: [ phpcs, jshint, slack-notifications ]
    15689    if: |
     
    16699    steps:
    167100      - name: Dispatch workflow run
    168         uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
     101        uses: actions/github-script@
    169102        with:
    170103          retries: 2
  • branches/5.1/.github/workflows/javascript-tests.yml

    r55524 r58626  
    3939  cancel-in-progress: true
    4040
     41
     42
     43
     44
    4145jobs:
    42   # 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 NodeJS.
    48   # - Logs updated debug information.
    49   # _ Installs npm dependencies.
    50   # - Run the WordPress QUnit tests.
     46  # Runs the WordPress Core JavaScript 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
     58
     59
    8860    needs: [ test-js ]
    8961    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
    9062    with:
    91       calling_status: ${{ needs.test-js.result == 'success' && 'success' || needs.test-js.result == 'cancelled' && 'cancelled' || 'failure' }}
     63      calling_status: ${{ ' }}
    9264    secrets:
    9365      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
     
    9971    name: Failed workflow tasks
    10072    runs-on: ubuntu-latest
    101     needs: [ test-js, slack-notifications ]
     73    permissions:
     74      actions: write
     75    needs: [ slack-notifications ]
    10276    if: |
    10377      always() &&
     
    10680      github.run_attempt < 2 &&
    10781      (
    108         needs.test-js.result == 'cancelled' || needs.test-js.result == 'failure'
     82        contains( needs.*.result, 'cancelled' ) ||
     83        contains( needs.*.result, 'failure' )
    10984      )
    11085
    11186    steps:
    11287      - name: Dispatch workflow run
    113         uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
     88        uses: actions/github-script@
    11489        with:
    11590          retries: 2
  • branches/5.1/.github/workflows/phpunit-tests.yml

    r55524 r58626  
    2222# Cancels all previous workflow runs for pull requests that have not completed.
    2323concurrency:
    24     # The concurrency group contains the workflow name and the branch name for pull requests
    25     # or the commit hash for any other events.
     24  # The concurrency group contains the workflow name and the branch name for pull requests
     25  # or the commit hash for any other events.
    2626  group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
    2727  cancel-in-progress: true
    2828
    29 env:
    30   LOCAL_DIR: build
    31   PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
    32   COMPOSER_INSTALL: ${{ false }}
    33   # Controls which npm script to use for running PHPUnit tests. Options ar `php` and `php-composer`.
    34   PHPUNIT_SCRIPT: php
    35   LOCAL_PHP_MEMCACHED: ${{ false }}
    36   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: {}
    3732
    3833jobs:
    39   # Sets up WordPress for testing or development use.
    4034  #
    41   # Performs the following steps:
    42   # - Cancels all previous workflow runs for pull requests that have not completed.
    43   # - Checks out the repository.
    44   # - Logs debug information about the GitHub Action runner.
    45   # - Installs NodeJS.
    46   # _ Installs npm dependencies.
    47   # - Builds WordPress to run from the `build` directory.
    48   # - Creates a ZIP file of compiled WordPress.
    49   # - Uploads ZIP file as an artifact.
    50   setup-wordpress:
    51     name: Setup WordPress
    52     runs-on: ubuntu-latest
     35  # Creates a PHPUnit test job for each PHP combination.
     36  #
     37  test-php:
     38    name: PHP ${{ matrix.php }}
     39    uses: WordPress/wordpress-develop/.github/workflows/reusable-phpunit-tests-v1.yml@trunk
     40    permissions:
     41      contents: read
     42    secrets: inherit
    5343    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    54 
    55     steps:
    56       - name: Checkout repository
    57         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    58 
    59       - name: Log debug information
    60         run: |
    61           echo "$GITHUB_REF"
    62           echo "$GITHUB_EVENT_NAME"
    63           npm --version
    64           node --version
    65           curl --version
    66           git --version
    67           svn --version
    68           php --version
    69           php -i
    70           locale -a
    71 
    72       - name: Set up Node.js
    73         uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
    74         with:
    75           node-version-file: '.nvmrc'
    76           cache: npm
    77 
    78       - name: Install Dependencies
    79         run: npm ci
    80 
    81       - name: Build WordPress
    82         run: npm run build
    83 
    84       - name: Create ZIP artifact
    85         uses: thedoctor0/zip-release@a24011d8d445e4da5935a7e73c1f98e22a439464 # v0.7.1
    86         with:
    87           filename: built-wp-${{ github.sha }}.zip
    88           exclusions: '*.git* /*node_modules/* packagehash.txt'
    89 
    90       - name: Upload build artifact
    91         uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
    92         with:
    93           name: built-wp-${{ github.sha }}
    94           path: built-wp-${{ github.sha }}.zip
    95           if-no-files-found: error
    96 
    97   # Runs the PHPUnit tests for WordPress.
    98   #
    99   # Performs the following steps:
    100   # - Sets environment variables.
    101   # - Sets up the environment variables needed for testing with memcached (if desired).
    102   # - Downloads the built WordPress artifact from the previous job.
    103   # - Unzips the artifact.
    104   # - Installs NodeJS.
    105   # _ Installs npm dependencies.
    106   # - Configures caching for Composer.
    107   # _ Installs Composer dependencies (if desired).
    108   # - Logs Docker debug information (about the Docker installation within the runner).
    109   # - Starts the WordPress Docker container.
    110   # - Starts the Memcached server after the Docker network has been created (if desired).
    111   # - Logs general debug information about the runner.
    112   # - Logs the running Docker containers.
    113   # - Logs debug information from inside the WordPress Docker container.
    114   # - Logs debug information about what's installed within the WordPress Docker containers.
    115   # - Install WordPress within the Docker container.
    116   # - Run the PHPUnit tests.
    117   # - Checks out the WordPress Test reporter repository.
    118   # - Reconnect the directory to the Git repository.
    119   # - Submit the test results to the WordPress.org host test results.
    120   test-php:
    121     name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
    122     needs: setup-wordpress
    123     runs-on: ${{ matrix.os }}
    124     timeout-minutes: 20
    12544    strategy:
    12645      fail-fast: false
    12746      matrix:
     47
    12848        php: [ '5.3', '5.4', '5.5', '7.1', '7.2', '7.3' ]
    129         os: [ ubuntu-latest ]
    130         memcached: [ false ]
    13149        split_slow: [ false ]
    13250        multisite: [ false, true ]
     51
     52
    13353        include:
    13454          # Include jobs for PHP 7.3 with memcached.
     
    14363            split_slow: false
    14464            multisite: true
    145           # Include jobs when specific PHPUnit versions are required.
     65          # Include jobs .
    14666          - php: '7.0'
    14767            phpunit: '6-php-7.0'
    14868            os: ubuntu-latest
    14969            memcached: false
     70
    15071            multisite: false
    15172          - php: '7.0'
     
    15374            os: ubuntu-latest
    15475            memcached: false
     76
    15577            multisite: true
    15678          - php: '5.6'
     
    15880            os: ubuntu-latest
    15981            memcached: false
     82
    16083            multisite: false
    16184          - php: '5.6'
     
    16386            os: ubuntu-latest
    16487            memcached: false
     88
    16589            multisite: true
    16690          # Additional "slow" jobs for PHP <= 5.6.
     
    207131            split_slow: true
    208132            multisite: true
    209 
    210     env:
    211       LOCAL_PHP: ${{ matrix.php }}-fpm
    212       LOCAL_PHPUNIT: ${{ matrix.phpunit && matrix.phpunit || matrix.php }}-fpm
    213       LOCAL_PHP_MEMCACHED: ${{ matrix.memcached }}
    214       PHPUNIT_CONFIG: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }}
    215 
    216     steps:
    217       - name: Configure environment variables
    218         run: |
    219           echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV
    220           echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV
    221 
    222       - name: Download the built WordPress artifact
    223         uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
    224         with:
    225           name: built-wp-${{ github.sha }}
    226 
    227       - name: Unzip built artifact
    228         run: unzip built-wp-${{ github.sha }}.zip
    229 
    230       - name: Set up Node.js
    231         uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
    232         with:
    233           node-version-file: '.nvmrc'
    234           cache: npm
    235 
    236       - name: Install Dependencies
    237         run: npm ci
    238 
    239       - name: Cache Composer dependencies
    240         if: ${{ env.COMPOSER_INSTALL == true }}
    241         uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
    242         env:
    243           cache-name: cache-composer-dependencies
    244         with:
    245           path: ${{ steps.composer-cache.outputs.dir }}
    246           key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
    247 
    248       - name: Install Composer dependencies
    249         if: ${{ env.COMPOSER_INSTALL == true }}
    250         run: |
    251           docker-compose run --rm php composer --version
    252           docker-compose run --rm php composer install
    253 
    254       - name: Docker debug information
    255         run: |
    256           docker -v
    257           docker-compose -v
    258 
    259       - name: Start Docker environment
    260         run: |
    261           npm run env:start
    262 
    263       # The memcached server needs to start after the Docker network has been set up with `npm run env:start`.
    264       - name: Start the Memcached server.
    265         if: ${{ matrix.memcached }}
    266         run: |
    267           cp tests/phpunit/includes/object-cache.php build/wp-content/object-cache.php
    268           docker run --name memcached --net $(basename "$PWD")_wpdevnet -d memcached
    269 
    270       - name: General debug information
    271         run: |
    272           npm --version
    273           node --version
    274           curl --version
    275           git --version
    276           svn --version
    277 
    278       - name: Log running Docker containers
    279         run: docker ps -a
    280 
    281       - name: WordPress Docker container debug information
    282         run: |
    283           docker-compose run --rm mysql mysql --version
    284           docker-compose run --rm php php --version
    285           docker-compose run --rm php php -m
    286           docker-compose run --rm php php -i
    287           docker-compose run --rm php locale -a
    288 
    289       - name: Install WordPress
    290         run: npm run env:install
    291 
    292       - name: Run slow PHPUnit tests
    293         if: ${{ matrix.split_slow }}
    294         run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }}
    295 
    296       - name: Run PHPUnit tests for single site excluding slow tests
    297         if: ${{ matrix.php < '7.0' && ! matrix.split_slow && ! matrix.multisite }}
    298         run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-required
    299 
    300       - name: Run PHPUnit tests for Multisite excluding slow tests
    301         if: ${{ matrix.php < '7.0' && ! matrix.split_slow && matrix.multisite }}
    302         run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-excluded,oembed-headers
    303 
    304       - name: Run PHPUnit tests
    305         if: ${{ matrix.php >= '7.0' }}
    306         run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }}
    307 
    308       - name: Run AJAX tests
    309         if: ${{ ! matrix.multisite && ! matrix.split_slow }}
    310         run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax
    311 
    312       - name: Run ms-files tests as a multisite install
    313         if: ${{ matrix.multisite && ! matrix.split_slow }}
    314         run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml --group ms-files
    315 
    316       - name: Run external HTTP tests
    317         if: ${{ ! matrix.multisite && ! matrix.split_slow }}
    318         run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --group external-http
    319 
    320       - name: Checkout the WordPress Test Reporter
    321         if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }}
    322         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    323         with:
    324           repository: 'WordPress/phpunit-test-runner'
    325           path: 'test-runner'
    326 
    327       - name: Set up the Git repository
    328         if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }}
    329         run: |
    330           git init
    331           git remote add origin https://github.com/WordPress/wordpress-develop.git
    332           git fetch
    333           git reset origin/trunk
    334 
    335       - name: Submit test results to the WordPress.org host test results
    336         if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }}
    337         env:
    338           WPT_REPORT_API_KEY: "${{ secrets.WPT_REPORT_API_KEY }}"
    339         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
     133    with:
     134      os: ${{ matrix.os }}
     135      php: ${{ matrix.php }}
     136      phpunit: ${{ matrix.phpunit && matrix.phpunit || matrix.php }}
     137      multisite: ${{ matrix.multisite }}
     138      split_slow: ${{ matrix.split_slow }}
     139      memcached: ${{ matrix.memcached }}
     140      phpunit-config: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }}
    340141
    341142  slack-notifications:
    342143    name: Slack Notifications
    343144    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
    344     needs: [ setup-wordpress, test-php ]
     145    permissions:
     146      actions: read
     147      contents: read
     148    needs: [ test-php ]
    345149    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
    346150    with:
     
    355159    name: Failed workflow tasks
    356160    runs-on: ubuntu-latest
     161
     162
    357163    needs: [ test-php, slack-notifications ]
    358164    if: |
     
    367173    steps:
    368174      - name: Dispatch workflow run
    369         uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
     175        uses: actions/github-script@
    370176        with:
    371177          retries: 2
  • branches/5.1/.github/workflows/test-build-processes.yml

    r58625 r58626  
    1 name: Test npm
     1name: Test
    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 NodeJS.
    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
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
    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: Set up 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 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 NodeJS.
    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: Set up 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: [ '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: ${{ ' }}
    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        ||
     117       
    175118      )
    176119
    177120    steps:
    178121      - name: Dispatch workflow run
    179         uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
     122        uses: actions/github-script@
    180123        with:
    181124          retries: 2
  • branches/5.1/.gitignore

    r44517 r58626  
    1010/.phpcs.xml
    1111/phpcs.xml
     12
    1213/tests/phpunit/data/plugins/wordpress-importer
    1314/tests/phpunit/data/.trac-ticket-cache*
  • branches/5.1/docker-compose.yml

    r55524 r58626  
    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-false}
     42      ${LOCAL_PHP_MEMCACHED-false}
     43      ${PHP_FPM_UID-1000}
     44      ${PHP_FPM_GID-1000}
    4445
    4546    volumes:
     
    4748      - ./:/var/www
    4849
    49     depends_on:
    50       - mysql
     50   
     51   
    5152
    5253  ##
     
    5455  ##
    5556  mysql:
    56     image: amd64/${LOCAL_DB_TYPE-mysql}:${LOCAL_DB_VERSION-5.7}
     57    image: ${LOCAL_DB_TYPE-mysql}:${LOCAL_DB_VERSION-5.7}
     58    platform: linux/amd64
    5759
    5860    networks:
     
    7274    command: --default-authentication-plugin=mysql_native_password
    7375
     76
     77
     78
     79
     80
     81
    7482  ##
    7583  # The WP CLI container.
     
    8290
    8391    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}
     92      ${LOCAL_PHP_XDEBUG-false}
     93      ${LOCAL_PHP_MEMCACHED-false}
     94      ${PHP_FPM_UID-1000}
     95      ${PHP_FPM_GID-1000}
    8896
    8997    volumes:
     
    92100    # The init directive ensures the command runs with a PID > 1, so Ctrl+C works correctly.
    93101    init: true
     102
     103
     104
     105
     106
     107
    94108
    95109  ##
     
    103117
    104118    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}
    113       GITHUB_REF: ${GITHUB_REF-false}
    114       GITHUB_EVENT_NAME: ${GITHUB_EVENT_NAME-false}
     119      ${LOCAL_PHP_XDEBUG-false}
     120      ${LOCAL_PHP_MEMCACHED-false}
     121      ${LOCAL_DIR-src}
     122      ${WP_MULTISITE-false}
     123      ${PHP_FPM_UID-1000}
     124      ${PHP_FPM_GID-1000}
     125      ${TRAVIS_BRANCH-false}
     126      ${TRAVIS_PULL_REQUEST-false}
     127      ${GITHUB_REF-false}
     128      ${GITHUB_EVENT_NAME-false}
    115129
    116130    volumes:
  • branches/5.1/phpcs.xml.dist

    r44574 r58626  
    22<ruleset name="WordPress Coding Standards">
    33    <description>Apply WordPress Coding Standards to all Core files</description>
     4
     5
    46
    57    <rule ref="WordPress-Core"/>
  • branches/5.1/tools/local-env/scripts/docker.js

    r49528 r58626  
    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 dockercompose command passed to this script.
     8execSync( 'dockercompose ' + process.argv.slice( 2 ).join( ' ' ), { stdio: 'inherit' } );
  • branches/5.1/tools/local-env/scripts/install.js

    r50306 r58626  
    4646 */
    4747function wp_cli( cmd ) {
    48     execSync( `docker-compose run --rm cli ${cmd}`, { stdio: 'inherit' } );
     48    execSync( `dockercompose 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( `dockercompose 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.1/tools/local-env/scripts/start.js

    r49528 r58626  
    66
    77// Start the local-env containers.
    8 execSync( 'docker-compose up -d wordpress-develop', { stdio: 'inherit' } );
     8execSync( 'dockercompose up -d wordpress-develop', { stdio: 'inherit' } );
    99
    1010// 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.