Make WordPress Core


Ignore:
Timestamp:
12/22/2023 12:58:26 AM (10 months ago)
Author:
desrosj
Message:

Build/Test Tools: Make the install testing workflow more flexible.

In [56661], a new GitHub Actions workflow was introduced that focused on running some minimal installation tests for a version of WordPress for every PHP and MySQL combination.

This workflow has tested well, but lacks flexibility and possesses one flaw: tests are only ever performed with currently supported versions, even if the version being tested had a different support policy.

This updates the workflow to be more flexible, allowing all versions of WordPress currently receiving security fixes (back through 4.1) to be tested under the correct support policy.

Additionally, the workflow can now run against the nightly build of WordPress. This replaces latest as the new default. This allows the tests to be run at any point during a release cycle without the need for an officially tagged version.

Props jorbin, joemcgill, costdev.
See #58977.

File:
1 edited

Legend:

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

    r57197 r57218  
     1# Confirms that installing WordPress using WP-CLI works successfully.
     2#
     3# This workflow is not meant to test wordpress-develop checkouts, but rather tagged versions officially available on WordPress.org.
    14name: Installation Tests
    25
     
    1215    paths:
    1316      - '.github/workflows/install-testing.yml'
     17  schedule:
     18    - cron: '0 0 * * 1'
    1419  workflow_dispatch:
    1520    inputs:
     
    1722        description: 'The version to test installing. Accepts major and minor versions, "latest", or "nightly". Major releases must not end with ".0".'
    1823        type: string
    19         default: 'latest'
     24        default: 'nightly'
    2025
    2126# Cancels all previous workflow runs for pull requests that have not completed.
     
    2328  # The concurrency group contains the workflow name and the branch name for pull requests
    2429  # or the commit hash for any other events.
    25   group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
     30  group: ${{ github.workflow }}-${{ inputs.wp-version || github.event_name == 'pull_request' && github.head_ref || github.sha }}
    2631  cancel-in-progress: true
    2732
     
    3136
    3237jobs:
     38  # Determines the appropriate values for PHP and database versions based on the WordPress version being tested.
     39  #
     40  # Performs the following steps:
     41  # - Checks out the repository.
     42  # - Fetches the versions of PHP to test.
     43  # - Fetches the versions of MySQL to test.
     44  build-matrix:
     45    name: Determine PHP Versions to test
     46    runs-on: ubuntu-latest
     47    timeout-minutes: 5
     48    outputs:
     49      major-wp-version: ${{ steps.major-wp-version.outputs.version }}
     50      php-versions: ${{ steps.php-versions.outputs.versions }}
     51      mysql-versions: ${{ steps.mysql-versions.outputs.versions }}
     52
     53    steps:
     54      - name: Checkout repository
     55        uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
     56        with:
     57          show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
     58
     59      - name: Determine the major WordPress version
     60        id: major-wp-version
     61        run: |
     62          if [ "${{ inputs.wp-version }}" ] && [ "${{ inputs.wp-version }}" != "nightly" ] && [ "${{ inputs.wp-version }}" != "latest" ]; then
     63            echo "version=$(echo "${{ inputs.wp-version }}" | tr '.' '-' | cut -d '-' -f1-2)" >> $GITHUB_OUTPUT
     64          elif [ "${{ inputs.wp-version }}" ]; then
     65            echo "version=$(echo "${{ inputs.wp-version }}")" >> $GITHUB_OUTPUT
     66          else
     67            echo "version=nightly" >> $GITHUB_OUTPUT
     68          fi
     69
     70      # Look up the major version's specific PHP support policy when a version is provided.
     71      # Otherwise, use the current PHP support policy.
     72      - name: Get supported PHP versions
     73        id: php-versions
     74        run: |
     75          if [ "${{ steps.major-wp-version.outputs.version }}" != "latest" ] && [ "${{ steps.major-wp-version.outputs.version }}" != "nightly" ]; then
     76            echo "versions=$(jq -r '.["${{ steps.major-wp-version.outputs.version }}"] | @json' .version-support-php.json)" >> $GITHUB_OUTPUT
     77          else
     78            echo "versions=$(jq -r '.[ (keys[-1]) ] | @json' .version-support-php.json)" >> $GITHUB_OUTPUT
     79          fi
     80
     81      # Look up the major version's specific MySQL support policy when a version is provided.
     82      # Otherwise, use the current MySQL support policy.
     83      - name: Get supported MySQL versions
     84        id: mysql-versions
     85        run: |
     86          if [ "${{ steps.major-wp-version.outputs.version }}" != "latest" ] && [ "${{ steps.major-wp-version.outputs.version }}" != "nightly" ]; then
     87            echo "versions=$(jq -r '.["${{ steps.major-wp-version.outputs.version }}"] | @json' .version-support-mysql.json)" >> $GITHUB_OUTPUT
     88          else
     89            echo "versions=$(jq -r '.[ (keys[-1]) ] | @json' .version-support-mysql.json)" >> $GITHUB_OUTPUT
     90          fi
     91
    3392  # Test the WordPress installation process through WP-CLI.
    3493  #
     
    4099  # - Installs WordPress.
    41100  install-tests-mysql:
    42     name: WP ${{ inputs.wp-version || 'latest' }} / PHP ${{ matrix.php }} / ${{ 'mariadb' == matrix.db-type && 'MariaDB' || 'MySQL' }} ${{ matrix.db-version }}${{ matrix.multisite && ' multisite' || '' }}
     101    name: WP ${{ inputs.wp-version || 'nightly' }} / PHP ${{ matrix.php }} / ${{ 'mariadb' == matrix.db-type && 'MariaDB' || 'MySQL' }} ${{ matrix.db-version }}${{ matrix.multisite && ' multisite' || '' }}
    43102    permissions:
    44103      contents: read
    45     runs-on: ubuntu-latest
     104    runs-on: ${{ matrix.os }}
    46105    timeout-minutes: 10
     106    needs: [ build-matrix ]
    47107    strategy:
    48108      fail-fast: false
    49109      matrix:
    50110        os: [ ubuntu-latest ]
    51         php: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]
     111        php: ${{ fromJSON( needs.build-matrix.outputs.php-versions ) }}
    52112        db-type: [ 'mysql' ]
    53         db-version: [ '5.7', '8.0' ]
     113        db-version: ${{ fromJSON( needs.build-matrix.outputs.mysql-versions ) }}
    54114        multisite: [ false, true ]
     115        memcached: [ false ]
     116
     117        # Exclude some PHP and MySQL versions that cannot currently be tested with Docker containers.
     118        exclude:
     119          - php: '5.2'
     120          - php: '5.3'
     121          - db-version: '5.0'
     122          - db-version: '5.1'
     123          - db-version: '5.5'
    55124
    56125    services:
     
    59128        ports:
    60129          - 3306
    61         options: --health-cmd="mysqladmin ping" --health-interval=30s --health-timeout=10s --health-retries=5 -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=test_db --entrypoint sh ${{ matrix.db-type }}:${{ matrix.db-version }} -c "exec docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password"
     130        options: >-
     131          --health-cmd="mysqladmin ping"
     132          --health-interval=30s
     133          --health-timeout=10s
     134          --health-retries=5
     135          -e MYSQL_ROOT_PASSWORD=root
     136          -e MYSQL_DATABASE=test_db
     137          --entrypoint sh ${{ matrix.db-type }}:${{ matrix.db-version }}
     138          -c "exec docker-entrypoint.sh mysqld${{ matrix.db-version != '5.5' && ' --default-authentication-plugin=mysql_native_password"' || '' }}
    62139
    63140    steps:
     
    67144          php-version: '${{ matrix.php }}'
    68145          coverage: none
    69           tools: wp-cli
     146          tools: wp-cli${{ contains( fromJSON('["5.4", "5.5"]'), matrix.php ) && ':2.4.0' || '' }}
    70147
    71148      - name: Start the database server
     
    74151
    75152      - name: Download WordPress
    76         run: wp core download ${{ inputs.wp-version && 'latest' != inputs.wp-version && format( '--version={0}', inputs.wp-version ) || '' }}
     153        run: wp core download ${{ inputs.wp-version && format( '--version={0}', inputs.wp-version ) || '--version=nightly' }}
    77154
    78155      - name: Create wp-config.php file
Note: See TracChangeset for help on using the changeset viewer.