Make WordPress Core

Changeset 58358


Ignore:
Timestamp:
06/06/2024 04:34:11 PM (5 weeks ago)
Author:
desrosj
Message:

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

This updates the 5.9 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 5.9 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/5.9
Files:
10 edited
1 moved

Legend:

Unmodified
Added
Removed
  • branches/5.9

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

    r55516 r58358  
    4141  cancel-in-progress: true
    4242
     43# Disable permissions for all available scopes by default.
     44# Any needed permissions should be configured at the job level.
     45permissions: {}
     46
    4347jobs:
    4448  # Runs PHP coding standards checks.
    45   #
    46   # Violations are reported inline with annotations.
    47   #
    48   # Performs the following steps:
    49   # - Checks out the repository.
    50   # - Sets up PHP.
    51   # - Logs debug information.
    52   # - Configures caching for PHPCS scans.
    53   # - Installs Composer dependencies (use cache if possible).
    54   # - Make Composer packages available globally.
    55   # - Logs PHP_CodeSniffer debug information.
    56   # - Runs PHPCS on the full codebase with warnings suppressed.
    57   # - Runs PHPCS on the `tests` directory without warnings suppressed.
    58   # - Ensures version-controlled files are not modified or deleted.
    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       # This date is used to ensure that the PHPCS cache is cleared at least once every week.
    82       # http://man7.org/linux/man-pages/man1/date.1.html
    83       - name: "Get last Monday's date"
    84         id: get-date
    85         run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> $GITHUB_OUTPUT
    86 
    87       - name: Cache PHPCS scan cache
    88         uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
    89         with:
    90           path: .cache/phpcs.json
    91           key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcs-cache-${{ hashFiles('**/composer.json', 'phpcs.xml.dist') }}
    92 
    93       - name: Install Composer dependencies
    94         uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
    95         with:
    96           composer-options: "--no-progress --no-ansi"
    97 
    98       - name: Make Composer packages available globally
    99         run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
    100 
    101       - name: Log PHPCS debug information
    102         run: phpcs -i
    103 
    104       - name: Run PHPCS on all Core files
    105         run: phpcs -q -n --report=checkstyle | cs2pr
    106 
    107       - name: Check test suite files for warnings
    108         run: phpcs tests -q --report=checkstyle | cs2pr
    109 
    110       - name: Ensure version-controlled files are not modified during the tests
    111         run: git diff --exit-code
     55    with:
     56      php-version: '7.4'
    11257
    11358  # Runs the JavaScript coding standards checks.
    114   #
    115   # JSHint violations are not currently reported inline with annotations.
    116   #
    117   # Performs the following steps:
    118   # - Checks out the repository.
    119   # - Logs debug information about the GitHub Action runner.
    120   # - Installs Node.js.
    121   # - Logs updated debug information.
    122   # _ Installs npm dependencies.
    123   # - Run the WordPress JSHint checks.
    124   # - Ensures version-controlled files are not modified or deleted.
    12559  jshint:
    12660    name: JavaScript coding standards
    127     runs-on: ubuntu-latest
    128     timeout-minutes: 20
     61    uses: WordPress/wordpress-develop/.github/workflows/reusable-coding-standards-javascript.yml@trunk
     62    permissions:
     63      contents: read
    12964    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    130     env:
    131       PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
    132 
    133     steps:
    134       - name: Checkout repository
    135         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    136 
    137       - name: Log debug information
    138         run: |
    139           npm --version
    140           node --version
    141           git --version
    142           svn --version
    143 
    144       - name: Install Node.js
    145         uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
    146         with:
    147           node-version-file: '.nvmrc'
    148           cache: npm
    149 
    150       - name: Log debug information
    151         run: |
    152           npm --version
    153           node --version
    154 
    155       - name: Install Dependencies
    156         run: npm ci
    157 
    158       - name: Run JSHint
    159         run: npm run grunt jshint
    160 
    161       - name: Ensure version-controlled files are not modified or deleted
    162         run: git diff --exit-code
    16365
    16466  slack-notifications:
    16567    name: Slack Notifications
    16668    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
     69    permissions:
     70      actions: read
     71      contents: read
    16772    needs: [ phpcs, jshint ]
    16873    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
     
    17883    name: Failed workflow tasks
    17984    runs-on: ubuntu-latest
     85    permissions:
     86      actions: write
    18087    needs: [ phpcs, jshint, slack-notifications ]
    18188    if: |
  • branches/5.9/.github/workflows/end-to-end-tests.yml

    r57201 r58358  
    2727  cancel-in-progress: true
    2828
     29# Disable permissions for all available scopes by default.
     30# Any needed permissions should be configured at the job level.
     31permissions: {}
     32
    2933env:
    3034  LOCAL_DIR: build
    31   LOCAL_PHP: 8.0-fpm
    3235
    3336jobs:
    3437  # Runs the end-to-end test suite.
    35   #
    36   # Performs the following steps:
    37   # - Sets environment variables.
    38   # - Checks out the repository.
    39   # - Logs debug information about the GitHub Action runner.
    40   # - Installs Node.js.
    41   # _ Installs npm dependencies.
    42   # - Builds WordPress to run from the `build` directory.
    43   # - Starts the WordPress Docker container.
    44   # - Logs general debug information.
    45   # - Logs the running Docker containers.
    46   # - Logs Docker debug information (about both the Docker installation within the runner and the WordPress container).
    47   # - Install WordPress within the Docker container.
    48   # - Run the E2E tests.
    49   # - Ensures version-controlled files are not modified or deleted.
    5038  e2e-tests:
    51     name: E2E Tests
    52     runs-on: ubuntu-latest
    53     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
    5443    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    55 
    56     steps:
    57       - name: Configure environment variables
    58         run: |
    59           echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV
    60           echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV
    61 
    62       - name: Checkout repository
    63         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    64 
    65       - name: Log debug information
    66         run: |
    67           npm --version
    68           node --version
    69           curl --version
    70           git --version
    71           svn --version
    72           php --version
    73           php -i
    74           locale -a
    75 
    76       - name: Install Node.js
    77         uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
    78         with:
    79           node-version-file: '.nvmrc'
    80           cache: npm
    81 
    82       - name: Install Dependencies
    83         run: npm ci
    84 
    85       - name: Build WordPress
    86         run: npm run build
    87 
    88       - name: Start Docker environment
    89         run: |
    90           npm run env:start
    91 
    92       - name: General debug information
    93         run: |
    94           npm --version
    95           node --version
    96           curl --version
    97           git --version
    98           svn --version
    99 
    100       - name: Log running Docker containers
    101         run: docker ps -a
    102 
    103       - name: Docker debug information
    104         run: |
    105           docker -v
    106           docker-compose -v
    107           docker-compose run --rm mysql mysql --version
    108           docker-compose run --rm php php --version
    109           docker-compose run --rm php php -m
    110           docker-compose run --rm php php -i
    111           docker-compose run --rm php locale -a
    112 
    113       - name: Install WordPress
    114         run: npm run env:install
    115 
    116       - name: Run E2E tests
    117         run: npm run test:e2e
    118 
    119       - name: Ensure version-controlled files are not modified or deleted
    120         run: git diff --exit-code
    121 
    122   slack-notifications:
    123     name: Slack Notifications
    124     uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
    125     needs: [ e2e-tests ]
    126     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 ]
    12748    with:
    128       calling_status: ${{ needs.e2e-tests.result == 'success' && 'success' || needs.e2e-tests.result == 'cancelled' && 'cancelled' || 'failure' }}
    129     secrets:
    130       SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
    131       SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
    132       SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
    133       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
    13452
    13553  failed-workflow:
    13654    name: Failed workflow tasks
    13755    runs-on: ubuntu-latest
    138     needs: [ e2e-tests, slack-notifications ]
     56    permissions:
     57      actions: write
     58    needs: [ e2e-tests ]
    13959    if: |
    14060      always() &&
     
    14565        needs.e2e-tests.result == 'cancelled' || needs.e2e-tests.result == 'failure'
    14666      )
    147 
    14867    steps:
    14968      - name: Dispatch workflow run
  • branches/5.9/.github/workflows/javascript-tests.yml

    r55516 r58358  
    3939  cancel-in-progress: true
    4040
     41# Disable permissions for all available scopes by default.
     42# Any needed permissions should be configured at the job level.
     43permissions: {}
     44
    4145jobs:
    4246  # Runs the QUnit tests for WordPress.
    43   #
    44   # Performs the following steps:
    45   # - Checks out the repository.
    46   # - Logs debug information about the GitHub Action runner.
    47   # - Installs Node.js.
    48   # - Logs updated debug information.
    49   # _ Installs npm dependencies.
    50   # - Run the WordPress QUnit tests.
    51   # - Ensures version-controlled files are not modified or deleted.
    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    permissions:
     58      actions: read
     59      contents: read
    9260    needs: [ test-js ]
    9361    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
     
    10371    name: Failed workflow tasks
    10472    runs-on: ubuntu-latest
     73    permissions:
     74      actions: write
    10575    needs: [ test-js, slack-notifications ]
    10676    if: |
  • branches/5.9/.github/workflows/php-compatibility.yml

    r55516 r58358  
    3636  cancel-in-progress: true
    3737
     38# Disable permissions for all available scopes by default.
     39# Any needed permissions should be configured at the job level.
     40permissions: {}
     41
    3842jobs:
    39 
    4043  # Runs PHP compatibility testing.
    41   #
    42   # Violations are reported inline with annotations.
    43   #
    44   # Performs the following steps:
    45   # - Checks out the repository.
    46   # - Sets up PHP.
    47   # - Logs debug information.
    48   # - Configures caching for PHP compatibility scans.
    49   # - Installs Composer dependencies (use cache if possible).
    50   # - Make Composer packages available globally.
    51   # - Logs PHP_CodeSniffer debug information.
    52   # - Runs the PHP compatibility tests.
    53   # - Ensures version-controlled files are not modified or deleted.
    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    permissions:
     57      actions: read
     58      contents: read
    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    permissions:
     73      actions: write
    12174    needs: [ php-compatibility, slack-notifications ]
    12275    if: |
  • branches/5.9/.github/workflows/phpunit-tests.yml

    r55516 r58358  
    2727  cancel-in-progress: true
    2828
    29 env:
    30   PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
    31   LOCAL_PHP_MEMCACHED: ${{ false }}
    32   SLOW_TESTS: 'external-http,media,restapi'
     29# Disable permissions for all available scopes by default.
     30# Any needed permissions should be configured at the job level.
     31permissions: {}
     32
    3333
    3434jobs:
    35   # Runs the PHPUnit tests for WordPress.
    3635  #
    37   # Note: Steps running tests for PHP 8.1 jobs are allowed to "continue-on-error".
    38   # This prevents workflow runs from being marked as "failed" when only PHP 8.1 fails.
     36  # Creates a PHPUnit test job for each PHP/MySQL combination.
    3937  #
    40   # Performs the following steps:
    41   # - Sets environment variables.
    42   # - Sets up the environment variables needed for testing with memcached (if desired).
    43   # - Installs Node.js.
    44   # - Installs npm dependencies
    45   # - Configures caching for Composer.
    46   # - Installs Composer dependencies.
    47   # - Logs Docker debug information (about the Docker installation within the runner).
    48   # - Starts the WordPress Docker container.
    49   # - Starts the Memcached server after the Docker network has been created (if desired).
    50   # - Logs general debug information about the runner.
    51   # - Logs the running Docker containers.
    52   # - Logs debug information from inside the WordPress Docker container.
    53   # - Logs debug information about what's installed within the WordPress Docker containers.
    54   # - Install WordPress within the Docker container.
    55   # - Run the PHPUnit tests.
    56   # - Ensures version-controlled files are not modified or deleted.
    57   # - Checks out the WordPress Test reporter repository.
    58   # - Reconnect the directory to the Git repository.
    59   # - Submit the test results to the WordPress.org host test results.
    6038  test-php:
    61     name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
    62     runs-on: ${{ matrix.os }}
    63     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
    6444    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    6545    strategy:
    6646      fail-fast: false
    6747      matrix:
     48        os: [ ubuntu-latest ]
    6849        php: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1' ]
    69         os: [ ubuntu-latest ]
     50        db-type: [ 'mysql' ]
     51        db-version: [ '5.7' ]
     52        multisite: [ false, true ]
    7053        memcached: [ false ]
    71         split_slow: [ false ]
    72         multisite: [ false, true ]
     54
    7355        include:
    74           # Additional "slow" jobs for PHP 5.6.
    75           - php: '5.6'
    76             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
    7778            memcached: false
    78             multisite: false
    79             split_slow: true
    80           - php: '5.6'
    81             os: ubuntu-latest
    82             memcached: false
    83             multisite: true
    84             split_slow: true
    85           # Include jobs for PHP 7.4 with memcached.
    86           - php: '7.4'
    87             os: ubuntu-latest
    88             memcached: true
    89             multisite: false
    90           - php: '7.4'
    91             os: ubuntu-latest
    92             memcached: true
    93             multisite: true
    94           # Report the results of the PHP 7.4 without memcached job.
    95           - php: '7.4'
    96             os: ubuntu-latest
    97             memcached: false
    98             multisite: false
    9979            report: true
    100 
    101     env:
    102       LOCAL_PHP: ${{ matrix.php }}-fpm
    103       LOCAL_PHP_MEMCACHED: ${{ matrix.memcached }}
    104       PHPUNIT_CONFIG: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }}
    105 
    106     steps:
    107       - name: Configure environment variables
    108         run: |
    109           echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV
    110           echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV
    111 
    112       - name: Checkout repository
    113         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    114 
    115       - name: Install Node.js
    116         uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
    117         with:
    118           node-version-file: '.nvmrc'
    119           cache: npm
    120 
    121       - name: Install npm dependencies
    122         run: npm ci
    123 
    124       # This date is used to ensure that the Composer cache is refreshed at least once every week.
    125       # http://man7.org/linux/man-pages/man1/date.1.html
    126       - name: "Get last Monday's date"
    127         id: get-date
    128         run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> $GITHUB_OUTPUT
    129 
    130       - name: Get Composer cache directory
    131         id: composer-cache
    132         run: echo "composer_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
    133 
    134       - name: Cache Composer dependencies
    135         uses: actions/cache@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3
    136         env:
    137           cache-name: cache-composer-dependencies
    138         with:
    139           path: ${{ steps.composer-cache.outputs.composer_dir }}
    140           key: ${{ runner.os }}-php-${{ matrix.php }}-date-${{ steps.get-date.outputs.date }}-composer-${{ hashFiles('**/composer.json') }}
    141 
    142       - name: Install Composer dependencies
    143         run: |
    144           docker-compose run --rm php composer --version
    145 
    146           # Install using `composer update` as there is no `composer.lock` file.
    147           if [ ${{ env.LOCAL_PHP }} == '8.1-fpm' ]; then
    148             docker-compose run --rm php composer update --ignore-platform-reqs
    149           else
    150             docker-compose run --rm php composer update
    151           fi
    152 
    153       - name: Docker debug information
    154         run: |
    155           docker -v
    156           docker-compose -v
    157 
    158       - name: Start Docker environment
    159         run: |
    160           npm run env:start
    161 
    162       # The memcached server needs to start after the Docker network has been set up with `npm run env:start`.
    163       - name: Start the Memcached server.
    164         if: ${{ matrix.memcached }}
    165         run: |
    166           cp tests/phpunit/includes/object-cache.php src/wp-content/object-cache.php
    167           docker run --name memcached --net $(basename "$PWD")_wpdevnet -d memcached
    168 
    169       - name: General debug information
    170         run: |
    171           npm --version
    172           node --version
    173           curl --version
    174           git --version
    175           svn --version
    176 
    177       - name: Log running Docker containers
    178         run: docker ps -a
    179 
    180       - name: WordPress Docker container debug information
    181         run: |
    182           docker-compose run --rm mysql mysql --version
    183           docker-compose run --rm php php --version
    184           docker-compose run --rm php php -m
    185           docker-compose run --rm php php -i
    186           docker-compose run --rm php locale -a
    187 
    188       - name: Install WordPress
    189         run: npm run env:install
    190 
    191       - name: Run slow PHPUnit tests
    192         if: ${{ matrix.split_slow }}
    193         run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }}
    194 
    195       - name: Run PHPUnit tests for single site excluding slow tests
    196         if: ${{ matrix.php < '7.0' && ! matrix.split_slow && ! matrix.multisite }}
    197         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
    198 
    199       - name: Run PHPUnit tests for Multisite excluding slow tests
    200         if: ${{ matrix.php < '7.0' && ! matrix.split_slow && matrix.multisite }}
    201         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
    202 
    203       - name: Run PHPUnit tests
    204         if: ${{ matrix.php >= '7.0' }}
    205         continue-on-error: ${{ matrix.php == '8.1' }}
    206         run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }}
    207 
    208       - name: Run AJAX tests
    209         if: ${{ ! matrix.split_slow }}
    210         continue-on-error: ${{ matrix.php == '8.1' }}
    211         run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax
    212 
    213       - name: Run ms-files tests as a multisite install
    214         if: ${{ matrix.multisite && ! matrix.split_slow }}
    215         continue-on-error: ${{ matrix.php == '8.1' }}
    216         run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c tests/phpunit/multisite.xml --group ms-files
    217 
    218       - name: Run external HTTP tests
    219         if: ${{ ! matrix.multisite && ! matrix.split_slow }}
    220         continue-on-error: ${{ matrix.php == '8.1' }}
    221         run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c phpunit.xml.dist --group external-http
    222 
    223       # __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
    224       - name: Run (xDebug) tests
    225         if: ${{ ! matrix.split_slow }}
    226         continue-on-error: ${{ matrix.php == '8.1' }}
    227         run: LOCAL_PHP_XDEBUG=true node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit -v --group xdebug --exclude-group __fakegroup__
    228 
    229       - name: Ensure version-controlled files are not modified or deleted
    230         run: git diff --exit-code
    231 
    232       - name: Checkout the WordPress Test Reporter
    233         if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }}
    234         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    235         with:
    236           repository: 'WordPress/phpunit-test-runner'
    237           path: 'test-runner'
    238 
    239       - name: Submit test results to the WordPress.org host test results
    240         if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }}
    241         env:
    242           WPT_REPORT_API_KEY: "${{ secrets.WPT_REPORT_API_KEY }}"
    243         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 }}
    24490
    24591  slack-notifications:
    24692    name: Slack Notifications
    24793    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
     94    permissions:
     95      actions: read
     96      contents: read
    24897    needs: [ test-php ]
    24998    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
     
    259108    name: Failed workflow tasks
    260109    runs-on: ubuntu-latest
     110    permissions:
     111      actions: write
    261112    needs: [ test-php, slack-notifications ]
    262113    if: |
  • branches/5.9/.github/workflows/test-build-processes.yml

    r58357 r58358  
    1 name: Test npm
     1name: Test Build Processes
    22
    33on:
     
    3434  cancel-in-progress: true
    3535
    36 env:
    37   PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
     36# Disable permissions for all available scopes by default.
     37# Any needed permissions should be configured at the job level.
     38permissions: {}
    3839
    3940jobs:
    40   # Verifies that installing npm dependencies and building WordPress works as expected.
    41   #
    42   # Performs the following steps:
    43   # - Checks out the repository.
    44   # - Logs debug information about the GitHub Action runner.
    45   # - Installs Node.js.
    46   # _ Installs npm dependencies.
    47   # - Builds WordPress to run from the `build` directory.
    48   # - Cleans up after building WordPress to the `build` directory.
    49   # - 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        directory: [ 'src', 'build' ]
     53        include:
     54          # Only prepare artifacts once.
     55          - os: ubuntu-latest
     56            directory: 'build'
     57            prepare-playground: true
     58    with:
     59      os: ${{ matrix.os }}
     60      directory: ${{ matrix.directory }}
     61      prepare-playground: ${{ matrix.prepare-playground && matrix.prepare-playground || false }}
     62      test-emoji: false
    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       - name: Build WordPress in /src
    94         run: npm run build:dev
    95 
    96       - name: Clean after building in /src
    97         run: npm run grunt clean -- --dev
    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 determining 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   # - Logs debug information about the GitHub Action runner.
    114   # - Installs Node.js.
    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: Log debug information
    132         run: |
    133           npm --version
    134           node --version
    135           curl --version
    136           git --version
    137           svn --version
    138 
    139       - name: Install Node.js
    140         uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
    141         with:
    142           node-version-file: '.nvmrc'
    143           cache: npm
    144 
    145       - name: Install Dependencies
    146         run: npm ci
    147 
    148       - name: Build WordPress
    149         run: npm run build
    150 
    151       - name: Clean after building
    152         run: npm run grunt clean
    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 in /src
    158         run: npm run build:dev
    159 
    160       - name: Clean after building in /src
    161         run: npm run grunt clean -- --dev
    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: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }}
    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        contains( needs.*.result, 'cancelled' ) ||
     117        contains( needs.*.result, 'failure' )
    191118      )
    192119
    193120    steps:
    194121      - name: Dispatch workflow run
    195         uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
     122        uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
    196123        with:
    197124          retries: 2
  • branches/5.9/docker-compose.yml

    r53351 r58358  
    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      - XDEBUG_MODE=${LOCAL_PHP_XDEBUG_MODE-develop,debug}
    4143      - LOCAL_PHP_MEMCACHED=${LOCAL_PHP_MEMCACHED-false}
    4244      - PHP_FPM_UID=${PHP_FPM_UID-1000}
     
    4951      - ./:/var/www
    5052
    51     depends_on:
    52       - mysql
     53    # Copy or delete the Memcached dropin plugin file as appropriate.
     54    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"
     55
     56    # The init directive ensures the command runs with a PID > 1, so Ctrl+C works correctly.
     57    init: true
     58
     59    extra_hosts:
     60      - localhost:host-gateway
    5361
    5462  ##
     
    5765  mysql:
    5866    image: ${LOCAL_DB_TYPE-mysql}:${LOCAL_DB_VERSION-latest}
     67    platform: linux/amd64
    5968
    6069    networks:
     
    7382    # For compatibility with PHP versions that don't support the caching_sha2_password auth plugin used in MySQL 8.0.
    7483    command: --default-authentication-plugin=mysql_native_password
     84
     85    healthcheck:
     86      test: [ "CMD-SHELL", "if [ \"$LOCAL_DB_TYPE\" = \"mariadb\" ]; then mariadb-admin ping -h localhost; else mysqladmin ping -h localhost; fi" ]
     87      timeout: 5s
     88      interval: 5s
     89      retries: 10
    7590
    7691  ##
     
    95110    init: true
    96111
     112    extra_hosts:
     113      - localhost:host-gateway
     114
     115    depends_on:
     116      php:
     117        condition: service_started
     118      mysql:
     119        condition: service_healthy
     120
     121  ##
     122  # The Memcached container.
     123  ##
     124  memcached:
     125    image: memcached
     126
     127    networks:
     128      - wpdevnet
     129
     130    ports:
     131      - 11211:11211
     132
     133    depends_on:
     134      php:
     135        condition: service_started
     136
    97137volumes:
    98138  # So that sites aren't wiped every time containers are restarted, MySQL uses a persistent volume.
  • branches/5.9/tools/local-env/scripts/docker.js

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

    r51736 r58358  
    4646 */
    4747function wp_cli( cmd ) {
    48     execSync( `docker-compose run --rm cli ${cmd}`, { stdio: 'inherit' } );
     48    execSync( `docker compose run --rm cli ${cmd}`, { stdio: 'inherit' } );
    4949}
    5050
     
    5555    const 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( `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' } );
    5959}
  • branches/5.9/tools/local-env/scripts/start.js

    r49362 r58358  
    66
    77// Start the local-env containers.
    8 execSync( 'docker-compose up -d wordpress-develop', { stdio: 'inherit' } );
     8execSync( 'docker compose up -d wordpress-develop', { stdio: 'inherit' } );
    99
    1010// If Docker Toolbox is being used, we need to manually forward LOCAL_PORT to the Docker VM.
Note: See TracChangeset for help on using the changeset viewer.