Make WordPress Core

Changeset 58330

Timestamp:
06/04/2024 01:26:19 PM (2 months ago)
Author:
desrosj
Message:

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

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

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

  • The image and platform properties for the mysql container have been updated to always prefer amd64 containers (#60822).
  • macos-13 is now pinned for MacOS jobs instead of macos-latest (#61340).
  • Removes the performance testing workflow. This workflow was overhauled in 6.4 to use Playwright. Continuing to support Puppeteer-based performance testing in 6.1-6.3 (which was historically very flaky) in a reusable workflow outweighs the benefit.
  • 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.

Merges [56113], [56114], [57918], [58157], [57124], [57125], [57249] to the 6.1 branch.

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

Location:
branches/6.1
Files:
10 edited
1 moved

Legend:

Unmodified
Added
Removed
  • branches/6.1

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

    r55489 r58330  
    4141  cancel-in-progress: true
    4242
     43
     44
     45
     46
    4347jobs:
    4448  # Runs PHP coding standards checks.
    45   #
    46   # Violations are reported inline with annotations.
    47   #
    48   # Performs the following steps:
    49   # - Checks out the repository.
    50   # - Sets up PHP.
    51   # - Configures caching for PHPCS scans.
    52   # - Installs Composer dependencies.
    53   # - Make Composer packages available globally.
    54   # - Runs PHPCS on the full codebase with warnings suppressed.
    55   # - Generate a report for displaying issues as pull request annotations.
    56   # - Runs PHPCS on the `tests` directory without warnings suppressed.
    57   # - Generate a report for displaying `test` directory issues as pull request annotations.
    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: cs2pr
    75 
    76       # This date is used to ensure that the PHPCS 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 PHPCS scan cache
    83         uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
    84         with:
    85           path: .cache/phpcs.json
    86           key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcs-cache-${{ hashFiles('**/composer.json', 'phpcs.xml.dist') }}
    87 
    88       # Since Composer dependencies are installed using `composer update` and no lock file is in version control,
    89       # passing a custom cache suffix ensures that the cache is flushed at least once per week.
    90       - name: Install Composer dependencies
    91         uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
    92         with:
    93           custom-cache-suffix: ${{ steps.get-date.outputs.date }}
    94 
    95       - name: Make Composer packages available globally
    96         run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
    97 
    98       - name: Run PHPCS on all Core files
    99         id: phpcs-core
    100         run: phpcs -n --report-full --report-checkstyle=./.cache/phpcs-report.xml
    101 
    102       - name: Show PHPCS results in PR
    103         if: ${{ always() && steps.phpcs-core.outcome == 'failure' }}
    104         run: cs2pr ./.cache/phpcs-report.xml
    105 
    106       - name: Check test suite files for warnings
    107         id: phpcs-tests
    108         run: phpcs tests --report-full --report-checkstyle=./.cache/phpcs-tests-report.xml
    109 
    110       - name: Show test suite scan results in PR
    111         if: ${{ always() && steps.phpcs-tests.outcome == 'failure' }}
    112         run: cs2pr ./.cache/phpcs-tests-report.xml
    113 
    114       - name: Ensure version-controlled files are not modified during the tests
    115         run: git diff --exit-code
     55    with:
     56      php-version: '7.4'
    11657
    11758  # Runs the JavaScript coding standards checks.
    118   #
    119   # JSHint violations are not currently reported inline with annotations.
    120   #
    121   # Performs the following steps:
    122   # - Checks out the repository.
    123   # - Sets up Node.js.
    124   # - Logs debug information about the GitHub Action runner.
    125   # - Installs npm dependencies.
    126   # - Run the WordPress JSHint checks.
    127   # - Ensures version-controlled files are not modified or deleted.
    12859  jshint:
    12960    name: JavaScript coding standards
    130     runs-on: ubuntu-latest
    131     timeout-minutes: 20
     61    uses: WordPress/wordpress-develop/.github/workflows/reusable-coding-standards-javascript.yml@trunk
     62    permissions:
     63      contents: read
    13264    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    133     env:
    134       PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
    135 
    136     steps:
    137       - name: Checkout repository
    138         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    139 
    140       - name: Set up Node.js
    141         uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
    142         with:
    143           node-version-file: '.nvmrc'
    144           cache: npm
    145 
    146       - name: Log debug information
    147         run: |
    148           npm --version
    149           node --version
    150           git --version
    151           svn --version
    152 
    153       - name: Install npm Dependencies
    154         run: npm ci
    155 
    156       - name: Run JSHint
    157         run: npm run grunt jshint
    158 
    159       - name: Ensure version-controlled files are not modified or deleted
    160         run: git diff --exit-code
    16165
    16266  slack-notifications:
    16367    name: Slack Notifications
    16468    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
     69
     70
     71
    16572    needs: [ phpcs, jshint ]
    16673    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
     
    17683    name: Failed workflow tasks
    17784    runs-on: ubuntu-latest
     85
     86
    17887    needs: [ phpcs, jshint, slack-notifications ]
    17988    if: |
  • branches/6.1/.github/workflows/end-to-end-tests.yml

    r57205 r58330  
    2727  cancel-in-progress: true
    2828
     29
     30
     31
     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   # - Sets up Node.js.
    40   # - Logs debug information about the GitHub Action runner.
    41   # - Installs npm dependencies.
    42   # - Builds WordPress to run from the `build` directory.
    43   # - Starts the WordPress Docker container.
    44   # - Logs the running Docker containers.
    45   # - Logs Docker debug information (about both the Docker installation within the runner and the WordPress container).
    46   # - Install WordPress within the Docker container.
    47   # - Run the E2E tests.
    48   # - Ensures version-controlled files are not modified or deleted.
    4938  e2e-tests:
    50     name: E2E Tests
    51     runs-on: ubuntu-latest
    52     timeout-minutes: 20
     39    name: Test with SCRIPT_DEBUG ${{ matrix.LOCAL_SCRIPT_DEBUG && 'enabled' || 'disabled' }}
     40    uses: WordPress/wordpress-develop/.github/workflows/reusable-end-to-end-tests.yml@trunk
     41    permissions:
     42      contents: read
    5343    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    54 
    55     steps:
    56       - name: Configure environment variables
    57         run: |
    58           echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV
    59           echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV
    60 
    61       - name: Checkout repository
    62         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    63 
    64       - name: Set up Node.js
    65         uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
    66         with:
    67           node-version-file: '.nvmrc'
    68           cache: npm
    69 
    70       - name: Log debug information
    71         run: |
    72           npm --version
    73           node --version
    74           curl --version
    75           git --version
    76           svn --version
    77           locale -a
    78 
    79       - name: Install npm Dependencies
    80         run: npm ci
    81 
    82       - name: Build WordPress
    83         run: npm run build
    84 
    85       - name: Start Docker environment
    86         run: |
    87           npm run env:start
    88 
    89       - name: Log running Docker containers
    90         run: docker ps -a
    91 
    92       - name: Docker debug information
    93         run: |
    94           docker -v
    95           docker-compose -v
    96           docker-compose run --rm mysql mysql --version
    97           docker-compose run --rm php php --version
    98           docker-compose run --rm php php -m
    99           docker-compose run --rm php php -i
    100           docker-compose run --rm php locale -a
    101 
    102       - name: Install WordPress
    103         run: npm run env:install
    104 
    105       - name: Run E2E tests
    106         run: npm run test:e2e
    107 
    108       - name: Ensure version-controlled files are not modified or deleted
    109         run: git diff --exit-code
    110 
    111   slack-notifications:
    112     name: Slack Notifications
    113     uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
    114     needs: [ e2e-tests ]
    115     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 ]
    11648    with:
    117       calling_status: ${{ needs.e2e-tests.result == 'success' && 'success' || needs.e2e-tests.result == 'cancelled' && 'cancelled' || 'failure' }}
    118     secrets:
    119       SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
    120       SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
    121       SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
    122       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
    12352
    12453  failed-workflow:
    12554    name: Failed workflow tasks
    12655    runs-on: ubuntu-latest
    127     needs: [ e2e-tests, slack-notifications ]
     56    permissions:
     57      actions: write
     58    needs: [ e2e-tests ]
    12859    if: |
    12960      always() &&
     
    13465        needs.e2e-tests.result == 'cancelled' || needs.e2e-tests.result == 'failure'
    13566      )
    136 
    13767    steps:
    13868      - name: Dispatch workflow run
  • branches/6.1/.github/workflows/javascript-tests.yml

    r55357 r58330  
    3939  cancel-in-progress: true
    4040
     41
     42
     43
     44
    4145jobs:
    4246  # Runs the QUnit tests for WordPress.
    43   #
    44   # Performs the following steps:
    45   # - Checks out the repository.
    46   # - Sets up Node.js.
    47   # - Logs debug information about the GitHub Action runner.
    48   # - Installs npm dependencies.
    49   # - Run the WordPress QUnit tests.
    50   # - Ensures version-controlled files are not modified or deleted.
    5147  test-js:
    5248    name: QUnit Tests
    53     runs-on: ubuntu-latest
    54     timeout-minutes: 20
     49    uses: WordPress/wordpress-develop/.github/workflows/reusable-javascript-tests.yml@trunk
     50    permissions:
     51      contents: read
    5552    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    56 
    57     steps:
    58       - name: Checkout repository
    59         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    60 
    61       - name: Set up Node.js
    62         uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
    63         with:
    64           node-version-file: '.nvmrc'
    65           cache: npm
    66 
    67       - name: Log debug information
    68         run: |
    69           npm --version
    70           node --version
    71           git --version
    72           svn --version
    73 
    74       - name: Install npm Dependencies
    75         run: npm ci
    76 
    77       - name: Run QUnit tests
    78         run: npm run grunt qunit:compiled
    79 
    80       - name: Ensure version-controlled files are not modified or deleted
    81         run: git diff --exit-code
    8253
    8354  slack-notifications:
    8455    name: Slack Notifications
    8556    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
     57
     58
     59
    8660    needs: [ test-js ]
    8761    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
     
    9771    name: Failed workflow tasks
    9872    runs-on: ubuntu-latest
     73
     74
    9975    needs: [ test-js, slack-notifications ]
    10076    if: |
  • branches/6.1/.github/workflows/php-compatibility.yml

    r55489 r58330  
    3636  cancel-in-progress: true
    3737
     38
     39
     40
     41
    3842jobs:
    39 
    4043  # Runs PHP compatibility testing.
    41   #
    42   # Violations are reported inline with annotations.
    43   #
    44   # Performs the following steps:
    45   # - Checks out the repository.
    46   # - Sets up PHP.
    47   # - Logs debug information.
    48   # - Configures caching for PHP compatibility scans.
    49   # - Installs Composer dependencies.
    50   # - Make Composer packages available globally.
    51   # - Runs the PHP compatibility tests.
    52   # - Generate a report for displaying issues as pull request annotations.
    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: cs2pr
    70 
    71       - name: Log debug information
    72         run: |
    73           composer --version
    74 
    75       # This date is used to ensure that the PHP compatibility 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 PHP compatibility scan cache
    82         uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
    83         with:
    84           path: .cache/phpcompat.json
    85           key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcompat-cache-${{ hashFiles('**/composer.json', 'phpcompat.xml.dist') }}
    86 
    87       # Since Composer dependencies are installed using `composer update` and no lock file is in version control,
    88       # passing a custom cache suffix ensures that the cache is flushed at least once per week.
    89       - name: Install Composer dependencies
    90         uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
    91         with:
    92           custom-cache-suffix: ${{ steps.get-date.outputs.date }}
    93 
    94       - name: Make Composer packages available globally
    95         run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
    96 
    97       - name: Run PHP compatibility tests
    98         id: phpcs
    99         run: phpcs --standard=phpcompat.xml.dist --report-full --report-checkstyle=./.cache/phpcs-compat-report.xml
    100 
    101       - name: Show PHPCompatibility results in PR
    102         if: ${{ always() && steps.phpcs.outcome == 'failure' }}
    103         run: cs2pr ./.cache/phpcs-compat-report.xml
    104 
    105       - name: Ensure version-controlled files are not modified or deleted
    106         run: git diff --exit-code
     50    with:
     51      php-version: '7.4'
    10752
    10853  slack-notifications:
    10954    name: Slack Notifications
    11055    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
     56
     57
     58
    11159    needs: [ php-compatibility ]
    11260    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
     
    12270    name: Failed workflow tasks
    12371    runs-on: ubuntu-latest
     72
     73
    12474    needs: [ php-compatibility, slack-notifications ]
    12575    if: |
  • branches/6.1/.github/workflows/phpunit-tests.yml

    r55489 r58330  
    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   # Performs the following steps:
    38   # - Sets environment variables.
    39   # - Checks out the repository.
    40   # - Sets up Node.js.
    41   # - Sets up PHP.
    42   # - Installs Composer dependencies.
    43   # - Installs npm dependencies
    44   # - Logs general debug information about the runner.
    45   # - Logs Docker debug information (about the Docker installation within the runner).
    46   # - Starts the WordPress Docker container.
    47   # - Logs the running Docker containers.
    48   # - Logs debug information about what's installed within the WordPress Docker containers.
    49   # - Install WordPress within the Docker container.
    50   # - Run the PHPUnit tests.
    51   # - Ensures version-controlled files are not modified or deleted.
    52   # - Checks out the WordPress Test reporter repository.
    53   # - Submit the test results to the WordPress.org host test results.
     36  # Creates a PHPUnit test job for each PHP/MySQL combination.
     37  #
    5438  test-php:
    55     name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
    56     runs-on: ${{ matrix.os }}
    57     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
    5844    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    5945    strategy:
    6046      fail-fast: false
    6147      matrix:
     48
    6249        php: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ]
    63         os: [ ubuntu-latest ]
     50        db-type: [ 'mysql' ]
     51        db-version: [ '5.7' ]
     52        multisite: [ false, true ]
    6453        memcached: [ false ]
    65         split_slow: [ false ]
    66         multisite: [ false, true ]
     54
    6755        include:
    68           # Additional "slow" jobs for PHP 5.6.
    69           - php: '5.6'
    70             os: ubuntu-latest
     56          # Include jobs for PHP 7.4 with memcached.
     57          - os: ubuntu-latest
     58            php: '7.4'
     59            db-type: 'mysql'
     60            db-version: '5.7'
     61            multisite: false
     62            memcached: true
     63          - os: ubuntu-latest
     64            php: '7.4'
     65            db-type: 'mysql'
     66            db-version: '5.7'
     67            multisite: true
     68            memcached: true
     69          # Report the results of the PHP 7.4 without memcached job.
     70          - os: ubuntu-latest
     71            php: '7.4'
     72            db-type: 'mysql'
     73            db-version: '5.7'
     74            multisite: false
    7175            memcached: false
    72             multisite: false
    73             split_slow: true
    74           - php: '5.6'
    75             os: ubuntu-latest
    76             memcached: false
    77             multisite: true
    78             split_slow: true
    79           # Include jobs for PHP 7.4 with memcached.
    80           - php: '7.4'
    81             os: ubuntu-latest
    82             memcached: true
    83             multisite: false
    84           - php: '7.4'
    85             os: ubuntu-latest
    86             memcached: true
    87             multisite: true
    88           # Report the results of the PHP 7.4 without memcached job.
    89           - php: '7.4'
    90             os: ubuntu-latest
    91             memcached: false
    92             multisite: false
    9376            report: true
    94 
    95     env:
    96       LOCAL_PHP: ${{ matrix.php }}-fpm
    97       LOCAL_PHP_MEMCACHED: ${{ matrix.memcached }}
    98       PHPUNIT_CONFIG: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }}
    99 
    100     steps:
    101       - name: Configure environment variables
    102         run: |
    103           echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV
    104           echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV
    105 
    106       - name: Checkout repository
    107         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    108 
    109       - name: Set up Node.js
    110         uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
    111         with:
    112           node-version-file: '.nvmrc'
    113           cache: npm
    114 
    115       ##
    116       # This allows Composer dependencies to be installed using a single step.
    117       #
    118       # Since the tests are currently run within the Docker containers where the PHP version varies,
    119       # the same PHP version needs to be configured for the action runner machine so that the correct
    120       # dependency versions are installed and cached.
    121       ##
    122       - name: Set up PHP
    123         uses: shivammathur/setup-php@d30ad8b1843ace22e6698ab99bbafaa747b6bd0d # v2.24.0
    124         with:
    125           php-version: '${{ matrix.php }}'
    126           coverage: none
    127 
    128       # Since Composer dependencies are installed using `composer update` and no lock file is in version control,
    129       # passing a custom cache suffix ensures that the cache is flushed at least once per week.
    130       - name: Install Composer dependencies
    131         uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
    132         with:
    133           custom-cache-suffix: $(/bin/date -u --date='last Mon' "+%F")
    134 
    135       - name: Install npm dependencies
    136         run: npm ci
    137 
    138       - name: General debug information
    139         run: |
    140           npm --version
    141           node --version
    142           curl --version
    143           git --version
    144           svn --version
    145           composer --version
    146           locale -a
    147 
    148       - name: Docker debug information
    149         run: |
    150           docker -v
    151           docker-compose -v
    152 
    153       - name: Start Docker environment
    154         run: |
    155           npm run env:start
    156 
    157       - name: Log running Docker containers
    158         run: docker ps -a
    159 
    160       - name: WordPress Docker container debug information
    161         run: |
    162           docker-compose run --rm mysql mysql --version
    163           docker-compose run --rm php php --version
    164           docker-compose run --rm php php -m
    165           docker-compose run --rm php php -i
    166           docker-compose run --rm php locale -a
    167 
    168       - name: Install WordPress
    169         run: npm run env:install
    170 
    171       - name: Run slow PHPUnit tests
    172         if: ${{ matrix.split_slow }}
    173         run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }}
    174 
    175       - name: Run PHPUnit tests for single site excluding slow tests
    176         if: ${{ matrix.php < '7.0' && ! matrix.split_slow && ! matrix.multisite }}
    177         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
    178 
    179       - name: Run PHPUnit tests for Multisite excluding slow tests
    180         if: ${{ matrix.php < '7.0' && ! matrix.split_slow && matrix.multisite }}
    181         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
    182 
    183       - name: Run PHPUnit tests
    184         if: ${{ matrix.php >= '7.0' }}
    185         run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }}
    186 
    187       - name: Run AJAX tests
    188         if: ${{ ! matrix.split_slow }}
    189         run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax
    190 
    191       - name: Run ms-files tests as a multisite install
    192         if: ${{ matrix.multisite && ! matrix.split_slow }}
    193         run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c tests/phpunit/multisite.xml --group ms-files
    194 
    195       - name: Run external HTTP tests
    196         if: ${{ ! matrix.multisite && ! matrix.split_slow }}
    197         run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c phpunit.xml.dist --group external-http
    198 
    199       # __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
    200       # This test group is not (yet) run against PHP 8.2 as there is no stable Xdebug version available yet for PHP 8.2.
    201       - name: Run (Xdebug) tests
    202         if: ${{ ! matrix.split_slow && matrix.php != '8.2' }}
    203         run: LOCAL_PHP_XDEBUG=true node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit -v --group xdebug --exclude-group __fakegroup__
    204 
    205       - name: Ensure version-controlled files are not modified or deleted
    206         run: git diff --exit-code
    207 
    208       - name: Checkout the WordPress Test Reporter
    209         if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }}
    210         uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    211         with:
    212           repository: 'WordPress/phpunit-test-runner'
    213           path: 'test-runner'
    214 
    215       - name: Submit test results to the WordPress.org host test results
    216         if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }}
    217         env:
    218           WPT_REPORT_API_KEY: "${{ secrets.WPT_REPORT_API_KEY }}"
    219         run: docker-compose run --rm -e WPT_REPORT_API_KEY -e WPT_PREPARE_DIR=/var/www -e WPT_TEST_DIR=/var/www php php test-runner/report.php
     77    with:
     78      os: ${{ matrix.os }}
     79      php: ${{ matrix.php }}
     80      db-type: ${{ matrix.db-type }}
     81      db-version: ${{ matrix.db-version }}
     82      multisite: ${{ matrix.multisite }}
     83      memcached: ${{ matrix.memcached }}
     84      phpunit-config: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }}
     85      report: ${{ matrix.report || false }}
    22086
    22187  slack-notifications:
    22288    name: Slack Notifications
    22389    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
     90
     91
     92
    22493    needs: [ test-php ]
    22594    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
     
    235104    name: Failed workflow tasks
    236105    runs-on: ubuntu-latest
     106
     107
    237108    needs: [ test-php, slack-notifications ]
    238109    if: |
  • branches/6.1/.github/workflows/test-build-processes.yml

    r58329 r58330  
    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
    6257
    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.
     58  # Tests the WordPress Core build process on MacOS.
    10359  #
    104   # This is separate from the job above in order to use stricter conditions about when to run.
     60  # This is separate from the job above in order to use stricter conditions when to run.
    10561  # This avoids unintentionally consuming excessive minutes, as MacOS jobs consume minutes at a 10x rate.
    10662  #
     
    10864  # currently no way to determine the OS being used on a given job.
    10965  # 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
     66  test-core-build-process-macos:
     67    name: Core running from ${{ matrix.directory }}
     68    uses: WordPress/wordpress-develop/.github/workflows/reusable-test-core-build-process.yml@trunk
     69    permissions:
     70      contents: read
    12671    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
     72    strategy:
     73      fail-fast: false
     74      matrix:
     75        os: [ macos-13 ]
     76        directory: [ 'src', 'build' ]
     77    with:
     78      os: ${{ matrix.os }}
     79      directory: ${{ matrix.directory }}
     80      test-emoji: false
    16581
    16682  slack-notifications:
    16783    name: Slack Notifications
    16884    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
    169     needs: [ test-npm, test-npm-macos ]
     85    permissions:
     86      actions: read
     87      contents: read
     88    needs: [ test-core-build-process, test-core-build-process-macos ]
    17089    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
    17190    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' }}
     91      calling_status: ${{ ' }}
    17392    secrets:
    17493      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
     
    18099    name: Failed workflow tasks
    181100    runs-on: ubuntu-latest
    182     needs: [ test-npm, test-npm-macos, slack-notifications ]
     101    permissions:
     102      actions: write
     103    needs: [ slack-notifications ]
    183104    if: |
    184105      always() &&
     
    187108      github.run_attempt < 2 &&
    188109      (
    189         needs.test-npm.result == 'cancelled' || needs.test-npm.result == 'failure' ||
    190         needs.test-npm-macos.result == 'cancelled' || needs.test-npm-macos.result == 'failure'
     110        ||
     111       
    191112      )
    192113
    193114    steps:
    194115      - name: Dispatch workflow run
    195         uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
     116        uses: actions/github-script@
    196117        with:
    197118          retries: 2
  • branches/6.1/docker-compose.yml

    r54096 r58330  
    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  ##
     
    5354    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"
    5455
    55     depends_on:
    56       - mysql
    57 
    5856    # The init directive ensures the command runs with a PID > 1, so Ctrl+C works correctly.
    5957    init: true
     
    6664  ##
    6765  mysql:
    68     image: amd64/${LOCAL_DB_TYPE-mysql}:${LOCAL_DB_VERSION-latest}
     66    image: ${LOCAL_DB_TYPE-mysql}:${LOCAL_DB_VERSION-latest}
     67    platform: linux/amd64
    6968
    7069    networks:
     
    8382    # For compatibility with PHP versions that don't support the caching_sha2_password auth plugin used in MySQL 8.0.
    8483    command: --default-authentication-plugin=mysql_native_password
     84
     85
     86
     87
     88
     89
    8590
    8691  ##
     
    108113      - localhost:host-gateway
    109114
     115
     116
     117
     118
     119
     120
    110121  ##
    111122  # The Memcached container.
     
    120131      - 11211:11211
    121132
     133
     134
     135
     136
    122137volumes:
    123138  # So that sites aren't wiped every time containers are restarted, MySQL uses a persistent volume.
  • branches/6.1/tools/local-env/scripts/docker.js

    r54096 r58330  
    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.1/tools/local-env/scripts/install.js

    r54096 r58330  
    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.1/tools/local-env/scripts/start.js

    r54350 r58330  
    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.