[wp-trac] [WordPress Trac] #53945: Local test workflow changes for installing Composer dependencies

WordPress Trac noreply at wordpress.org
Wed Aug 18 09:57:33 UTC 2021


#53945: Local test workflow changes for installing Composer dependencies
------------------------------+---------------------
 Reporter:  hellofromTonya    |       Owner:  (none)
     Type:  task (blessed)    |      Status:  new
 Priority:  normal            |   Milestone:  5.9
Component:  Build/Test Tools  |     Version:  trunk
 Severity:  normal            |  Resolution:
 Keywords:  needs-patch       |     Focuses:
------------------------------+---------------------

Comment (by netweb):

 I'm not able to get this working on either the `/trunk` or `/branches/5.8`
 branches

 It seems to ''hang'' when running the ''npm script'' `npm run env:install`

 I've added the `wp_cli_info()` script here only for debugging so that an
 additional script is run after `install_composer_dependancies()` as this
 was where the scripts appeared to be ''hung''


 {{{
 #!diff
 Index: tools/local-env/scripts/install.js
 ===================================================================
 --- tools/local-env/scripts/install.js  (revision 51632)
 +++ tools/local-env/scripts/install.js  (working copy)
 @@ -22,6 +22,10 @@

  install_wp_importer();

 +install_composer_dependancies();
 +
 +wp_cli_info();
 +
  // Read in wp-tests-config-sample.php, edit it to work with our config,
 then write it to wp-tests-config.php.
  const testConfig = readFileSync( 'wp-tests-config-sample.php', 'utf8' )
         .replace( 'youremptytestdbnamehere', 'wordpress_develop_tests' )
 @@ -57,3 +61,18 @@
         execSync( `docker-compose exec -T php rm -rf
 ${testPluginDirectory}`, { stdio: 'inherit' } );
         execSync( `docker-compose exec -T php git clone
 https://github.com/WordPress/wordpress-importer.git ${testPluginDirectory}
 --depth=1`, { stdio: 'inherit' } );
  }
 +
 +/**
 + * Installs the Composer package dependancies.
 + */
 +function install_composer_dependancies() {
 +       execSync( `docker-compose exec -T php composer install`, { stdio:
 'inherit' } );
 +}
 +
 +/**
 + * Get the environment information.
 + */
 +function wp_cli_info() {
 +       wp_cli( `cli info` );
 +
 +}
 }}}

 With the above patch, `composer install` is run and the `yoast/phpunit-
 polyfills` package is installed in the PHP Docker container:

 {{{
 #!sh
 No composer.lock file present. Updating dependencies to latest instead of
 installing from lock file. See https://getcomposer.org/install for more
 information.
 Loading composer repositories with package information
 Updating dependencies
 Lock file operations: 41 installs, 0 updates, 0 removals
   - Locking dealerdirect/phpcodesniffer-composer-installer (v0.7.1)
   - Locking doctrine/instantiator (1.4.0)
   - Locking myclabs/deep-copy (1.10.2)
   - Locking nikic/php-parser (v4.12.0)
   - Locking phar-io/manifest (2.0.3)
   - Locking phar-io/version (3.1.0)
   - Locking phpcompatibility/php-compatibility (9.3.5)
   - Locking phpcompatibility/phpcompatibility-paragonie (1.3.1)
   - Locking phpcompatibility/phpcompatibility-wp (2.1.2)
   - Locking phpdocumentor/reflection-common (2.2.0)
   - Locking phpdocumentor/reflection-docblock (5.2.2)
   - Locking phpdocumentor/type-resolver (1.4.0)
   - Locking phpspec/prophecy (1.13.0)
   - Locking phpunit/php-code-coverage (9.2.6)
   - Locking phpunit/php-file-iterator (3.0.5)
   - Locking phpunit/php-invoker (3.1.1)
   - Locking phpunit/php-text-template (2.0.4)
   - Locking phpunit/php-timer (5.0.3)
   - Locking phpunit/phpunit (9.5.8)
   - Locking sebastian/cli-parser (1.0.1)
   - Locking sebastian/code-unit (1.0.8)
   - Locking sebastian/code-unit-reverse-lookup (2.0.3)
   - Locking sebastian/comparator (4.0.6)
   - Locking sebastian/complexity (2.0.2)
   - Locking sebastian/diff (4.0.4)
   - Locking sebastian/environment (5.1.3)
   - Locking sebastian/exporter (4.0.3)
   - Locking sebastian/global-state (5.0.3)
   - Locking sebastian/lines-of-code (1.0.3)
   - Locking sebastian/object-enumerator (4.0.4)
   - Locking sebastian/object-reflector (2.0.4)
   - Locking sebastian/recursion-context (4.0.4)
   - Locking sebastian/resource-operations (3.0.3)
   - Locking sebastian/type (2.3.4)
   - Locking sebastian/version (3.0.2)
   - Locking squizlabs/php_codesniffer (3.6.0)
   - Locking symfony/polyfill-ctype (v1.23.0)
   - Locking theseer/tokenizer (1.2.1)
   - Locking webmozart/assert (1.10.0)
   - Locking wp-coding-standards/wpcs (2.3.0)
   - Locking yoast/phpunit-polyfills (1.0.1)
 Writing lock file
 Installing dependencies from lock file (including require-dev)
 Package operations: 41 installs, 0 updates, 0 removals
   - Downloading squizlabs/php_codesniffer (3.6.0)
   - Downloading dealerdirect/phpcodesniffer-composer-installer (v0.7.1)
   - Downloading myclabs/deep-copy (1.10.2)
   - Downloading phar-io/version (3.1.0)
   - Downloading phar-io/manifest (2.0.3)
   - Downloading phpcompatibility/php-compatibility (9.3.5)
   - Downloading phpcompatibility/phpcompatibility-paragonie (1.3.1)
   - Downloading phpcompatibility/phpcompatibility-wp (2.1.2)
   - Downloading phpdocumentor/reflection-common (2.2.0)
   - Downloading phpdocumentor/type-resolver (1.4.0)
   - Downloading sebastian/recursion-context (4.0.4)
   - Downloading sebastian/exporter (4.0.3)
   - Downloading sebastian/diff (4.0.4)
   - Downloading sebastian/comparator (4.0.6)
   - Downloading symfony/polyfill-ctype (v1.23.0)
   - Downloading webmozart/assert (1.10.0)
   - Downloading phpdocumentor/reflection-docblock (5.2.2)
   - Downloading doctrine/instantiator (1.4.0)
   - Downloading phpspec/prophecy (1.13.0)
   - Downloading theseer/tokenizer (1.2.1)
   - Downloading sebastian/version (3.0.2)
   - Downloading nikic/php-parser (v4.12.0)
   - Downloading sebastian/lines-of-code (1.0.3)
   - Downloading sebastian/environment (5.1.3)
   - Downloading sebastian/complexity (2.0.2)
   - Downloading sebastian/code-unit-reverse-lookup (2.0.3)
   - Downloading phpunit/php-text-template (2.0.4)
   - Downloading phpunit/php-file-iterator (3.0.5)
   - Downloading phpunit/php-code-coverage (9.2.6)
   - Downloading phpunit/php-invoker (3.1.1)
   - Downloading phpunit/php-timer (5.0.3)
   - Downloading sebastian/cli-parser (1.0.1)
   - Downloading sebastian/code-unit (1.0.8)
   - Downloading sebastian/object-reflector (2.0.4)
   - Downloading sebastian/global-state (5.0.3)
   - Downloading sebastian/object-enumerator (4.0.4)
   - Downloading sebastian/resource-operations (3.0.3)
   - Downloading sebastian/type (2.3.4)
   - Downloading wp-coding-standards/wpcs (2.3.0)
   - Downloading phpunit/phpunit (9.5.8)
   - Downloading yoast/phpunit-polyfills (1.0.1)
   0/41 [>---------------------------]   0%
   8/41 [=====>----------------------]  19%
   9/41 [======>---------------------]  21%
  10/41 [======>---------------------]  24%
  15/41 [==========>-----------------]  36%
  18/41 [============>---------------]  43%
  19/41 [============>---------------]  46%
  20/41 [=============>--------------]  48%
  25/41 [=================>----------]  60%
  27/41 [==================>---------]  65%
  29/41 [===================>--------]  70%
  34/41 [=======================>----]  82%
  38/41 [=========================>--]  92%
  39/41 [==========================>-]  95%
  40/41 [===========================>]  97%
  41/41 [============================] 100%
   - Installing squizlabs/php_codesniffer (3.6.0): Extracting archive
   - Installing dealerdirect/phpcodesniffer-composer-installer (v0.7.1):
 Extracting archive
   - Installing myclabs/deep-copy (1.10.2): Extracting archive
   - Installing phar-io/version (3.1.0): Extracting archive
   - Installing phar-io/manifest (2.0.3): Extracting archive
   - Installing phpcompatibility/php-compatibility (9.3.5): Extracting
 archive
   - Installing phpcompatibility/phpcompatibility-paragonie (1.3.1):
 Extracting archive
   - Installing phpcompatibility/phpcompatibility-wp (2.1.2): Extracting
 archive
   - Installing phpdocumentor/reflection-common (2.2.0): Extracting archive
   - Installing phpdocumentor/type-resolver (1.4.0): Extracting archive
   - Installing sebastian/recursion-context (4.0.4): Extracting archive
   - Installing sebastian/exporter (4.0.3): Extracting archive
   - Installing sebastian/diff (4.0.4): Extracting archive
   - Installing sebastian/comparator (4.0.6): Extracting archive
   - Installing symfony/polyfill-ctype (v1.23.0): Extracting archive
   - Installing webmozart/assert (1.10.0): Extracting archive
   - Installing phpdocumentor/reflection-docblock (5.2.2): Extracting
 archive
   - Installing doctrine/instantiator (1.4.0): Extracting archive
   - Installing phpspec/prophecy (1.13.0): Extracting archive
   - Installing theseer/tokenizer (1.2.1): Extracting archive
   - Installing sebastian/version (3.0.2): Extracting archive
   - Installing nikic/php-parser (v4.12.0): Extracting archive
   - Installing sebastian/lines-of-code (1.0.3): Extracting archive
   - Installing sebastian/environment (5.1.3): Extracting archive
   - Installing sebastian/complexity (2.0.2): Extracting archive
   - Installing sebastian/code-unit-reverse-lookup (2.0.3): Extracting
 archive
   - Installing phpunit/php-text-template (2.0.4): Extracting archive
   - Installing phpunit/php-file-iterator (3.0.5): Extracting archive
   - Installing phpunit/php-code-coverage (9.2.6): Extracting archive
   - Installing phpunit/php-invoker (3.1.1): Extracting archive
   - Installing phpunit/php-timer (5.0.3): Extracting archive
   - Installing sebastian/cli-parser (1.0.1): Extracting archive
   - Installing sebastian/code-unit (1.0.8): Extracting archive
   - Installing sebastian/object-reflector (2.0.4): Extracting archive
   - Installing sebastian/global-state (5.0.3): Extracting archive
   - Installing sebastian/object-enumerator (4.0.4): Extracting archive
   - Installing sebastian/resource-operations (3.0.3): Extracting archive
   - Installing sebastian/type (2.3.4): Extracting archive
   - Installing wp-coding-standards/wpcs (2.3.0): Extracting archive
   - Installing phpunit/phpunit (9.5.8): Extracting archive
   - Installing yoast/phpunit-polyfills (1.0.1): Extracting archive
   0/39 [>---------------------------]   0%
   9/39 [======>---------------------]  23%
  10/39 [=======>--------------------]  25%
  17/39 [============>---------------]  43%
  19/39 [=============>--------------]  48%
  25/39 [=================>----------]  64%
  29/39 [====================>-------]  74%
  35/39 [=========================>--]  89%
  37/39 [==========================>-]  94%
  38/39 [===========================>]  97%
  39/39 [============================] 100%
 9 package suggestions were added by new dependencies, use `composer
 suggest` to see details.
 Generating autoload files
 26 packages you are using are looking for funding.
 Use the `composer fund` command to find out more!
 }}}


 This is as far as I can get, but I'd be interested to here any feedback
 from others who are able to run this in either the `/trunk` or
 `/branches/5.8` branches

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53945#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list