Skip to content

Commit

Permalink
[#660] Fixed required Composer version constraint and added a CI job.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSkrypnyk committed May 17, 2024
1 parent 672cbc5 commit 0404d8a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,26 @@ jobs:
- name: Run a single unit test to verify the testing setup
run: ./vendor/bin/phpunit -c ./web/core ./web/core/modules/user/tests/src/Unit/UserAccessControlHandlerTest.php

# Using outdated Composer version to test the Composer version constraint.
test-composer:
runs-on: ubuntu-latest

steps:

- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: gd, pdo_sqlite
tools: composer:v2.2

- name: Show Composer version
run: composer --version

- name: Install dependencies
# This command should fail because of the Composer version constraint.
run: composer --verbose install && exit 1 || exit 0
4 changes: 2 additions & 2 deletions scripts/composer/ScriptHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ public static function checkComposerVersion(Event $event) {
if ($version === '@package_version@' || $version === '@package_branch_alias_version@') {
$io->writeError('<warning>You are running a development version of Composer. If you experience problems, please update Composer to the latest stable version.</warning>');
}
elseif (Comparator::lessThan($version, '1.0.0')) {
$io->writeError('<error>Drupal-project requires Composer version 1.0.0 or higher. Please update your Composer before continuing</error>.');
elseif (Comparator::lessThan($version, '2.3.6')) {
$io->writeError('<error>Drupal-project requires Composer version 2.3.6 or higher. Please update your Composer before continuing</error>.');
exit(1);
}
}
Expand Down

0 comments on commit 0404d8a

Please sign in to comment.