From f99e80b59dbdf06b937335f1012146a4775bbbc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BCrk?= <stefan@buerk.tech> Date: Mon, 5 Feb 2024 10:40:30 +0100 Subject: [PATCH] [TASK] Add `composer` dispatcher to `runTests.sh` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change adds a composer command dispatcher to `Build/Scripts/runTests.sh` to allow the execution of any composer command without the hassle to have a proper composer installed on the host system. This also helps for onboarding new contributors not having a proper php and composer ecosystem installed on the host system. For example, to raise dependencies following can now be used: > Build/Scripts/runTests.sh -s composer -- require --dev \ typo3/testing-framework:dev-main Other examples: > Build/Scripts/runTests.sh -s composer -- dumpautoload > Build/Scripts/runTests.sh -s composer -- info | grep "symfony" Resolves: #103045 Releases: main, 12.4, 11.5 Change-Id: I65fa14e2c8d0d1a1204b3bed701d8c3458b6e3bb Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82838 Reviewed-by: Stefan Bürk <stefan@buerk.tech> Tested-by: core-ci <typo3@b13.com> Tested-by: Stefan Bürk <stefan@buerk.tech> --- Build/Scripts/runTests.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Build/Scripts/runTests.sh b/Build/Scripts/runTests.sh index 28249d750ed8..254ea48d6f7d 100755 --- a/Build/Scripts/runTests.sh +++ b/Build/Scripts/runTests.sh @@ -203,6 +203,7 @@ Options: - cleanCache: clean up cache related files and folders - cleanRenderedDocumentation: clean up rendered documentation files and folders (Documentation-GENERATED-temp) - cleanTests: clean up test related files and folders + - composer: "composer" command dispatcher, to execute various composer commands - composerInstall: "composer install" - composerInstallMax: "composer update", with no platform.php config. - composerInstallMin: "composer update --prefer-lowest", with platform.php set to PHP version x.x.0. @@ -356,6 +357,13 @@ Examples: # Run installer tests of a new instance on sqlite ./Build/Scripts/runTests.sh -s acceptanceInstall -d sqlite + + # Run composer require to require a dependency + ./Build/Scripts/runTests.sh -s composer -- require --dev typo3/testing-framework:dev-main + + # Some composer command examples + ./Build/Scripts/runTests.sh -s composer -- dumpautoload + ./Build/Scripts/runTests.sh -s composer -- info | grep "symfony" EOF } @@ -815,6 +823,11 @@ case ${TEST_SUITE} in cleanTests) cleanTestFiles ;; + composer) + COMMAND=(composer "$@") + ${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name composer-${SUFFIX} -e COMPOSER_CACHE_DIR=.cache/composer -e COMPOSER_ROOT_VERSION=${COMPOSER_ROOT_VERSION} ${IMAGE_PHP} "${COMMAND[@]}" + SUITE_EXIT_CODE=$? + ;; composerInstall) ${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name composer-install-${SUFFIX} -e COMPOSER_CACHE_DIR=.cache/composer -e COMPOSER_ROOT_VERSION=${COMPOSER_ROOT_VERSION} ${IMAGE_PHP} composer install --no-progress --no-interaction SUITE_EXIT_CODE=$? -- GitLab