Make WordPress Core

Changeset 59251


Ignore:
Timestamp:
10/18/2024 01:37:23 PM (13 months ago)
Author:
desrosj
Message:

Build/Test Tools: Add input for PHPUnit test group.

This adds a phpunit-test-goups input to the reusable PHPUnit test workflow for added flexibility.

When passed, only the specified test groups are run.

Props jrf.
See #52668.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/.github/workflows/reusable-phpunit-tests-v3.yml

    r59208 r59251  
    4343        type: 'string'
    4444        default: 'phpunit.xml.dist'
     45      phpunit-test-groups:
     46        description: 'A list of test groups to run.'
     47        required: false
     48        type: 'string'
     49        default: ''
    4550      tests-domain:
    4651        description: 'The domain to use for the tests'
     
    8893  # - Submit the test results to the WordPress.org host test results.
    8994  phpunit-tests:
    90     name: PHP ${{ inputs.php }} / ${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.multisite && ' multisite' || '' }}${{ inputs.memcached && ' with memcached' || '' }}${{ inputs.report && ' (test reporting enabled)' || '' }} ${{ 'example.org' != inputs.tests-domain && inputs.tests-domain || '' }}
     95    name: PHP ${{ inputs.php }} / ${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.multisite && ' multisite' || '' }}${{ inputs.phpunit-test-groups && format( ' ({0})', inputs.phpunit-test-groups ) || '' }}${{ inputs.memcached && ' with memcached' || '' }}${{ inputs.report && ' (test reporting enabled)' || '' }} ${{ 'example.org' != inputs.tests-domain && inputs.tests-domain || '' }}
    9196    runs-on: ${{ inputs.os }}
    9297    timeout-minutes: 20
     
    163168        run: npm run env:install
    164169
    165       - name: Run PHPUnit tests
    166         continue-on-error: ${{ inputs.allow-errors }}
    167         run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }}
     170      - name: Run PHPUnit tests${{ inputs.phpunit-test-groups && format( ' ({0} groups)', inputs.phpunit-test-groups ) || '' }}
     171        continue-on-error: ${{ inputs.allow-errors }}
     172        run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }}${{ inputs.phpunit-test-groups && format( ' --group {0}', inputs.phpunit-test-groups ) || '' }}
    168173
    169174      - name: Run AJAX tests
     175        if: ${{ ! inputs.phpunit-test-groups }}
    170176        continue-on-error: ${{ inputs.allow-errors }}
    171177        run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax
    172178
    173179      - name: Run ms-files tests as a multisite install
    174         if: ${{ inputs.multisite }}
     180        if: ${{ inputs.multisite && ! inputs.phpunit-test-groups }}
    175181        continue-on-error: ${{ inputs.allow-errors }}
    176182        run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ms-files
    177183
    178184      - name: Run external HTTP tests
    179         if: ${{ ! inputs.multisite }}
     185        if: ${{ ! inputs.multisite && ! inputs.phpunit-test-groups }}
    180186        continue-on-error: ${{ inputs.allow-errors }}
    181187        run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group external-http
     
    183189      # __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
    184190      - name: Run (Xdebug) tests
    185         if: ${{ inputs.php != '8.4' }}
     191        if: ${{ inputs.php != '8.4' && ! inputs.phpunit-test-groups }}
    186192        continue-on-error: ${{ inputs.allow-errors }}
    187193        run: LOCAL_PHP_XDEBUG=true node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit -v --group xdebug --exclude-group __fakegroup__
Note: See TracChangeset for help on using the changeset viewer.