Make WordPress Core

Changeset 58597

Timestamp:
06/28/2024 06:40:36 PM (5 weeks ago)
Author:
desrosj
Message:

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

This updates the 5.8 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).
  • Cache the results of PHP_CodeSniffer runs (#49783).

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

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

Location:
branches/5.8
Files:
2 added
1 deleted
13 edited
1 moved

Legend:

Unmodified
Added
Removed
  • branches/5.8

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

    r55517 r58597  
    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.
    57   # - Ensures version-controlled files are not modified or deleted.
    58   # - todo: Configure Slack notifications for failing scans.
    5949  phpcs:
    6050    name: PHP coding standards
    61     runs-on: ubuntu-latest
    62     timeout-minutes: 20
     51    uses: WordPress/wordpress-develop/.github/workflows/reusable-coding-standards-php.yml@trunk
     52    permissions:
     53      contents: read
    6354    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    64 
    65     steps:
    66       - name: Checkout repository
    67         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    68 
    69       - name: Set up PHP
    70         uses: shivammathur/setup-php@d30ad8b1843ace22e6698ab99bbafaa747b6bd0d # v2.24.0
    71         with:
    72           php-version: '7.4'
    73           coverage: none
    74           tools: composer, cs2pr
    75 
    76       - name: Log debug information
    77         run: |
    78           php --version
    79           composer --version
    80 
    81       - name: Install Composer dependencies
    82         uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
    83         with:
    84           composer-options: "--no-progress --no-ansi"
    85 
    86       - name: Make Composer packages available globally
    87         run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
    88 
    89       - name: Log PHPCS debug information
    90         run: phpcs -i
    91 
    92       - name: Run PHPCS on all Core files
    93         run: phpcs -q -n --report=checkstyle | cs2pr
    94 
    95       - name: Check test suite files for warnings
    96         run: phpcs tests -q --report=checkstyle | cs2pr
    97 
    98       - name: Ensure version-controlled files are not modified during the tests
    99         run: git diff --exit-code
     55    with:
     56      php-version: '7.4'
    10057
    10158  # Runs the JavaScript coding standards checks.
    102   #
    103   # JSHint violations are not currently reported inline with annotations.
    104   #
    105   # Performs the following steps:
    106   # - Checks out the repository.
    107   # - Logs debug information about the GitHub Action runner.
    108   # - Installs Node.js.
    109   # - Logs updated debug information.
    110   # _ Installs npm dependencies.
    111   # - Run the WordPress JSHint checks.
    112   # - Ensures version-controlled files are not modified or deleted.
    11359  jshint:
    11460    name: JavaScript coding standards
    115     runs-on: ubuntu-latest
    116     timeout-minutes: 20
     61    uses: WordPress/wordpress-develop/.github/workflows/reusable-coding-standards-javascript.yml@trunk
     62    permissions:
     63      contents: read
    11764    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    118     env:
    119       PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
    120 
    121     steps:
    122       - name: Checkout repository
    123         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    124 
    125       - name: Log debug information
    126         run: |
    127           npm --version
    128           node --version
    129           git --version
    130           svn --version
    131 
    132       - name: Install Node.js
    133         uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
    134         with:
    135           node-version-file: '.nvmrc'
    136           cache: npm
    137 
    138       - name: Log debug information
    139         run: |
    140           npm --version
    141           node --version
    142 
    143       - name: Install Dependencies
    144         run: npm ci
    145 
    146       - name: Run JSHint
    147         run: npm run grunt jshint
    148 
    149       - name: Ensure version-controlled files are not modified or deleted
    150         run: git diff --exit-code
    15165
    15266  slack-notifications:
    15367    name: Slack Notifications
    15468    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
     69
     70
     71
    15572    needs: [ phpcs, jshint ]
    15673    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
     
    16683    name: Failed workflow tasks
    16784    runs-on: ubuntu-latest
     85
     86
    16887    needs: [ phpcs, jshint, slack-notifications ]
    16988    if: |
     
    17695        needs.jshint.result == 'cancelled' || needs.jshint.result == 'failure'
    17796      )
    178 
    17997    steps:
    18098      - name: Dispatch workflow run
    181         uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
     99        uses: actions/github-script@
    182100        with:
    183101          retries: 2
  • branches/5.8/.github/workflows/end-to-end-tests.yml

    r55517 r58597  
    2727  cancel-in-progress: true
    2828
     29
     30
     31
     32
    2933env:
    3034  LOCAL_DIR: build
     
    3236jobs:
    3337  # Runs the end-to-end test suite.
    34   #
    35   # Performs the following steps:
    36   # - Sets environment variables.
    37   # - Checks out the repository.
    38   # - Logs debug information about the GitHub Action runner.
    39   # - Installs Node.js.
    40   # _ Installs npm dependencies.
    41   # - Builds WordPress to run from the `build` directory.
    42   # - Starts the WordPress Docker container.
    43   # - Logs general debug information.
    44   # - Logs the running Docker containers.
    45   # - Logs Docker debug information (about both the Docker installation within the runner and the WordPress container).
    46   # - Install WordPress within the Docker container.
    47   # - Run the E2E tests.
    48   # - Ensures version-controlled files are not modified or deleted.
    4938  e2e-tests:
    50     name: E2E Tests
    51     runs-on: ubuntu-latest
    52     timeout-minutes: 20
     39    name: Test with SCRIPT_DEBUG ${{ matrix.LOCAL_SCRIPT_DEBUG && 'enabled' || 'disabled' }}
     40    uses: WordPress/wordpress-develop/.github/workflows/reusable-end-to-end-tests.yml@trunk
     41    permissions:
     42      contents: read
    5343    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    54 
    55     steps:
    56       - name: Configure environment variables
    57         run: |
    58           echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV
    59           echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV
    60 
    61       - name: Checkout repository
    62         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    63 
    64       - name: Log debug information
    65         run: |
    66           npm --version
    67           node --version
    68           curl --version
    69           git --version
    70           svn --version
    71           php --version
    72           php -i
    73           locale -a
    74 
    75       - name: Install Node.js
    76         uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
    77         with:
    78           node-version-file: '.nvmrc'
    79           cache: npm
    80 
    81       - name: Install Dependencies
    82         run: npm ci
    83 
    84       - name: Build WordPress
    85         run: npm run build
    86 
    87       - name: Start Docker environment
    88         run: |
    89           npm run env:start
    90 
    91       - name: General debug information
    92         run: |
    93           npm --version
    94           node --version
    95           curl --version
    96           git --version
    97           svn --version
    98 
    99       - name: Log running Docker containers
    100         run: docker ps -a
    101 
    102       - name: Docker debug information
    103         run: |
    104           docker -v
    105           docker-compose -v
    106           docker-compose run --rm mysql mysql --version
    107           docker-compose run --rm php php --version
    108           docker-compose run --rm php php -m
    109           docker-compose run --rm php php -i
    110           docker-compose run --rm php locale -a
    111 
    112       - name: Install WordPress
    113         run: npm run env:install
    114 
    115       - name: Run E2E tests
    116         run: npm run test:e2e
    117 
    118       - name: Ensure version-controlled files are not modified or deleted
    119         run: git diff --exit-code
    120 
    121   slack-notifications:
    122     name: Slack Notifications
    123     uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
    124     needs: [ e2e-tests ]
    125     if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
     44    strategy:
     45      fail-fast: false
     46      matrix:
     47        LOCAL_SCRIPT_DEBUG: [ true, false ]
    12648    with:
    127       calling_status: ${{ needs.e2e-tests.result == 'success' && 'success' || needs.e2e-tests.result == 'cancelled' && 'cancelled' || 'failure' }}
    128     secrets:
    129       SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
    130       SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
    131       SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
    132       SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
     49      LOCAL_SCRIPT_DEBUG: ${{ matrix.LOCAL_SCRIPT_DEBUG }}
     50      php-version: '8.0'
     51      install-gutenberg: false
    13352
    13453  failed-workflow:
    13554    name: Failed workflow tasks
    13655    runs-on: ubuntu-latest
    137     needs: [ e2e-tests, slack-notifications ]
     56    permissions:
     57      actions: write
     58    needs: [ e2e-tests ]
    13859    if: |
    13960      always() &&
     
    14465        needs.e2e-tests.result == 'cancelled' || needs.e2e-tests.result == 'failure'
    14566      )
    146 
    14767    steps:
    14868      - name: Dispatch workflow run
    149         uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
     69        uses: actions/github-script@
    15070        with:
    15171          retries: 2
  • branches/5.8/.github/workflows/javascript-tests.yml

    r55517 r58597  
    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 Node.js.
    48   # - Logs updated debug information.
    49   # _ Installs npm dependencies.
    50   # - Run the WordPress QUnit tests.
    51   # - Ensures version-controlled files are not modified or deleted.
     46  # Runs the WordPress Core JavaScript tests.
    5247  test-js:
    5348    name: QUnit Tests
    54     runs-on: ubuntu-latest
    55     timeout-minutes: 20
     49    uses: WordPress/wordpress-develop/.github/workflows/reusable-javascript-tests.yml@trunk
     50    permissions:
     51      contents: read
    5652    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: Log debug information
    63         run: |
    64           npm --version
    65           node --version
    66           git --version
    67           svn --version
    68 
    69       - name: Install Node.js
    70         uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
    71         with:
    72           node-version-file: '.nvmrc'
    73           cache: npm
    74 
    75       - name: Log debug information
    76         run: |
    77           npm --version
    78           node --version
    79 
    80       - name: Install Dependencies
    81         run: npm ci
    82 
    83       - name: Run QUnit tests
    84         run: npm run grunt qunit:compiled
    85 
    86       - name: Ensure version-controlled files are not modified or deleted
    87         run: git diff --exit-code
    8853
    8954  slack-notifications:
    9055    name: Slack Notifications
    9156    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
     57
     58
     59
    9260    needs: [ test-js ]
    9361    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
    9462    with:
    95       calling_status: ${{ needs.test-js.result == 'success' && 'success' || needs.test-js.result == 'cancelled' && 'cancelled' || 'failure' }}
     63      calling_status: ${{ ' }}
    9664    secrets:
    9765      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
     
    10371    name: Failed workflow tasks
    10472    runs-on: ubuntu-latest
    105     needs: [ test-js, slack-notifications ]
     73    permissions:
     74      actions: write
     75    needs: [ slack-notifications ]
    10676    if: |
    10777      always() &&
     
    11080      github.run_attempt < 2 &&
    11181      (
    112         needs.test-js.result == 'cancelled' || needs.test-js.result == 'failure'
     82        contains( needs.*.result, 'cancelled' ) ||
     83        contains( needs.*.result, 'failure' )
    11384      )
    11485
    11586    steps:
    11687      - name: Dispatch workflow run
    117         uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
     88        uses: actions/github-script@
    11889        with:
    11990          retries: 2
  • branches/5.8/.github/workflows/php-compatibility.yml

    r55517 r58597  
    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 ompatibility 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
     39
     40
     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.
    52   # - Ensures version-controlled files are not modified or deleted.
    53   # - todo: Configure Slack notifications for failing scans.
    5444  php-compatibility:
    5545    name: Check PHP compatibility
    56     runs-on: ubuntu-latest
    57     timeout-minutes: 20
     46    uses: WordPress/wordpress-develop/.github/workflows/reusable-php-compatibility.yml@trunk
     47    permissions:
     48      contents: read
    5849    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    59 
    60     steps:
    61       - name: Checkout repository
    62         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    63 
    64       - name: Set up PHP
    65         uses: shivammathur/setup-php@d30ad8b1843ace22e6698ab99bbafaa747b6bd0d # v2.24.0
    66         with:
    67           php-version: '7.4'
    68           coverage: none
    69           tools: composer, cs2pr
    70 
    71       - name: Log debug information
    72         run: |
    73           php --version
    74           composer --version
    75 
    76       # This date is used to ensure that the PHP compatibility cache is cleared at least once every week.
    77       # http://man7.org/linux/man-pages/man1/date.1.html
    78       - name: "Get last Monday's date"
    79         id: get-date
    80         run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> $GITHUB_OUTPUT
    81 
    82       - name: Cache PHP compatibility scan cache
    83         uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
    84         with:
    85           path: .cache/phpcompat.json
    86           key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcompat-cache-${{ hashFiles('**/composer.json', 'phpcompat.xml.dist') }}
    87 
    88       - name: Install Composer dependencies
    89         uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
    90         with:
    91           composer-options: "--no-progress --no-ansi"
    92 
    93       - name: Make Composer packages available globally
    94         run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
    95 
    96       - name: Log PHPCS debug information
    97         run: phpcs -i
    98 
    99       - name: Run PHP compatibility tests
    100         run: phpcs --standard=phpcompat.xml.dist -q --report=checkstyle | cs2pr
    101 
    102       - name: Ensure version-controlled files are not modified or deleted
    103         run: git diff --exit-code
     50    with:
     51      php-version: '7.4'
    10452
    10553  slack-notifications:
    10654    name: Slack Notifications
    10755    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
     56
     57
     58
    10859    needs: [ php-compatibility ]
    10960    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
     
    11970    name: Failed workflow tasks
    12071    runs-on: ubuntu-latest
     72
     73
    12174    needs: [ php-compatibility, slack-notifications ]
    12275    if: |
     
    13184    steps:
    13285      - name: Dispatch workflow run
    133         uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
     86        uses: actions/github-script@
    13487        with:
    13588          retries: 2
  • branches/5.8/.github/workflows/phpunit-tests.yml

    r55517 r58597  
    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   # - Ensures version-controlled files are not modified or deleted.
    56   # - Checks out the WordPress Test reporter repository.
    57   # - Reconnect the directory to the Git repository.
    58   # - Submit the test results to the WordPress.org host test results.
     34  # Creates PHPUnit test jobs.
    5935  test-php:
    60     name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
    61     runs-on: ${{ matrix.os }}
    62     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
    6341    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    6442    strategy:
    6543      fail-fast: false
    6644      matrix:
     45
    6746        php: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0' ]
    68         os: [ ubuntu-latest ]
     47        multisite: [ false, true ]
     48        split_slow: [ false ]
    6949        memcached: [ false ]
    70         split_slow: [ false ]
    71         multisite: [ false, true ]
    7250        include:
    7351          # Additional "slow" jobs for PHP 5.6.
     
    9775            multisite: false
    9876            report: true
    99     env:
    100       LOCAL_PHP: ${{ matrix.php }}-fpm
    101       LOCAL_PHP_MEMCACHED: ${{ matrix.memcached }}
    102       PHPUNIT_CONFIG: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }}
    103 
    104     steps:
    105       - name: Configure environment variables
    106         run: |
    107           echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV
    108           echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV
    109 
    110       - name: Checkout repository
    111         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    112 
    113       - name: Install Node.js
    114         uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
    115         with:
    116           node-version-file: '.nvmrc'
    117           cache: npm
    118 
    119       - name: Install npm dependencies
    120         run: npm ci
    121 
    122       - name: Get composer cache directory
    123         id: composer-cache
    124         run: echo "composer_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
    125 
    126       - name: Cache Composer dependencies
    127         uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # v3.0.11
    128         env:
    129           cache-name: cache-composer-dependencies
    130         with:
    131           path: ${{ steps.composer-cache.outputs.composer_dir }}
    132           key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
    133 
    134       - name: Install Composer dependencies
    135         run: |
    136           docker-compose run --rm php composer --version
    137 
    138           # The PHPUnit 7.x phar is not compatible with PHP 8 and won't be updated,
    139           # as PHPUnit 7 is no longer supported. The Composer-installed PHPUnit should be
    140           # used for PHP 8 testing instead.
    141           if [ ${{ env.LOCAL_PHP }} == '8.0-fpm' ]; then
    142             docker-compose run --rm php composer install --ignore-platform-reqs
    143             echo "PHPUNIT_SCRIPT=php-composer" >> $GITHUB_ENV
    144           elif [ ${{ env.LOCAL_PHP }} == '7.1-fpm' ]; then
    145             docker-compose run --rm php composer update
    146             git checkout -- composer.lock
    147           elif [[ ${{ env.LOCAL_PHP }} == '5.6-fpm' || ${{ env.LOCAL_PHP }} == '7.0-fpm' ]]; then
    148             docker-compose run --rm php composer require --dev phpunit/phpunit:"^5.7" --update-with-dependencies
    149             git checkout -- composer.lock composer.json
    150           else
    151             docker-compose run --rm php composer install
    152           fi
    153 
    154       - name: Docker debug information
    155         run: |
    156           docker -v
    157           docker-compose -v
    158 
    159       - name: Start Docker environment
    160         run: |
    161           npm run env:start
    162 
    163       # The memcached server needs to start after the Docker network has been set up with `npm run env:start`.
    164       - name: Start the Memcached server.
    165         if: ${{ matrix.memcached }}
    166         run: |
    167           cp tests/phpunit/includes/object-cache.php src/wp-content/object-cache.php
    168           docker run --name memcached --net $(basename "$PWD")_wpdevnet -d memcached
    169 
    170       - name: General debug information
    171         run: |
    172           npm --version
    173           node --version
    174           curl --version
    175           git --version
    176           svn --version
    177 
    178       - name: Log running Docker containers
    179         run: docker ps -a
    180 
    181       - name: WordPress Docker container debug information
    182         run: |
    183           docker-compose run --rm mysql mysql --version
    184           docker-compose run --rm php php --version
    185           docker-compose run --rm php php -m
    186           docker-compose run --rm php php -i
    187           docker-compose run --rm php locale -a
    188 
    189       - name: Install WordPress
    190         run: npm run env:install
    191 
    192       - name: Run slow PHPUnit tests
    193         if: ${{ matrix.split_slow }}
    194         run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }}
    195 
    196       - name: Run PHPUnit tests for single site excluding slow tests
    197         if: ${{ matrix.php < '7.0' && ! matrix.split_slow && ! matrix.multisite }}
    198         run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-required
    199 
    200       - name: Run PHPUnit tests for Multisite excluding slow tests
    201         if: ${{ matrix.php < '7.0' && ! matrix.split_slow && matrix.multisite }}
    202         run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-excluded,oembed-headers
    203 
    204       - name: Run PHPUnit tests
    205         if: ${{ matrix.php >= '7.0' }}
    206         run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }}
    207 
    208       - name: Run AJAX tests
    209         if: ${{ ! matrix.split_slow }}
    210         run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax
    211 
    212       - name: Run ms-files tests as a multisite install
    213         if: ${{ matrix.multisite && ! matrix.split_slow }}
    214         run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml --group ms-files
    215 
    216       - name: Run external HTTP tests
    217         if: ${{ ! matrix.multisite && ! matrix.split_slow }}
    218         run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --group external-http
    219 
    220       # __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
    221       - name: Run (xDebug) tests
    222         if: ${{ ! matrix.split_slow }}
    223         run: LOCAL_PHP_XDEBUG=true npm run test:${{ env.PHPUNIT_SCRIPT }} -- -v --group xdebug --exclude-group __fakegroup__
    224 
    225       - name: Ensure version-controlled files are not modified or deleted
    226         run: git diff --exit-code
    227 
    228       - name: Checkout the WordPress Test Reporter
    229         if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }}
    230         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    231         with:
    232           repository: 'WordPress/phpunit-test-runner'
    233           path: 'test-runner'
    234 
    235       - name: Submit test results to the WordPress.org host test results
    236         if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }}
    237         env:
    238           WPT_REPORT_API_KEY: "${{ secrets.WPT_REPORT_API_KEY }}"
    239         run: docker-compose run --rm -e WPT_REPORT_API_KEY -e WPT_PREPARE_DIR=/var/www -e WPT_TEST_DIR=/var/www php php test-runner/report.php
     77    with:
     78      os: ${{ matrix.os }}
     79      php: ${{ matrix.php }}
     80      multisite: ${{ matrix.multisite }}
     81      split_slow: ${{ matrix.split_slow }}
     82      memcached: ${{ matrix.memcached }}
     83      phpunit-config: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }}
     84      report: ${{ matrix.report || false }}
    24085
    24186  slack-notifications:
    24287    name: Slack Notifications
    24388    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
     89
     90
     91
    24492    needs: [ test-php ]
    24593    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
    24694    with:
    247       calling_status: ${{ needs.test-php.result == 'success' && 'success' || needs.test-php.result == 'cancelled' && 'cancelled' || 'failure' }}
     95      calling_status: ${{ ' }}
    24896    secrets:
    24997      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
     
    255103    name: Failed workflow tasks
    256104    runs-on: ubuntu-latest
    257     needs: [ test-php, slack-notifications ]
     105    permissions:
     106      actions: write
     107    needs: [ slack-notifications ]
    258108    if: |
    259109      always() &&
     
    262112      github.run_attempt < 2 &&
    263113      (
    264         needs.test-php.result == 'cancelled' || needs.test-php.result == 'failure'
     114        contains( needs.*.result, 'cancelled' ) ||
     115        contains( needs.*.result, 'failure' )
    265116      )
    266117
    267118    steps:
    268119      - name: Dispatch workflow run
    269         uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
     120        uses: actions/github-script@
    270121        with:
    271122          retries: 2
  • branches/5.8/.github/workflows/test-build-processes.yml

    r58596 r58597  
    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 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   # - Ensures version-controlled files are not modified or deleted.
    50   # - Builds WordPress to run from the `src` directory.
    51   # - Cleans up after building WordPress to the `src` directory.
    52   # - Ensures version-controlled files are not modified or deleted.
    53   test-npm:
    54     name: Test npm on ${{ matrix.os }}
    55     runs-on: ${{ matrix.os }}
    56     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
    5747    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    5848    strategy:
     
    6050      matrix:
    6151        os: [ ubuntu-latest, windows-latest ]
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
    6263
    63     steps:
    64       - name: Checkout repository
    65         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    66 
    67       - name: Log debug information
    68         run: |
    69           npm --version
    70           node --version
    71           curl --version
    72           git --version
    73           svn --version
    74 
    75       - name: Install Node.js
    76         uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
    77         with:
    78           node-version-file: '.nvmrc'
    79           cache: npm
    80 
    81       - name: Install Dependencies
    82         run: npm ci
    83 
    84       - name: Build WordPress
    85         run: npm run build
    86 
    87       - name: Clean after building
    88         run: npm run grunt clean
    89 
    90       - name: Ensure version-controlled files are not modified or deleted during building and cleaning
    91         run: git diff --exit-code
    92 
    93   # Verifies that installing npm dependencies and building WordPress works as expected on MacOS.
     64  # Tests the WordPress Core build process on MacOS.
    9465  #
    95   # 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.
    9667  # This avoids unintentionally consuming excessive minutes, as MacOS jobs consume minutes at a 10x rate.
    9768  #
     
    9970  # currently no way to determine the OS being used on a given job.
    10071  # See https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability.
    101   #
    102   # Performs the following steps:
    103   # - Checks out the repository.
    104   # - Logs debug information about the GitHub Action runner.
    105   # - Installs Node.js.
    106   # _ Installs npm dependencies.
    107   # - Builds WordPress to run from the `build` directory.
    108   # - Cleans up after building WordPress to the `build` directory.
    109   # - Ensures version-controlled files are not modified or deleted.
    110   # - Builds WordPress to run from the `src` directory.
    111   # - Cleans up after building WordPress to the `src` directory.
    112   # - Ensures version-controlled files are not modified or deleted.
    113   test-npm-macos:
    114     name: Test npm on MacOS
    115     runs-on: macos-latest
    116     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
    11777    if: ${{ github.repository == 'WordPress/wordpress-develop' }}
    118     steps:
    119       - name: Checkout repository
    120         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    121 
    122       - name: Log debug information
    123         run: |
    124           npm --version
    125           node --version
    126           curl --version
    127           git --version
    128           svn --version
    129 
    130       - name: Install Node.js
    131         uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
    132         with:
    133           node-version-file: '.nvmrc'
    134           cache: npm
    135 
    136       - name: Install Dependencies
    137         run: npm ci
    138 
    139       - name: Build WordPress
    140         run: npm run build
    141 
    142       - name: Clean after building
    143         run: npm run grunt clean
    144 
    145       - name: Ensure version-controlled files are not modified or deleted during building and cleaning
    146         run: git diff --exit-code
    147 
    148       - name: Build WordPress in /src
    149         run: npm run build:dev
    150 
    151       - name: Clean after building in /src
    152         run: npm run grunt clean -- --dev
    153 
    154       - name: Ensure version-controlled files are not modified or deleted during building and cleaning
    155         run: git diff --exit-code
     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
    15687
    15788  slack-notifications:
    15889    name: Slack Notifications
    15990    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
    160     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 ]
    16195    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
    16296    with:
    163       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: ${{ ' }}
    16498    secrets:
    16599      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
     
    171105    name: Failed workflow tasks
    172106    runs-on: ubuntu-latest
    173     needs: [ test-npm, test-npm-macos, slack-notifications ]
     107    permissions:
     108      actions: write
     109    needs: [ slack-notifications ]
    174110    if: |
    175111      always() &&
     
    178114      github.run_attempt < 2 &&
    179115      (
    180         needs.test-npm.result == 'cancelled' || needs.test-npm.result == 'failure' ||
    181         needs.test-npm-macos.result == 'cancelled' || needs.test-npm-macos.result == 'failure'
     116        ||
     117       
    182118      )
    183119
    184120    steps:
    185121      - name: Dispatch workflow run
    186         uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
     122        uses: actions/github-script@
    187123        with:
    188124          retries: 2
  • branches/5.8/.gitignore

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

    r55517 r58597  
    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  ##
     
    3940    environment:
    4041      - LOCAL_PHP_XDEBUG=${LOCAL_PHP_XDEBUG-false}
     42
    4143      - LOCAL_PHP_MEMCACHED=${LOCAL_PHP_MEMCACHED-false}
    4244      - PHP_FPM_UID=${PHP_FPM_UID-1000}
     
    4749      - ./:/var/www
    4850
    49     depends_on:
    50       - mysql
     51    # Copy or delete the Memcached dropin plugin file as appropriate.
     52    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"
     53
     54    # The init directive ensures the command runs with a PID > 1, so Ctrl+C works correctly.
     55    init: true
     56
     57    extra_hosts:
     58      - localhost:host-gateway
    5159
    5260  ##
     
    5462  ##
    5563  mysql:
    56     image: amd64/${LOCAL_DB_TYPE-mysql}:${LOCAL_DB_VERSION-latest}
     64    image: ${LOCAL_DB_TYPE-mysql}:${LOCAL_DB_VERSION-latest}
     65    platform: linux/amd64
    5766
    5867    networks:
     
    7180    # For compatibility with PHP versions that don't support the caching_sha2_password auth plugin used in MySQL 8.0.
    7281    command: --default-authentication-plugin=mysql_native_password
     82
     83
     84
     85
     86
     87
    7388
    7489  ##
     
    92107    # The init directive ensures the command runs with a PID > 1, so Ctrl+C works correctly.
    93108    init: true
     109
     110
     111
     112
     113
     114
     115
     116
     117
    94118
    95119  ##
     
    121145
    122146    depends_on:
    123       - mysql
     147      php:
     148        condition: service_started
     149      mysql:
     150        condition: service_healthy
     151
     152  ##
     153  # The Memcached container.
     154  ##
     155  memcached:
     156    image: memcached
     157
     158    networks:
     159      - wpdevnet
     160
     161    ports:
     162      - 11211:11211
     163
     164    depends_on:
     165      php:
     166        condition: service_started
    124167
    125168volumes:
  • branches/5.8/phpcompat.xml.dist

    r47902 r58597  
    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"/>
    1515
    1616    <!-- Set the memory limit to 256M.
  • branches/5.8/phpcs.xml.dist

    r51122 r58597  
    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"/>
    1010
    1111    <!-- Set the memory limit to 256M.
  • branches/5.8/tools/local-env/scripts/docker.js

    r49362 r58597  
    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.8/tools/local-env/scripts/install.js

    r51179 r58597  
    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 testPluginDirectory = 'tests/phpunit/data/plugins/wordpress-importer';
    5656
    57     execSync( `docker-compose exec -T php rm -rf ${testPluginDirectory}`, { stdio: 'inherit' } );
    58     execSync( `docker-compose exec -T php git clone https://github.com/WordPress/wordpress-importer.git ${testPluginDirectory} --depth=1`, { stdio: 'inherit' } );
     57    execSync( `dockercompose exec -T php rm -rf ${testPluginDirectory}`, { stdio: 'inherit' } );
     58    execSync( `dockercompose exec -T php git clone https://github.com/WordPress/wordpress-importer.git ${testPluginDirectory} --depth=1`, { stdio: 'inherit' } );
    5959}
  • branches/5.8/tools/local-env/scripts/start.js

    r49362 r58597  
    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.