Make WordPress Core

Changeset 59452


Ignore:
Timestamp:
11/22/2024 04:58:55 PM (8 weeks ago)
Author:
desrosj
Message:

Build/Test Tools: Create reusable workflow for parsing .version-support-*.json files.

This extracts the logic responsible for parsing the .version-support-*.json files and returning a list of supported PHP and MySQL versions for a given branch of WordPress into a reusable workflow so that other workflows can make use of the functionality without repeating code.

See #62221.

Location:
trunk/.github/workflows
Files:
1 added
1 edited

Legend:

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

    r59402 r59452  
    1515    # Always test the workflow when changes are suggested.
    1616    paths:
     17      - '.version-support-*.json'
    1718      - '.github/workflows/install-testing.yml'
    18       - '.version-support-*.json'
     19      - '.github/workflows/reusable-support-json-reader-v1.yml'
     20
    1921  schedule:
    2022    - cron: '0 0 * * 1'
     
    3840
    3941jobs:
    40   # Determines the appropriate values for PHP and database versions based on the WordPress version being tested.
    41   #
    42   # Performs the following steps:
    43   # - Checks out the repository.
    44   # - Fetches the versions of PHP to test.
    45   # - Fetches the versions of MySQL to test.
    46   build-matrix:
    47     name: Determine PHP Versions to test
    48     runs-on: ubuntu-latest
     42  # Determines the supported values for PHP and database versions based on the WordPress version being tested.
     43  build-test-matrix:
     44    name: Build Test Matrix
     45    uses: WordPress/wordpress-develop/.github/workflows/reusable-support-json-reader-v1.yml@trunk
     46    permissions:
     47      contents: read
     48    secrets: inherit
    4949    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    50     timeout-minutes: 5
    51     outputs:
    52       major-wp-version: ${{ steps.major-wp-version.outputs.version }}
    53       php-versions: ${{ steps.php-versions.outputs.versions }}
    54       mysql-versions: ${{ steps.mysql-versions.outputs.versions }}
    55 
    56     steps:
    57       - name: Checkout repository
    58         uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
    59         with:
    60           show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
    61 
    62       - name: Determine the major WordPress version
    63         id: major-wp-version
    64         run: |
    65           if [ "${{ inputs.wp-version }}" ] && [ "${{ inputs.wp-version }}" != "nightly" ] && [ "${{ inputs.wp-version }}" != "latest" ]; then
    66             echo "version=$(echo "${{ inputs.wp-version }}" | tr '.' '-' | cut -d '-' -f1-2)" >> $GITHUB_OUTPUT
    67           elif [ "${{ inputs.wp-version }}" ]; then
    68             echo "version=$(echo "${{ inputs.wp-version }}")" >> $GITHUB_OUTPUT
    69           else
    70             echo "version=nightly" >> $GITHUB_OUTPUT
    71           fi
    72 
    73       # Look up the major version's specific PHP support policy when a version is provided.
    74       # Otherwise, use the current PHP support policy.
    75       - name: Get supported PHP versions
    76         id: php-versions
    77         run: |
    78           if [ "${{ steps.major-wp-version.outputs.version }}" != "latest" ] && [ "${{ steps.major-wp-version.outputs.version }}" != "nightly" ]; then
    79             echo "versions=$(jq -r '.["${{ steps.major-wp-version.outputs.version }}"] | @json' .version-support-php.json)" >> $GITHUB_OUTPUT
    80           else
    81             echo "versions=$(jq -r '.[ (keys[-1]) ] | @json' .version-support-php.json)" >> $GITHUB_OUTPUT
    82           fi
    83 
    84       # Look up the major version's specific MySQL support policy when a version is provided.
    85       # Otherwise, use the current MySQL support policy.
    86       - name: Get supported MySQL versions
    87         id: mysql-versions
    88         run: |
    89           if [ "${{ steps.major-wp-version.outputs.version }}" != "latest" ] && [ "${{ steps.major-wp-version.outputs.version }}" != "nightly" ]; then
    90             echo "versions=$(jq -r '.["${{ steps.major-wp-version.outputs.version }}"] | @json' .version-support-mysql.json)" >> $GITHUB_OUTPUT
    91           else
    92             echo "versions=$(jq -r '.[ (keys[-1]) ] | @json' .version-support-mysql.json)" >> $GITHUB_OUTPUT
    93           fi
     50    with:
     51      wp-version: ${{ inputs.wp-version }}
    9452
    9553  # Test the WordPress installation process through WP-CLI.
     
    10765    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    10866    timeout-minutes: 10
    109     needs: [ build-matrix ]
     67    needs: [ build-test-matrix ]
    11068    strategy:
    11169      fail-fast: false
    11270      matrix:
    11371        os: [ ubuntu-latest ]
    114         php: ${{ fromJSON( needs.build-matrix.outputs.php-versions ) }}
     72        php: ${{ fromJSON( needs.build-test-matrix.outputs.php-versions ) }}
    11573        db-type: [ 'mysql' ]
    116         db-version: ${{ fromJSON( needs.build-matrix.outputs.mysql-versions ) }}
     74        db-version: ${{ fromJSON( needs.build-test-matrix.outputs.mysql-versions ) }}
    11775        multisite: [ false, true ]
    11876        memcached: [ false ]
Note: See TracChangeset for help on using the changeset viewer.