Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
Copy link
Collaborator Author

@AlexSkrypnyk AlexSkrypnyk May 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no simple way to use existing jobs without adding a lot of if to every step as this check happens early in the run.

instead, having a standalone (fast) job is easier to maintain.


I called this test-composer rather than test-composer-fail etc. in case we want to add more composer-related tests in the future.

But happy to change the name to anything else.

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')) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$io->writeError('<error>Drupal-project requires Composer version 2.3.6 or higher. Please update your Composer before continuing</error>.');
exit(1);
}
}
Expand Down