[wp-trac] [WordPress Trac] #47381: Remove the Composer lock file from version control

WordPress Trac noreply at wordpress.org
Wed Aug 4 19:49:11 UTC 2021


#47381: Remove the Composer lock file from version control
---------------------------------------------+-----------------------------
 Reporter:  johnbillion                      |       Owner:  hellofromTonya
     Type:  enhancement                      |      Status:  closed
 Priority:  normal                           |   Milestone:  5.9
Component:  Build/Test Tools                 |     Version:
 Severity:  normal                           |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests commit  |     Focuses:  coding-
                                             |  standards
---------------------------------------------+-----------------------------
Changes (by SergeyBiryukov):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"51545" 51545]:
 {{{
 #!CommitTicketReference repository="" revision="51545"
 Build/Test Tools: Switch to always running the tests via Composer.

 Previously the tests were run via a PHPUnit Phar file for PHP 5.6–7.4,
 with PHP 8.0 using a Composer-installed version of PHPUnit.

 Running the tests via a Phar without the need for a `composer install` is
 (marginally) faster in overall build time, however, this commit is part of
 a larger chain of changes which will make the test suite PHPUnit cross-
 version compatible.

 With an eye on those upcoming changes, which will allow us to run the
 tests on the most appropriate PHPUnit version for each supported PHP
 version, it is opportune to switch to using a Composer-installed version
 of PHPUnit for all PHP versions supported by WordPress. Previously this
 was not possible without additional conditional `update` commands being
 run, due to the `composer.lock` file being in place and being locked at
 PHPUnit 7.5.20.

 Switching over to using the Composer-installed PHPUnit version, with that
 PHPUnit version adjusting based on the PHP version, allows for some minor
 simplifications in the GitHub Actions script.

 This means we need additional measures to make sure that the Composer
 cache file does not go too far out of date as that would significantly
 slow down the builds.

 By adding a "Last Monday" date to the cache key, in combination with the
 pre-existing OS, PHP version and the hash of the `composer.json` file, we
 can guarantee that:
 1. There will be a cache created for each OS/PHP combination.
 2. These caches will be replaced whenever a change is made to the
 `composer.json` file.
 3. These caches will be replaced every Monday of each week ensuring that
 the cache file does not go too far out of date.

 Note: The NPM script `test:php` is now no longer needed during the builds.
 However, to prevent breaking the workflow of contributors who may be used
 to having the command available, the command remains available.

 In a future iteration we may be able to replace the caching of the
 Composer dependencies with the Composer cache action as offered on the
 GitHub marketplace, which would further simplify the script.

 Follow-up to [42960], [46290], [47881], [48957], [49037], [51543],
 [51544].

 Props jrf, desrosj.
 Fixes #47381.
 }}}

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


More information about the wp-trac mailing list