Make WordPress Core

Changeset 60534


Ignore:
Timestamp:
08/01/2025 12:42:18 PM (9 months ago)
Author:
desrosj
Message:

Build/Test Tools: Spawn fewer jobs in GitHub Actions on forks.

The GitHub Actions workflows currently limit when jobs run for forks by short-circuiting any that are triggered by push events when not running within the wordpress-develop repository.

Because the large majority of forks are not created under organizations, they will be subject to the individual account limit of 20 concurrent jobs (40 for pro accounts) at any given time instead of the 500 concurrent job limit that applies to the WordPress organization. This means that a single pull request back to a fork can take several hours to complete the workflow jobs that are spawned.

This revises the conditional statements to further limit the number of jobs that spawn within a fork while still allowing the full test matrices for forks within the WordPress organization and pull requests back to wordpress-develop.

These adjustments result in a maximum of 53 jobs when all workflows configured to run within forks are triggered. Of these, ~66% will run in less than 3 minutes, and ~55% will run in less than 1 minute.

Props jorbin, johnbillion.
Fixes #63752.

Location:
trunk/.github/workflows
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/.github/workflows/install-testing.yml

    r60532 r60534  
    4848      contents: read
    4949    secrets: inherit
    50     if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }}
     50    if: ${{ github.repository == 'WordPress/wordpress-develop' }}
    5151    with:
    5252      wp-version: ${{ inputs.wp-version }}
     
    6464      contents: read
    6565    runs-on: ${{ matrix.os }}
    66     if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }}
     66    if: ${{ github.repository == 'WordPress/wordpress-develop' }}
    6767    timeout-minutes: 10
    6868    needs: [ build-test-matrix ]
  • trunk/.github/workflows/local-docker-environment.yml

    r60532 r60534  
    7474      contents: read
    7575    secrets: inherit
    76     if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }}
     76    if: ${{ github.repository == 'WordPress/wordpress-develop' }}
    7777    with:
    7878      wp-version: ${{ github.event_name == 'pull_request' && github.base_ref || github.ref_name }}
  • trunk/.github/workflows/phpunit-tests.yml

    r60532 r60534  
    6464      contents: read
    6565    secrets: inherit
    66     if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }}
     66    if: ${{ startsWith( github.repository, 'WordPress/' ) && ( github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) ) }}
    6767    strategy:
    6868      fail-fast: false
     
    141141      contents: read
    142142    secrets: inherit
    143     if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }}
     143    if: ${{ startsWith( github.repository, 'WordPress/' ) && ( github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) ) }}
    144144    strategy:
    145145      fail-fast: false
     
    193193      contents: read
    194194    secrets: inherit
    195     if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }}
     195    if: ${{ startsWith( github.repository, 'WordPress/' ) && ( github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) ) }}
    196196    strategy:
    197197      fail-fast: false
     
    233233      contents: read
    234234    secrets: inherit
    235     if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }}
     235    if: ${{ startsWith( github.repository, 'WordPress/' ) && ( github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) ) }}
    236236    strategy:
    237237      fail-fast: false
     
    247247      phpunit-test-groups: ${{ matrix.phpunit-test-groups }}
    248248
     249  #
     250  # Runs unit tests for forks.
     251  #
     252  # Because the majority of forks will belong to personal GitHub accounts (which are limited to just 20 concurrent jobs
     253  # at any given time), forks only run a small subset of test combinations. This allows contributors to open pull
     254  # requests back to their own forks for testing purposes without having to wait hours for workflow to complete.
     255  #
     256  limited-matrix-for-forks:
     257    name: PHP ${{ matrix.php }}
     258    uses: ./.github/workflows/reusable-phpunit-tests-v3.yml
     259    permissions:
     260      contents: read
     261    secrets: inherit
     262    if: ${{ ! startsWith( github.repository, 'WordPress/' ) && github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' }}
     263    strategy:
     264      fail-fast: false
     265      matrix:
     266        php: [ '7.2', '8.4' ]
     267        db-version: [ '8.4', '11.8' ]
     268        db-type: [ 'mysql', 'mariadb' ]
     269        multisite: [ false ]
     270
     271        include:
     272          # Include one multisite job for each database type.
     273          - php: '8.4'
     274            db-version: '8.4'
     275            db-type: 'mysql'
     276            multisite: true
     277          - php: '8.4'
     278            db-version: '11.8'
     279            db-type: 'mariadb'
     280            multisite: true
     281          # Test with memcached.
     282          - php: '8.4'
     283            db-version: '8.4'
     284            db-type: 'mysql'
     285            multisite: true
     286            memcached: true
     287          # Run specific test groups once.
     288          - php: '8.4'
     289            db-version: '8.4'
     290            db-type: 'mysql'
     291            phpunit-test-groups: 'html-api-html5lib-tests'
     292
     293        exclude:
     294          # Exclude PHP versions that are not supported by the database versions.
     295          - db-type: 'mysql'
     296            db-version: '11.8'
     297          - db-type: 'mariadb'
     298            db-version: '8.4'
     299
     300    with:
     301      php: ${{ matrix.php }}
     302      db-version: ${{ matrix.db-version }}
     303      db-type: ${{ matrix.db-type }}
     304      memcached: ${{ matrix.memcached || false }}
     305      phpunit-test-groups: ${{ matrix.phpunit-test-groups || '' }}
     306
    249307  slack-notifications:
    250308    name: Slack Notifications
     
    253311      actions: read
    254312      contents: read
    255     needs: [ test-with-mysql, test-with-mariadb, test-innovation-releases, specific-test-groups ]
     313    needs: [ test-with-mysql, test-with-mariadb, test-innovation-releases, specific-test-groups, limited-matrix-for-forks ]
    256314    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
    257315    with:
  • trunk/.github/workflows/test-and-zip-default-themes.yml

    r60348 r60534  
    190190    needs: [ check-for-empty-files, test-build-scripts ]
    191191    timeout-minutes: 10
    192     if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
     192    if: ${{ github.repository == 'WordPress/wordpress-develop' }}
    193193    strategy:
    194194      fail-fast: false
  • trunk/.github/workflows/test-build-processes.yml

    r60080 r60534  
    4646
    4747jobs:
    48   # Tests the WordPress Core build process on multiple operating systems.
     48  # Tests the WordPress Core build process.
    4949  test-core-build-process:
    5050    name: Core running from ${{ matrix.directory }}
     
    5656      fail-fast: false
    5757      matrix:
    58         os: [ ubuntu-24.04, windows-2022 ]
     58        os: [ 'ubuntu-24.04' ]
    5959        directory: [ 'src', 'build' ]
    6060        include:
    6161          # Only prepare artifacts for Playground once.
    62           - os: ubuntu-24.04
     62          - os: 'ubuntu-24.04'
    6363            directory: 'build'
    6464            save-build: true
    6565            prepare-playground: ${{ github.event_name == 'pull_request' && true || '' }}
    66 
    6766    with:
    6867      os: ${{ matrix.os }}
     
    7170      prepare-playground: ${{ matrix.prepare-playground && matrix.prepare-playground || false }}
    7271
    73   # Tests the WordPress Core build process on MacOS.
     72  # Tests the WordPress Core build process on additional operating systems.
    7473  #
    75   # This is separate from the job above in order to use stricter conditions when determining when to run.
    76   # This avoids unintentionally consuming excessive minutes, as MacOS jobs consume minutes at a 10x rate.
     74  # This is separate from the job above in order to use stricter conditions when determining when to test additional
     75  # operating systems. This avoids unintentionally consuming excessive minutes. Windows-based jobs consume minutes at a
     76  # 2x rate, and MacOS-based jobs at a 10x rate.
     77  # See https://docs.github.com/en/billing/concepts/product-billing/github-actions#per-minute-rates.
    7778  #
    7879  # The `matrix` and `runner` contexts are not available for use within `if` expressions. So there is
    7980  # currently no way to determine the OS being used on a given job.
    8081  # See https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability.
    81   test-core-build-process-macos:
     82  test-core-build-process-additional-os:
    8283    name: Core running from ${{ matrix.directory }}
    8384    uses: ./.github/workflows/reusable-test-core-build-process.yml
     
    8889      fail-fast: false
    8990      matrix:
    90         os: [ macos-14 ]
     91        os: [ 'macos-14', 'windows-2022' ]
    9192        directory: [ 'src', 'build' ]
    9293    with:
     
    9495      directory: ${{ matrix.directory }}
    9596
    96   # Tests the Gutenberg plugin build process on multiple operating systems when run within a wordpress-develop checkout.
     97  # Tests the Gutenberg plugin build process within a wordpress-develop checkout.
    9798  test-gutenberg-build-process:
    98     name: Gutenberg running from ${{ matrix.directory }}
    99     uses: ./.github/workflows/reusable-test-gutenberg-build-process.yml
    100     permissions:
    101       contents: read
    102     if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }}
    103     strategy:
    104       fail-fast: false
    105       matrix:
    106         os: [ ubuntu-24.04, windows-2022 ]
    107         directory: [ 'src', 'build' ]
    108     with:
    109       os: ${{ matrix.os }}
    110       directory: ${{ matrix.directory }}
    111 
    112   # Tests the Gutenberg plugin build process on MacOS when run within a wordpress-develop checkout.
    113   #
    114   # This is separate from the job above in order to use stricter conditions when determining when to run.
    115   # This avoids unintentionally consuming excessive minutes, as MacOS jobs consume minutes at a 10x rate.
    116   #
    117   # The `matrix` and `runner` contexts are not available for use within `if` expressions. So there is
    118   # currently no way to determine the OS being used on a given job.
    119   # See https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability.
    120   test-gutenberg-build-process-macos:
    12199    name: Gutenberg running from ${{ matrix.directory }}
    122100    uses: ./.github/workflows/reusable-test-gutenberg-build-process.yml
     
    127105      fail-fast: false
    128106      matrix:
    129         os: [ macos-14 ]
     107        os: [ 'ubuntu-24.04' ]
     108        directory: [ 'src', 'build' ]
     109    with:
     110      os: ${{ matrix.os }}
     111      directory: ${{ matrix.directory }}
     112
     113  # Tests the Gutenberg plugin build process on additional operating systems.
     114  #
     115  # This is separate from the job above in order to use stricter conditions when determining when to test additional
     116  # operating systems. This avoids unintentionally consuming excessive minutes. Windows-based jobs consume minutes at a
     117  # 2x rate, and MacOS-based jobs at a 10x rate.
     118  # See https://docs.github.com/en/billing/concepts/product-billing/github-actions#per-minute-rates.
     119  #
     120  # The `matrix` and `runner` contexts are not available for use within `if` expressions. So there is
     121  # currently no way to determine the OS being used on a given job.
     122  # See https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability.
     123  test-gutenberg-build-process-additional-os:
     124    name: Gutenberg running from ${{ matrix.directory }}
     125    uses: ./.github/workflows/reusable-test-gutenberg-build-process.yml
     126    permissions:
     127      contents: read
     128    if: ${{ github.repository == 'WordPress/wordpress-develop' }}
     129    strategy:
     130      fail-fast: false
     131      matrix:
     132        os: [ 'macos-14', 'windows-2022' ]
    130133        directory: [ 'src', 'build' ]
    131134    with:
     
    139142      actions: read
    140143      contents: read
    141     needs: [ test-core-build-process, test-core-build-process-macos, test-gutenberg-build-process, test-gutenberg-build-process-macos ]
     144    needs: [ test-core-build-process, test-core-build-process-additional-os, test-gutenberg-build-process, test-gutenberg-build-process-additional-os ]
    142145    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
    143146    with:
  • trunk/.github/workflows/upgrade-develop-testing.yml

    r60321 r60534  
    4848    name: Build
    4949    uses: ./.github/workflows/reusable-build-package.yml
     50    if: ${{ startsWith( github.repository, 'WordPress/' ) && ( github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) ) }}
    5051    permissions:
    5152      contents: read
     
    5556    name: Upgrade from ${{ matrix.wp }}
    5657    uses: ./.github/workflows/reusable-upgrade-testing.yml
    57     if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }}
     58    if: ${{ github.repository == 'WordPress/wordpress-develop' }}
    5859    needs: [ build ]
    5960    strategy:
     
    7576          - php: '8.4'
    7677            wp: '4.9'
     78    with:
     79      os: ${{ matrix.os }}
     80      php: ${{ matrix.php }}
     81      db-type: ${{ matrix.db-type }}
     82      db-version: ${{ matrix.db-version }}
     83      wp: ${{ matrix.wp }}
     84      new-version: develop
     85      multisite: ${{ matrix.multisite }}
     86
     87  # Run a limited set of upgrade tests for the current branch on forks.
     88  upgrade-tests-develop-forks:
     89    name: Upgrade from ${{ matrix.wp }}
     90    uses: ./.github/workflows/reusable-upgrade-testing.yml
     91    if: ${{ github.repository != 'WordPress/wordpress-develop' }}
     92    needs: [ build ]
     93    strategy:
     94      fail-fast: false
     95      matrix:
     96        os: [ 'ubuntu-24.04' ]
     97        php: [ '7.2', '8.4' ]
     98        db-type: [ 'mysql' ]
     99        db-version: [ '8.4' ]
     100        # WordPress 4.9 is the oldest version that supports PHP 7.2.
     101        wp: [ '6.7', '6.8' ]
     102        multisite: [ false, true ]
     103
     104        exclude:
     105          # The PHP <= 7.3/MySQL 8.4 jobs currently fail due to mysql_native_password being disabled by default. See https://core.trac.wordpress.org/ticket/61218.
     106          - php: '7.2'
     107            db-version: '8.4'
    77108    with:
    78109      os: ${{ matrix.os }}
  • trunk/.github/workflows/upgrade-testing.yml

    r60532 r60534  
    5959    name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }}
    6060    uses: ./.github/workflows/reusable-upgrade-testing.yml
    61     if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }}
     61    if: ${{ github.repository == 'WordPress/wordpress-develop' }}
    6262    strategy:
    6363      fail-fast: false
     
    9494    name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }}
    9595    uses: ./.github/workflows/reusable-upgrade-testing.yml
    96     if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }}
     96    if: ${{ github.repository == 'WordPress/wordpress-develop' }}
    9797    strategy:
    9898      fail-fast: false
     
    122122    name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }}
    123123    uses: ./.github/workflows/reusable-upgrade-testing.yml
    124     if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }}
     124    if: ${{ github.repository == 'WordPress/wordpress-develop' }}
    125125    strategy:
    126126      fail-fast: false
     
    154154    name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }}
    155155    uses: ./.github/workflows/reusable-upgrade-testing.yml
    156     if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }}
     156    if: ${{ github.repository == 'WordPress/wordpress-develop' }}
    157157    strategy:
    158158      fail-fast: false
     
    182182    name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }}
    183183    uses: ./.github/workflows/reusable-upgrade-testing.yml
    184     if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }}
     184    if: ${{ github.repository == 'WordPress/wordpress-develop' }}
    185185    strategy:
    186186      fail-fast: false
Note: See TracChangeset for help on using the changeset viewer.