Skip to content

Commit 0404d8a

Browse files
committed
[#660] Fixed required Composer version constraint and added a CI job.
1 parent 672cbc5 commit 0404d8a

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

.github/workflows/ci.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,26 @@ jobs:
8585
8686
- name: Run a single unit test to verify the testing setup
8787
run: ./vendor/bin/phpunit -c ./web/core ./web/core/modules/user/tests/src/Unit/UserAccessControlHandlerTest.php
88+
89+
# Using outdated Composer version to test the Composer version constraint.
90+
test-composer:
91+
runs-on: ubuntu-latest
92+
93+
steps:
94+
95+
- name: Checkout
96+
uses: actions/checkout@v2
97+
98+
- name: Setup PHP
99+
uses: shivammathur/setup-php@v2
100+
with:
101+
php-version: 8.2
102+
extensions: gd, pdo_sqlite
103+
tools: composer:v2.2
104+
105+
- name: Show Composer version
106+
run: composer --version
107+
108+
- name: Install dependencies
109+
# This command should fail because of the Composer version constraint.
110+
run: composer --verbose install && exit 1 || exit 0

scripts/composer/ScriptHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ public static function checkComposerVersion(Event $event) {
9292
if ($version === '@package_version@' || $version === '@package_branch_alias_version@') {
9393
$io->writeError('<warning>You are running a development version of Composer. If you experience problems, please update Composer to the latest stable version.</warning>');
9494
}
95-
elseif (Comparator::lessThan($version, '1.0.0')) {
96-
$io->writeError('<error>Drupal-project requires Composer version 1.0.0 or higher. Please update your Composer before continuing</error>.');
95+
elseif (Comparator::lessThan($version, '2.3.6')) {
96+
$io->writeError('<error>Drupal-project requires Composer version 2.3.6 or higher. Please update your Composer before continuing</error>.');
9797
exit(1);
9898
}
9999
}

0 commit comments

Comments
 (0)