diff --git a/.github/workflows/phpunit-tests.yml b/.github/workflows/phpunit-tests.yml index 434f71ddfa..1fc40c8332 100644 --- a/.github/workflows/phpunit-tests.yml +++ b/.github/workflows/phpunit-tests.yml @@ -24,6 +24,7 @@ env: # Controls which NPM script to use for running PHPUnit tests. Options ar `php` and `php-composer`. PHPUNIT_SCRIPT: php LOCAL_PHP_MEMCACHED: ${{ false }} + SLOW_TESTS: 'external-http,media,restapi' jobs: # Sets up the workflow for testing. @@ -66,7 +67,7 @@ jobs: # - Submit the test results to the WordPress.org host test results. # - todo: Configure Slack notifications for failing tests. test-php: - name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }} + name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }} ${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -74,8 +75,20 @@ jobs: php: [ '5.6.20', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0' ] os: [ ubuntu-latest ] memcached: [ false ] + split_slow: [ false ] multisite: [ false, true ] include: + # Additional "slow" jobs for PHP 5.6. + - php: '5.6.20' + os: ubuntu-latest + memcached: false + multisite: false + split_slow: true + - php: '5.6.20' + os: ubuntu-latest + memcached: false + multisite: true + split_slow: true # Include jobs for PHP 7.4 with memcached. - php: '7.4' os: ubuntu-latest @@ -189,22 +202,37 @@ jobs: - name: Install WordPress run: npm run env:install + - name: Run slow PHPUnit tests + if: ${{ matrix.split_slow }} + run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }} + + - name: Run PHPUnit tests for single site excluding slow tests + if: ${{ matrix.php < '7.0' && ! matrix.split_slow && ! matrix.multisite }} + run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-required + + - name: Run PHPUnit tests for Multisite excluding slow tests + if: ${{ matrix.php < '7.0' && ! matrix.split_slow && matrix.multisite }} + run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-excluded,oembed-headers + - name: Run PHPUnit tests + if: ${{ matrix.php >= '7.0' }} run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} - name: Run AJAX tests + if: ${{ ! matrix.split_slow }} run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax - name: Run ms-files tests as a multisite install - if: ${{ matrix.multisite }} + if: ${{ matrix.multisite && ! matrix.split_slow }} run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml --group ms-files - name: Run external HTTP tests - if: ${{ ! matrix.multisite }} + if: ${{ ! matrix.multisite && ! matrix.split_slow }} run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --group external-http # __fakegroup__ is excluded to force PHPUnit to ignore the settings in phpunit.xml.dist. - name: Run (xDebug) tests + if: ${{ ! matrix.split_slow }} run: LOCAL_PHP_XDEBUG=true npm run test:${{ env.PHPUNIT_SCRIPT }} -- -v --group xdebug --exclude-group __fakegroup__ - name: Checkout the WordPress Test Reporter