From 42a49a8363be517c4512c1f39604dace57aaa5e0 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Thu, 22 Aug 2024 04:01:34 +0200 Subject: [PATCH] Composer: prevent a lock file from being created Composer 1.10.0 introduced a `lock` config option, which, when set to `false` will prevent a `composer.lock` file from being created and will ignore it when one exists. This is a useful option for libraries such as this where the `lock` file has no meaning. It also makes life easier for contributors as they don't have to remember that for this repo they should use `composer update` instead of `composer install`. Both will now work the same. Refs: https://getcomposer.org/doc/06-config.md#lock --- .github/workflows/quicktest.yml | 4 ++++ .github/workflows/test.yml | 4 ++++ composer.json | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/quicktest.yml b/.github/workflows/quicktest.yml index fff3cfa4..5aeae65b 100644 --- a/.github/workflows/quicktest.yml +++ b/.github/workflows/quicktest.yml @@ -51,6 +51,10 @@ jobs: ini-values: error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On coverage: none + - name: Enable creation of `composer.lock` file + if: ${{ matrix.dependencies == 'lowest' }} + run: composer config --unset lock + # Install dependencies and handle caching in one go. # @link https://github.com/marketplace/actions/install-php-dependencies-with-composer - name: Install Composer dependencies diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ab08a031..17c10b36 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -123,6 +123,10 @@ jobs: sirbrillig/phpcs-variable-analysis:"2.x" wp-coding-standards/wpcs:"dev-develop" + - name: Enable creation of `composer.lock` file + if: ${{ matrix.dependencies == 'lowest' }} + run: composer config --unset lock + # Install dependencies and handle caching in one go. # @link https://github.com/marketplace/actions/install-php-dependencies-with-composer - name: Install Composer dependencies diff --git a/composer.json b/composer.json index c65c23bb..e02138dc 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,8 @@ "config": { "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true - } + }, + "lock": false }, "scripts": { "test-ruleset": "bin/ruleset-tests",