Make WordPress Core

Changeset 51736


Ignore:
Timestamp:
09/07/2021 07:22:57 PM (3 years ago)
Author:
johnbillion
Message:

Build/Test Tools: Fix CI for running tests on PHP 8.1.

This fixes the CI for PHP 8.1 while retaining the needed improvements for local testing when running npm run test:php-composer by:

  • Replacing the npm script with the full node command
  • Removing the composer update command from the env:install process

Props BinaryKitten, hellofromTonya

See #53945

Location:
trunk
Files:
2 edited

Legend:

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

    r51670 r51736  
    192192      - name: Run slow PHPUnit tests
    193193        if: ${{ matrix.split_slow }}
    194         run: npm run test:php-composer -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }}
     194        run: node ./tools/local-env/scripts/docker.js run --rm phpunit php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }}
    195195
    196196      - name: Run PHPUnit tests for single site excluding slow tests
    197197        if: ${{ matrix.php < '7.0' && ! matrix.split_slow && ! matrix.multisite }}
    198         run: npm run test:php-composer -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-required
     198        run: node ./tools/local-env/scripts/docker.js run --rm phpunit php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-required
    199199
    200200      - name: Run PHPUnit tests for Multisite excluding slow tests
    201201        if: ${{ matrix.php < '7.0' && ! matrix.split_slow && matrix.multisite }}
    202         run: npm run test:php-composer -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-excluded,oembed-headers
     202        run: node ./tools/local-env/scripts/docker.js run --rm phpunit php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-excluded,oembed-headers
    203203
    204204      - name: Run PHPUnit tests
    205205        if: ${{ matrix.php >= '7.0' }}
    206206        continue-on-error: ${{ matrix.php == '8.1' }}
    207         run: npm run test:php-composer -- --verbose -c ${{ env.PHPUNIT_CONFIG }}
     207        run: node ./tools/local-env/scripts/docker.js run --rm phpunit php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }}
    208208
    209209      - name: Run AJAX tests
    210210        if: ${{ ! matrix.split_slow }}
    211211        continue-on-error: ${{ matrix.php == '8.1' }}
    212         run: npm run test:php-composer -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax
     212        run: node ./tools/local-env/scripts/docker.js run --rm phpunit php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax
    213213
    214214      - name: Run ms-files tests as a multisite install
    215215        if: ${{ matrix.multisite && ! matrix.split_slow }}
    216216        continue-on-error: ${{ matrix.php == '8.1' }}
    217         run: npm run test:php-composer -- --verbose -c tests/phpunit/multisite.xml --group ms-files
     217        run: node ./tools/local-env/scripts/docker.js run --rm phpunit php ./vendor/bin/phpunit --verbose -c tests/phpunit/multisite.xml --group ms-files
    218218
    219219      - name: Run external HTTP tests
    220220        if: ${{ ! matrix.multisite && ! matrix.split_slow }}
    221221        continue-on-error: ${{ matrix.php == '8.1' }}
    222         run: npm run test:php-composer -- --verbose -c phpunit.xml.dist --group external-http
     222        run: node ./tools/local-env/scripts/docker.js run --rm phpunit php ./vendor/bin/phpunit --verbose -c phpunit.xml.dist --group external-http
    223223
    224224      # __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
     
    226226        if: ${{ ! matrix.split_slow }}
    227227        continue-on-error: ${{ matrix.php == '8.1' }}
    228         run: LOCAL_PHP_XDEBUG=true npm run test:php-composer -- -v --group xdebug --exclude-group __fakegroup__
     228        run: LOCAL_PHP_XDEBUG=true node ./tools/local-env/scripts/docker.js run --rm phpunit php ./vendor/bin/phpunit -v --group xdebug --exclude-group __fakegroup__
    229229
    230230      - name: Ensure version-controlled files are not modified or deleted
  • trunk/tools/local-env/scripts/install.js

    r51685 r51736  
    2222
    2323install_wp_importer();
    24 
    25 install_composer_dependencies();
    2624
    2725// Read in wp-tests-config-sample.php, edit it to work with our config, then write it to wp-tests-config.php.
     
    6058    execSync( `docker-compose exec -T php git clone https://github.com/WordPress/wordpress-importer.git ${testPluginDirectory} --depth=1`, { stdio: 'inherit' } );
    6159}
    62 
    63 /**
    64  * Installs the Composer package dependencies within the Docker environment.
    65  */
    66 function install_composer_dependencies() {
    67     execSync( `docker-compose run -T php composer update -W`, { stdio: 'inherit' } );
    68 }
Note: See TracChangeset for help on using the changeset viewer.