Make WordPress Core

Changeset 51868


Ignore:
Timestamp:
09/24/2021 04:54:42 PM (3 years ago)
Author:
hellofromTonya
Message:

Build/Test Tools: Remove the PHPUnit container from local Docker environment.

This commit:

  • Removes the PHPUnit wordpressdevelop/phpunit container as a service to the Docker environment.
  • Updates test:php (the default way to run tests) to run the Composer PHPUnit package default.
  • Removes the test:php-composer script.

There is no longer a need for core to keep the wordpressdevelop/phpunit container as a service in docker-compose.yml. Removing it will reduce the overhead and bandwidth needed to set up WordPress locally and remove confusion about its use.

Follow-up to [45783-45784], [49099], [49362], [51545], [51736], [51685].

Props johnbillion, hellofromTonya.
Fixes #54112.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/.env

    r51179 r51868  
    77# Below, the following substitutions can be made:
    88# - '{version}': any major.minor PHP version from 5.2 onwards.
    9 # - '{phpunit_version}': any major PHPUnit version starting with 4.
    109##
    1110
     
    1817# The PHP version to use. Valid options are 'latest', and '{version}-fpm'.
    1918LOCAL_PHP=latest
    20 
    21 ##
    22 # The PHPUnit version to use when running tests.
    23 #
    24 # Support for new PHPUnit versions is not backported to past versions, so some old WordPress branches require an older
    25 # version to run tests.
    26 #
    27 # Valid versions are:
    28 # - 'latest' for the highest version of PHPUnit supported on the highest version of PHP supported.
    29 # - '{version}-fpm' for the highest version of PHPUnit supported on the specified version of PHP.
    30 # - '{phpunit_version}-php-{version}-fpm' for a specific version of PHPUnit on the specified version of PHP. This format
    31 # is only available for PHP versions 5.6 and higher.
    32 #
    33 # For the full list of available options, see https://hub.docker.com/r/wordpressdevelop/phpunit/tags.
    34 #
    35 # For full documentation on PHPUnit compatibility and WordPress versions, see
    36 # https://make.wordpress.org/core/handbook/references/phpunit-compatibility-and-wordpress-versions/.
    37 #
    38 # This defaults to the value assigned to the value of LOCAL_PHP.
    39 ##
    40 LOCAL_PHPUNIT=${LOCAL_PHP}
    4119
    4220# Whether or not to enable XDebug.
  • trunk/.github/workflows/phpunit-tests.yml

    r51736 r51868  
    192192      - name: Run slow PHPUnit tests
    193193        if: ${{ matrix.split_slow }}
    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 }}
     194        run: node ./tools/local-env/scripts/docker.js run 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: 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
     198        run: node ./tools/local-env/scripts/docker.js run 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: 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
     202        run: node ./tools/local-env/scripts/docker.js run 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: node ./tools/local-env/scripts/docker.js run --rm phpunit php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }}
     207        run: node ./tools/local-env/scripts/docker.js run 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: node ./tools/local-env/scripts/docker.js run --rm phpunit php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax
     212        run: node ./tools/local-env/scripts/docker.js run 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: node ./tools/local-env/scripts/docker.js run --rm phpunit php ./vendor/bin/phpunit --verbose -c tests/phpunit/multisite.xml --group ms-files
     217        run: node ./tools/local-env/scripts/docker.js run 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: node ./tools/local-env/scripts/docker.js run --rm phpunit php ./vendor/bin/phpunit --verbose -c phpunit.xml.dist --group external-http
     222        run: node ./tools/local-env/scripts/docker.js run 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 node ./tools/local-env/scripts/docker.js run --rm phpunit php ./vendor/bin/phpunit -v --group xdebug --exclude-group __fakegroup__
     228        run: LOCAL_PHP_XDEBUG=true node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit -v --group xdebug --exclude-group __fakegroup__
    229229
    230230      - name: Ensure version-controlled files are not modified or deleted
  • trunk/.github/workflows/test-coverage.yml

    r51671 r51868  
    144144      - name: Run tests as a single site
    145145        if: ${{ ! matrix.multisite }}
    146         run: npm run test:php-composer -- --verbose -c phpunit.xml.dist --coverage-clover wp-code-coverage-single-clover-${{ github.sha }}.xml
     146        run: npm run test:php -- --verbose -c phpunit.xml.dist --coverage-clover wp-code-coverage-single-clover-${{ github.sha }}.xml
    147147
    148148      - name: Ensure version-controlled files are not modified during the tests
     
    158158      - name: Run tests as a multisite install
    159159        if: ${{ matrix.multisite }}
    160         run: npm run test:php-composer -- --verbose -c tests/phpunit/multisite.xml --coverage-clover wp-code-coverage-multisite-clover-${{ github.sha }}.xml
     160        run: npm run test:php -- --verbose -c tests/phpunit/multisite.xml --coverage-clover wp-code-coverage-multisite-clover-${{ github.sha }}.xml
    161161
    162162      - name: Ensure version-controlled files are not modified during the tests
  • trunk/docker-compose.yml

    r51673 r51868  
    9393    init: true
    9494
    95   ##
    96   # The PHPUnit container.
    97   ##
    98   phpunit:
    99     image: wordpressdevelop/phpunit:${LOCAL_PHPUNIT-latest}
    100 
    101     networks:
    102       - wpdevnet
    103 
    104     environment:
    105       - LOCAL_PHP_XDEBUG=${LOCAL_PHP_XDEBUG-false}
    106       - LOCAL_PHP_MEMCACHED=${LOCAL_PHP_MEMCACHED-false}
    107       - PHP_FPM_UID=${PHP_FPM_UID-1000}
    108       - PHP_FPM_GID=${PHP_FPM_GID-1000}
    109       - LOCAL_DIR=${LOCAL_DIR-src}
    110       - WP_MULTISITE=${WP_MULTISITE-false}
    111       - GITHUB_REF=${GITHUB_REF-false}
    112       - GITHUB_EVENT_NAME=${GITHUB_EVENT_NAME-false}
    113 
    114     volumes:
    115       - ./tools/local-env/phpunit-config.ini:/usr/local/etc/php/conf.d/phpunit-config.ini
    116       - ./:/var/www
    117       - phpunit-uploads:/var/www/${LOCAL_DIR-src}/wp-content/uploads
    118 
    119     # The init directive ensures the command runs with a PID > 1, so Ctrl+C works correctly.
    120     init: true
    121 
    122     depends_on:
    123       - mysql
    124 
    12595volumes:
    12696  # So that sites aren't wiped every time containers are restarted, MySQL uses a persistent volume.
    12797  mysql: {}
    128   # Using a volume for the uploads directory improves PHPUnit performance.
    129   phpunit-uploads: {}
    13098
    13199networks:
  • trunk/package.json

    r51719 r51868  
    171171        "env:logs": "node ./tools/local-env/scripts/docker.js logs",
    172172        "env:pull": "node ./tools/local-env/scripts/docker.js pull",
    173         "test:php": "node ./tools/local-env/scripts/docker.js run -T php composer update -W && node ./tools/local-env/scripts/docker.js run --rm phpunit phpunit",
    174         "test:php-composer": "node ./tools/local-env/scripts/docker.js run -T php composer update -W && node ./tools/local-env/scripts/docker.js run --rm phpunit php ./vendor/bin/phpunit",
     173        "test:php": "node ./tools/local-env/scripts/docker.js run -T php composer update -W && node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit",
    175174        "test:e2e": "node ./tests/e2e/run-tests.js",
    176175        "wp-packages-update": "wp-scripts packages-update"
Note: See TracChangeset for help on using the changeset viewer.