Make WordPress Core

Changeset 58357

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

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

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

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

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

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

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

Location:
branches/6.0
Files:
9 edited
1 moved

Legend:

Unmodified
Added
Removed
  • branches/6.0/.github/workflows/coding-standards.yml

    r55490 r58357  
    1010      - '[4-9].[0-9]'
    1111    tags:
    12       - '3.[89]*'
    13       - '[4-9].[0-9]*'
     12      - '[0-9]+.[0-9]'
     13      - '[0-9]+.[0-9].[0-9]+'
     14      - '!3.7.[0-9]+'
    1415  pull_request:
    1516    branches:
     
    4041  cancel-in-progress: true
    4142
     43
     44
     45
     46
    4247jobs:
    4348  # Runs PHP coding standards checks.
    44   #
    45   # Violations are reported inline with annotations.
    46   #
    47   # Performs the following steps:
    48   # - Checks out the repository.
    49   # - Sets up PHP.
    50   # - Configures caching for PHPCS scans.
    51   # - Installs Composer dependencies.
    52   # - Make Composer packages available globally.
    53   # - Runs PHPCS on the full codebase with warnings suppressed.
    54   # - Generate a report for displaying issues as pull request annotations.
    55   # - Runs PHPCS on the `tests` directory without warnings suppressed.
    56   # - Generate a report for displaying `test` directory issues as pull request annotations.
    57   # - Ensures version-controlled files are not modified or deleted.
    5849  phpcs:
    5950    name: PHP coding standards
    60     runs-on: ubuntu-latest
    61     timeout-minutes: 20
     51    uses: WordPress/wordpress-develop/.github/workflows/reusable-coding-standards-php.yml@trunk
     52    permissions:
     53      contents: read
    6254    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    63 
    64     steps:
    65       - name: Checkout repository
    66         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    67 
    68       - name: Set up PHP
    69         uses: shivammathur/setup-php@d30ad8b1843ace22e6698ab99bbafaa747b6bd0d # v2.24.0
    70         with:
    71           php-version: '7.4'
    72           coverage: none
    73           tools: cs2pr
    74 
    75       # This date is used to ensure that the PHPCS cache is cleared at least once every week.
    76       # http://man7.org/linux/man-pages/man1/date.1.html
    77       - name: "Get last Monday's date"
    78         id: get-date
    79         run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> $GITHUB_OUTPUT
    80 
    81       - name: Cache PHPCS scan cache
    82         uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
    83         with:
    84           path: |
    85             .cache/phpcs-src.json
    86             .cache/phpcs-tests.json
    87           key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcs-cache-${{ hashFiles('**/composer.json', 'phpcs.xml.dist') }}
    88 
    89       # Since Composer dependencies are installed using `composer update` and no lock file is in version control,
    90       # passing a custom cache suffix ensures that the cache is flushed at least once per week.
    91       - name: Install Composer dependencies
    92         uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
    93         with:
    94           custom-cache-suffix: ${{ steps.get-date.outputs.date }}
    95 
    96       - name: Make Composer packages available globally
    97         run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
    98 
    99       - name: Run PHPCS on all Core files
    100         id: phpcs-core
    101         run: phpcs -n --report-full --cache=./.cache/phpcs-src.json --report-checkstyle=./.cache/phpcs-report.xml
    102 
    103       - name: Show PHPCS results in PR
    104         if: ${{ always() && steps.phpcs-core.outcome == 'failure' }}
    105         run: cs2pr ./.cache/phpcs-report.xml
    106 
    107       - name: Check test suite files for warnings
    108         id: phpcs-tests
    109         run: phpcs tests --report-full --cache=./.cache/phpcs-tests.json --report-checkstyle=./.cache/phpcs-tests-report.xml
    110 
    111       - name: Show test suite scan results in PR
    112         if: ${{ always() && steps.phpcs-tests.outcome == 'failure' }}
    113         run: cs2pr ./.cache/phpcs-tests-report.xml
    114 
    115       - name: Ensure version-controlled files are not modified during the tests
    116         run: git diff --exit-code
     55    with:
     56      php-version: '7.4'
    11757
    11858  # Runs the JavaScript coding standards checks.
    119   #
    120   # JSHint violations are not currently reported inline with annotations.
    121   #
    122   # Performs the following steps:
    123   # - Checks out the repository.
    124   # - Sets up Node.js.
    125   # - Logs debug information about the GitHub Action runner.
    126   # - Installs npm dependencies.
    127   # - Run the WordPress JSHint checks.
    128   # - Ensures version-controlled files are not modified or deleted.
    12959  jshint:
    13060    name: JavaScript coding standards
    131     runs-on: ubuntu-latest
    132     timeout-minutes: 20
     61    uses: WordPress/wordpress-develop/.github/workflows/reusable-coding-standards-javascript.yml@trunk
     62    permissions:
     63      contents: read
    13364    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    134     env:
    135       PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
    136 
    137     steps:
    138       - name: Checkout repository
    139         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    140 
    141       - name: Set up Node.js
    142         uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
    143         with:
    144           node-version-file: '.nvmrc'
    145           cache: npm
    146 
    147       - name: Log debug information
    148         run: |
    149           npm --version
    150           node --version
    151           git --version
    152           svn --version
    153 
    154       - name: Install npm Dependencies
    155         run: npm ci
    156 
    157       - name: Run JSHint
    158         run: npm run grunt jshint
    159 
    160       - name: Ensure version-controlled files are not modified or deleted
    161         run: git diff --exit-code
    16265
    16366  slack-notifications:
    16467    name: Slack Notifications
    16568    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
     69
     70
     71
    16672    needs: [ phpcs, jshint ]
    16773    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
     
    17783    name: Failed workflow tasks
    17884    runs-on: ubuntu-latest
     85
     86
    17987    needs: [ phpcs, jshint, slack-notifications ]
    18088    if: |
     
    19098    steps:
    19199      - name: Dispatch workflow run
    192         uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
     100        uses: actions/github-script@
    193101        with:
    194102          retries: 2
  • branches/6.0/.github/workflows/end-to-end-tests.yml

    r57202 r58357  
    99      - '[6-9].[0-9]'
    1010    tags:
    11       - '5.[3-9]*'
    12       - '[6-9].[0-9]*'
     11      - '[0-9]+.[0-9]'
     12      - '[0-9]+.[0-9].[0-9]+'
     13      - '![34].[0-9].[0-9]+'
     14      - '!5.[0-2].[0-9]+'
    1315  pull_request:
    1416    branches:
     
    2527  cancel-in-progress: true
    2628
     29
     30
     31
     32
    2733env:
    2834  LOCAL_DIR: build
    29   LOCAL_PHP: 8.0-fpm
    3035
    3136jobs:
    3237  # Runs the end-to-end test suite.
    33   #
    34   # Performs the following steps:
    35   # - Sets environment variables.
    36   # - Checks out the repository.
    37   # - Sets up Node.js.
    38   # - Logs debug information about the GitHub Action runner.
    39   # - Installs npm dependencies.
    40   # - Builds WordPress to run from the `build` directory.
    41   # - Starts the WordPress Docker container.
    42   # - Logs the running Docker containers.
    43   # - Logs Docker debug information (about both the Docker installation within the runner and the WordPress container).
    44   # - Install WordPress within the Docker container.
    45   # - Run the E2E tests.
    46   # - Ensures version-controlled files are not modified or deleted.
    4738  e2e-tests:
    48     name: E2E Tests
    49     runs-on: ubuntu-latest
    50     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
    5143    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    52 
    53     steps:
    54       - name: Configure environment variables
    55         run: |
    56           echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV
    57           echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV
    58 
    59       - name: Checkout repository
    60         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    61 
    62       - name: Set up Node.js
    63         uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
    64         with:
    65           node-version-file: '.nvmrc'
    66           cache: npm
    67 
    68       - name: Log debug information
    69         run: |
    70           npm --version
    71           node --version
    72           curl --version
    73           git --version
    74           svn --version
    75           locale -a
    76 
    77       - name: Install npm Dependencies
    78         run: npm ci
    79 
    80       - name: Build WordPress
    81         run: npm run build
    82 
    83       - name: Start Docker environment
    84         run: |
    85           npm run env:start
    86 
    87       - name: Log running Docker containers
    88         run: docker ps -a
    89 
    90       - name: Docker debug information
    91         run: |
    92           docker -v
    93           docker-compose -v
    94           docker-compose run --rm mysql mysql --version
    95           docker-compose run --rm php php --version
    96           docker-compose run --rm php php -m
    97           docker-compose run --rm php php -i
    98           docker-compose run --rm php locale -a
    99 
    100       - name: Install WordPress
    101         run: npm run env:install
    102 
    103       - name: Run E2E tests
    104         run: npm run test:e2e
    105 
    106       - name: Ensure version-controlled files are not modified or deleted
    107         run: git diff --exit-code
    108 
    109   slack-notifications:
    110     name: Slack Notifications
    111     uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
    112     needs: [ e2e-tests ]
    113     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 ]
    11448    with:
    115       calling_status: ${{ needs.e2e-tests.result == 'success' && 'success' || needs.e2e-tests.result == 'cancelled' && 'cancelled' || 'failure' }}
    116     secrets:
    117       SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
    118       SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
    119       SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
    120       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
    12152
    12253  failed-workflow:
    12354    name: Failed workflow tasks
    12455    runs-on: ubuntu-latest
    125     needs: [ e2e-tests, slack-notifications ]
     56    permissions:
     57      actions: write
     58    needs: [ e2e-tests ]
    12659    if: |
    12760      always() &&
     
    13265        needs.e2e-tests.result == 'cancelled' || needs.e2e-tests.result == 'failure'
    13366      )
    134 
    13567    steps:
    13668      - name: Dispatch workflow run
    137         uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
     69        uses: actions/github-script@
    13870        with:
    13971          retries: 2
  • branches/6.0/.github/workflows/javascript-tests.yml

    r55482 r58357  
    99      - '[4-9].[0-9]'
    1010    tags:
    11       - '3.[89]*'
    12       - '[4-9].[0-9]*'
     11      - '[0-9]+.[0-9]'
     12      - '[0-9]+.[0-9].[0-9]+'
     13      - '!3.7.[0-9]+'
    1314  pull_request:
    1415    branches:
     
    3839  cancel-in-progress: true
    3940
     41
     42
     43
     44
    4045jobs:
    4146  # Runs the QUnit tests for WordPress.
    42   #
    43   # Performs the following steps:
    44   # - Checks out the repository.
    45   # - Sets up Node.js.
    46   # - Logs debug information about the GitHub Action runner.
    47   # - Installs npm dependencies.
    48   # - Run the WordPress QUnit tests.
    49   # - Ensures version-controlled files are not modified or deleted.
    5047  test-js:
    5148    name: QUnit Tests
    52     runs-on: ubuntu-latest
    53     timeout-minutes: 20
     49    uses: WordPress/wordpress-develop/.github/workflows/reusable-javascript-tests.yml@trunk
     50    permissions:
     51      contents: read
    5452    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    55 
    56     steps:
    57       - name: Checkout repository
    58         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    59 
    60       - name: Set up Node.js
    61         uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
    62         with:
    63           node-version-file: '.nvmrc'
    64           cache: npm
    65 
    66       - name: Log debug information
    67         run: |
    68           npm --version
    69           node --version
    70           git --version
    71           svn --version
    72 
    73       - name: Install npm Dependencies
    74         run: npm ci
    75 
    76       - name: Run QUnit tests
    77         run: npm run grunt qunit:compiled
    78 
    79       - name: Ensure version-controlled files are not modified or deleted
    80         run: git diff --exit-code
    8153
    8254  slack-notifications:
    8355    name: Slack Notifications
    8456    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
     57
     58
     59
    8560    needs: [ test-js ]
    8661    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
     
    9671    name: Failed workflow tasks
    9772    runs-on: ubuntu-latest
     73
     74
    9875    needs: [ test-js, slack-notifications ]
    9976    if: |
     
    10885    steps:
    10986      - name: Dispatch workflow run
    110         uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
     87        uses: actions/github-script@
    11188        with:
    11289          retries: 2
  • branches/6.0/.github/workflows/php-compatibility.yml

    r55490 r58357  
    99      - '[6-9].[0-9]'
    1010    tags:
    11       - '5.[5-9]*'
    12       - '[6-9].[0-9]*'
     11      - '[0-9]+.[0-9]'
     12      - '[0-9]+.[0-9].[0-9]+'
     13      - '![34].[0-9].[0-9]+'
     14      - '!5.[0-4].[0-9]+'
    1315  pull_request:
    1416    branches:
     
    3436  cancel-in-progress: true
    3537
     38
     39
     40
     41
    3642jobs:
    37 
    3843  # Runs PHP compatibility testing.
    39   #
    40   # Violations are reported inline with annotations.
    41   #
    42   # Performs the following steps:
    43   # - Checks out the repository.
    44   # - Sets up PHP.
    45   # - Logs debug information.
    46   # - Configures caching for PHP compatibility scans.
    47   # - Installs Composer dependencies.
    48   # - Make Composer packages available globally.
    49   # - Runs the PHP compatibility tests.
    50   # - Generate a report for displaying issues as pull request annotations.
    51   # - Ensures version-controlled files are not modified or deleted.
    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: cs2pr
    68 
    69       - name: Log debug information
    70         run: |
    71           composer --version
    72 
    73       # This date is used to ensure that the PHP compatibility cache is cleared at least once every week.
    74       # http://man7.org/linux/man-pages/man1/date.1.html
    75       - name: "Get last Monday's date"
    76         id: get-date
    77         run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> $GITHUB_OUTPUT
    78 
    79       - name: Cache PHP compatibility scan cache
    80         uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
    81         with:
    82           path: .cache/phpcompat.json
    83           key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcompat-cache-${{ hashFiles('**/composer.json', 'phpcompat.xml.dist') }}
    84 
    85       # Since Composer dependencies are installed using `composer update` and no lock file is in version control,
    86       # passing a custom cache suffix ensures that the cache is flushed at least once per week.
    87       - name: Install Composer dependencies
    88         uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
    89         with:
    90           custom-cache-suffix: ${{ steps.get-date.outputs.date }}
    91 
    92       - name: Make Composer packages available globally
    93         run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
    94 
    95       - name: Run PHP compatibility tests
    96         id: phpcs
    97         run: phpcs --standard=phpcompat.xml.dist --report-full --report-checkstyle=./.cache/phpcs-compat-report.xml
    98 
    99       - name: Show PHPCompatibility results in PR
    100         if: ${{ always() && steps.phpcs.outcome == 'failure' }}
    101         run: cs2pr ./.cache/phpcs-compat-report.xml
    102 
    103       - name: Ensure version-controlled files are not modified or deleted
    104         run: git diff --exit-code
     50    with:
     51      php-version: '7.4'
    10552
    10653  slack-notifications:
    10754    name: Slack Notifications
    10855    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
     56
     57
     58
    10959    needs: [ php-compatibility ]
    11060    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
     
    12070    name: Failed workflow tasks
    12171    runs-on: ubuntu-latest
     72
     73
    12274    needs: [ php-compatibility, slack-notifications ]
    12375    if: |
     
    13284    steps:
    13385      - name: Dispatch workflow run
    134         uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
     86        uses: actions/github-script@
    13587        with:
    13688          retries: 2
  • branches/6.0/.github/workflows/phpunit-tests.yml

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

    r58356 r58357  
    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   # - Sets up Node.js.
    45   # - Logs debug information about the GitHub Action runner.
    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: Set up Node.js
    68         uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
    69         with:
    70           node-version-file: '.nvmrc'
    71           cache: npm
    72 
    73       - name: Log debug information
    74         run: |
    75           npm --version
    76           node --version
    77           curl --version
    78           git --version
    79           svn --version
    80 
    81       - name: Install npm Dependencies
    82         run: npm ci
    83 
    84       - name: Build WordPress in /src
    85         run: npm run build:dev
    86 
    87       - name: Clean after building in /src
    88         run: npm run grunt clean -- --dev
    89 
    90       - name: Ensure version-controlled files are not modified or deleted during building and cleaning
    91         run: git diff --exit-code
    92 
    93       - name: Build WordPress
    94         run: npm run build
    95 
    96       - name: Clean after building
    97         run: npm run grunt clean
    98 
    99       - name: Ensure version-controlled files are not modified or deleted during building and cleaning
    100         run: git diff --exit-code
    101 
    102   # Verifies that installing npm dependencies and building WordPress works as expected on MacOS.
     64  # Tests the WordPress Core build process on MacOS.
    10365  #
    104   # 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.
    10567  # This avoids unintentionally consuming excessive minutes, as MacOS jobs consume minutes at a 10x rate.
    10668  #
     
    10870  # currently no way to determine the OS being used on a given job.
    10971  # See https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability.
    110   #
    111   # Performs the following steps:
    112   # - Checks out the repository.
    113   # - Sets up Node.js.
    114   # - Logs debug information about the GitHub Action runner.
    115   # - Installs npm dependencies.
    116   # - Builds WordPress to run from the `build` directory.
    117   # - Cleans up after building WordPress to the `build` directory.
    118   # - Ensures version-controlled files are not modified or deleted.
    119   # - Builds WordPress to run from the `src` directory.
    120   # - Cleans up after building WordPress to the `src` directory.
    121   # - Ensures version-controlled files are not modified or deleted.
    122   test-npm-macos:
    123     name: Test npm on MacOS
    124     runs-on: macos-latest
    125     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
    12677    if: ${{ github.repository == 'WordPress/wordpress-develop' }}
    127     steps:
    128       - name: Checkout repository
    129         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    130 
    131       - name: Set up Node.js
    132         uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
    133         with:
    134           node-version-file: '.nvmrc'
    135           cache: npm
    136 
    137       - name: Log debug information
    138         run: |
    139           npm --version
    140           node --version
    141           curl --version
    142           git --version
    143           svn --version
    144 
    145       - name: Install npm Dependencies
    146         run: npm ci
    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
    156 
    157       - name: Build WordPress
    158         run: npm run build
    159 
    160       - name: Clean after building
    161         run: npm run grunt clean
    162 
    163       - name: Ensure version-controlled files are not modified or deleted during building and cleaning
    164         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
    16587
    16688  slack-notifications:
    16789    name: Slack Notifications
    16890    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
    169     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 ]
    17095    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
    17196    with:
    172       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: ${{ ' }}
    17398    secrets:
    17499      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
     
    180105    name: Failed workflow tasks
    181106    runs-on: ubuntu-latest
    182     needs: [ test-npm, test-npm-macos, slack-notifications ]
     107    permissions:
     108      actions: write
     109    needs: [ slack-notifications ]
    183110    if: |
    184111      always() &&
     
    187114      github.run_attempt < 2 &&
    188115      (
    189         needs.test-npm.result == 'cancelled' || needs.test-npm.result == 'failure' ||
    190         needs.test-npm-macos.result == 'cancelled' || needs.test-npm-macos.result == 'failure'
     116        ||
     117       
    191118      )
    192119
    193120    steps:
    194121      - name: Dispatch workflow run
    195         uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
     122        uses: actions/github-script@
    196123        with:
    197124          retries: 2
  • branches/6.0/docker-compose.yml

    r55482 r58357  
    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}
     
    5254    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"
    5355
    54     depends_on:
    55       - mysql
    56 
    5756    # The init directive ensures the command runs with a PID > 1, so Ctrl+C works correctly.
    5857    init: true
     
    6564  ##
    6665  mysql:
    67     image: amd64/${LOCAL_DB_TYPE-mysql}:${LOCAL_DB_VERSION-latest}
     66    image: ${LOCAL_DB_TYPE-mysql}:${LOCAL_DB_VERSION-latest}
     67    platform: linux/amd64
    6868
    6969    networks:
     
    8282    # For compatibility with PHP versions that don't support the caching_sha2_password auth plugin used in MySQL 8.0.
    8383    command: --default-authentication-plugin=mysql_native_password
     84
     85
     86
     87
     88
     89
    8490
    8591  ##
     
    107113      - localhost:host-gateway
    108114
     115
     116
     117
     118
     119
     120
    109121  ##
    110122  # The Memcached container.
     
    119131      - 11211:11211
    120132
     133
     134
     135
     136
    121137volumes:
    122138  # So that sites aren't wiped every time containers are restarted, MySQL uses a persistent volume.
  • branches/6.0/tools/local-env/scripts/docker.js

    r55482 r58357  
    55dotenvExpand.expand( 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/6.0/tools/local-env/scripts/install.js

    r55482 r58357  
    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/6.0/tools/local-env/scripts/start.js

    r55482 r58357  
    99    ? 'wordpress-develop memcached'
    1010    : 'wordpress-develop';
    11 execSync( `docker-compose up -d -- ${containers}`, { stdio: 'inherit' } );
     11execSync( `dockercompose up -d -- ${containers}`, { stdio: 'inherit' } );
    1212
    1313// 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.