From a48f30edb46192915f8a19634fb714f5989cfb18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20K=C3=A4hm?= Date: Thu, 26 Oct 2023 19:11:32 +0200 Subject: [PATCH] [TASK] sync the CI stuff from main branch into 11.6.x Relates: #3781 --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/ISSUE_TEMPLATE/feature_request.md | 23 ++++++++ .github/workflows/ci.yml | 17 +++--- ...> GET_LOCAL_PACKAGE_VERSION_CONSTRAINT.sh} | 0 Build/Test/IntegrationTests.xml | 1 + Build/Test/IntegrationTestsBootstrap.php | 6 ++- Build/Test/UnitTests.xml | 1 + Build/Test/bootstrap.sh | 52 +++++-------------- Build/Test/cibuild.sh | 42 ++++++++------- Build/Test/phpstan-constants.php | 5 ++ Build/Test/phpstan.neon | 20 +++++++ Docker/Ci/environment.yml | 1 - composer.json | 24 ++++++--- 13 files changed, 115 insertions(+), 79 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md rename Build/Helpers/{GET_LACAL_PACKAGE_VERSION_CONSTRAINT.sh => GET_LOCAL_PACKAGE_VERSION_CONSTRAINT.sh} (100%) create mode 100644 Build/Test/phpstan-constants.php create mode 100644 Build/Test/phpstan.neon diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 34c46ca1dc..0f8663839c 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -26,7 +26,7 @@ If applicable, add screenshots to help explain your problem. **Used versions (please complete the following information):** - TYPO3 Version: [e.g. 11.5.41] - Browser: [e.g. chrome, safari] - - EXT:solr Version: [e.g. 11.5.7] + - EXT:solr Version: [e.g. 11.6.0] - Used Apache Solr Version: [e.g. 8.11.4] - PHP Version: [e.g. 8.2.0] - MySQL Version: [e.g. 8.0.0] diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000000..8e5d8c2232 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,23 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: "[FEATURE] Please describe your feature wish here" +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. + +**Target versions** +Please add the EXT:solr target versions here. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 39bb9883d0..fb077125b1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,18 +23,21 @@ jobs: outputs: matrix: ${{ steps.collect_build_matrix.outputs.matrix }} steps: - # Workaround for issue with actions/checkout@v2 wrong PR commit checkout: See https://github.com/actions/checkout/issues/299#issuecomment-677674415 + # Workaround for issue with actions/checkout "wrong PR commit checkout": + # See: + # ** https://github.com/actions/checkout/issues/299#issuecomment-677674415 + # ** https://github.com/actions/checkout/issues/1359#issuecomment-1631503791 - name: Checkout current state of Pull Request if: github.event_name == 'pull_request' - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha }} - name: Checkout current state of Branch if: github.event_name == 'push' - uses: actions/checkout@v2 - # End: Workaround for issue with actions/checkout@v2 wrong PR commit checkout + uses: actions/checkout@v3 + # End: Workaround for issue with actions/checkout... - name: "Resolve target branch of pull request." if: github.event_name == 'pull_request' @@ -104,7 +107,6 @@ jobs: TYPO3_DATABASE_HOST: '127.0.0.1' TYPO3_DATABASE_USERNAME: 'root' TYPO3_DATABASE_PASSWORD: 'root' - PHP_CS_FIXER_VERSION: '^3.2.1' TYPO3_VERSION: ${{ matrix.TYPO3 }} name: TYPO3 ${{ matrix.TYPO3 }} on PHP ${{ matrix.PHP }} @@ -128,7 +130,7 @@ jobs: name: Mount RAMFS run: | mkdir -p ${{ env.CI_BUILD_DIRECTORY }} - sudo mount -t tmpfs -o size=3G none ${{ env.CI_BUILD_DIRECTORY }} + sudo mount -t tmpfs -o size=1G none ${{ env.CI_BUILD_DIRECTORY }} sudo mkdir -p ${{ env.CI_BUILD_DIRECTORY }}/data-{solr,mysql} \ && sudo chown $USER ${{ env.CI_BUILD_DIRECTORY }}/data-mysql \ && sudo chown 8983:8983 ${{ env.CI_BUILD_DIRECTORY }}/data-solr @@ -160,10 +162,9 @@ jobs: with: php-version: ${{ matrix.PHP }} coverage: pcov - tools: composer:2.1.14 + tools: composer:2.5.5 - name: CI-Bootstrap - if: steps.restore_ci_build_caches.outputs.cache-hit != 'true' run: | ./Build/Test/bootstrap.sh --skip-solr-install echo "Current Size of EXT:Solr build Artefacts before run: " \ diff --git a/Build/Helpers/GET_LACAL_PACKAGE_VERSION_CONSTRAINT.sh b/Build/Helpers/GET_LOCAL_PACKAGE_VERSION_CONSTRAINT.sh similarity index 100% rename from Build/Helpers/GET_LACAL_PACKAGE_VERSION_CONSTRAINT.sh rename to Build/Helpers/GET_LOCAL_PACKAGE_VERSION_CONSTRAINT.sh diff --git a/Build/Test/IntegrationTests.xml b/Build/Test/IntegrationTests.xml index 55d51013f0..4f81a8e17d 100644 --- a/Build/Test/IntegrationTests.xml +++ b/Build/Test/IntegrationTests.xml @@ -1,6 +1,7 @@ defineOriginalRootPath(); $testbase->createDirectory(ORIGINAL_ROOT . 'typo3temp/var/tests'); $testbase->createDirectory(ORIGINAL_ROOT . 'typo3temp/var/transient'); diff --git a/Build/Test/UnitTests.xml b/Build/Test/UnitTests.xml index d5e24cf3bc..79f343afcf 100644 --- a/Build/Test/UnitTests.xml +++ b/Build/Test/UnitTests.xml @@ -1,6 +1,7 @@ /dev/null 2>&1 then echo "Couldn't find wget." exit 1 fi -COMPOSER_NO_INTERACTION=1 +# Use latest TYPO3 LTS stable version, if version number is compatible with get.typo3.org API +if [[ $TYPO3_VERSION =~ ^[0-9]+$ ]] ; then + TYPO3_VERSION=$("${BASH_SOURCE%/*}/../Helpers/TYPO3_GET_LATEST_VERSION.sh" "$TYPO3_VERSION") +fi -# Setup TYPO3 environment variables -export TYPO3_PATH_PACKAGES="${EXTENSION_ROOTPATH}.Build/vendor/" -export TYPO3_PATH_WEB="${EXTENSION_ROOTPATH}.Build/Web/" +echo "Using TYPO3 Version: $TYPO3_VERSION" +echo "Using database host: $TYPO3_DATABASE_HOST" +echo "Using database dbname: $TYPO3_DATABASE_NAME" +echo "Using database user: $TYPO3_DATABASE_USERNAME" +echo "Using database password: $TYPO3_DATABASE_PASSWORD" echo "Installing test environment" -echo "Using extension path $EXTENSION_ROOTPATH" -echo "Using package path $TYPO3_PATH_PACKAGES" -echo "Using web path $TYPO3_PATH_WEB" - export COMPOSER_NO_INTERACTION=1 if ! composer "tests:setup"; then echo "The test environment could not be installed by composer as expected. Please fix this issue." @@ -98,10 +71,9 @@ if ! composer "tests:setup"; then fi echo "Install third party tools globally:" +export PATH=$PATH:$(composer config --global home)/vendor/bin if ! composer tests:setup:global-require then - "The test environment could not be installed by composer as expected. Please fix this issue." + echo "The test environment could not be installed by composer as expected. Please fix this issue." exit 1 fi - -mkdir -p $TYPO3_PATH_WEB/uploads $TYPO3_PATH_WEB/typo3temp diff --git a/Build/Test/cibuild.sh b/Build/Test/cibuild.sh index b3e8df59b1..76869f2536 100755 --- a/Build/Test/cibuild.sh +++ b/Build/Test/cibuild.sh @@ -1,13 +1,6 @@ #!/usr/bin/env bash -TYPO3_PATH_WEB="$(pwd)/.Build/Web/" -export TYPO3_PATH_WEB -TYPO3_PATH_PACKAGES="$(pwd)/.Build/vendor/" -export TYPO3_PATH_PACKAGES - -TYPO3_BIN_DIR="$(pwd)/.Build/bin/" -export TYPO3_BIN_DIR -export PATH="$TYPO3_BIN_DIR:$PATH" +EXIT_CODE=0 COMPOSERS_BIN_DIR="$(composer config home)/vendor/bin" # Add COMPOSERS_BIN_DIR to $PATH, if not present @@ -25,7 +18,7 @@ echo "Run PHP Lint" if ! find . -name \*.php ! -path "./.Build/*" 2>/dev/null | parallel --gnu php -d display_errors=stderr -l {} > /dev/null then echo "There are syntax errors, please check and fix them." - exit 1 + EXIT_CODE=1 else echo "No syntax errors! Great job!" fi @@ -36,28 +29,36 @@ then echo "Some files are not compliant to TYPO3 Coding Standards" echo "Please fix the files listed above." echo "Tip for auto fix: " - echo " composer tests:setup && composer t3:standards:fix" - exit 1 + echo " TYPO3_VERSION=\"${TYPO3_VERSION}\" composer tests:setup && composer t3:standards:fix" + EXIT_CODE=3 else echo "The code is TYPO3 Coding Standards compliant! Great job!" fi echo -e "\n\n" +echo "Run XML Lint" if ! composer tests:lint-xml then - echo "Some XML files are not valid" - echo "Please fix the files listed above" - exit 1 + EXIT_CODE=4 fi +echo -e "\n\n" +echo "Run PHPStan analysis" +if ! composer tests:phpstan +then + # disable fail temporary + #EXIT_CODE=7 + echo "Error during running the PHPStan analysis, please check and fix them." + echo "Tip for working on them: " + echo " TYPO3_VERSION=\"${TYPO3_VERSION}\" composer tests:setup && composer tests:phpstan" +fi echo -e "\n\n" echo "Run unit tests" -UNIT_BOOTSTRAP="Build/Test/UnitTestsBootstrap.php" -if ! .Build/bin/phpunit --colors -c Build/Test/UnitTests.xml --bootstrap=$UNIT_BOOTSTRAP --colors --coverage-text +if ! composer tests:unit -- --coverage-clover=coverage.unit.clover then echo "Error during running the unit tests please check and fix them" - exit 1 + EXIT_CODE=5 fi # @@ -94,9 +95,10 @@ fi echo -e "\n\n" echo "Run integration tests" -INTEGRATION_BOOTSTRAP="Build/Test/IntegrationTestsBootstrap.php" -if ! .Build/bin/phpunit --colors -c Build/Test/IntegrationTests.xml --bootstrap=$INTEGRATION_BOOTSTRAP --colors --coverage-text +if ! composer tests:integration -- --coverage-clover=coverage.integration.clover then echo "Error during running the integration tests please check and fix them" - exit 1 + EXIT_CODE=6 fi + +exit $EXIT_CODE diff --git a/Build/Test/phpstan-constants.php b/Build/Test/phpstan-constants.php new file mode 100644 index 0000000000..1df075f0fc --- /dev/null +++ b/Build/Test/phpstan-constants.php @@ -0,0 +1,5 @@ +