From 98ec2fc603a8c8a476dd5a2ede8476537bac994e Mon Sep 17 00:00:00 2001 From: Sybille Peters Date: Mon, 5 Feb 2024 18:05:53 +0100 Subject: [PATCH] Add support for more PHP versions in CI --- .../{tests.yml => tests.yml.not-used-yet} | 19 +++------- .github/workflows/tests_static.yml | 35 +++++++++++++++++++ Build/Scripts/runTests.sh | 12 +++---- .../PageLayoutControllerWithCallouts.php | 3 +- 4 files changed, 45 insertions(+), 24 deletions(-) rename .github/workflows/{tests.yml => tests.yml.not-used-yet} (63%) create mode 100644 .github/workflows/tests_static.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml.not-used-yet similarity index 63% rename from .github/workflows/tests.yml rename to .github/workflows/tests.yml.not-used-yet index 4a802e7..0994ad0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml.not-used-yet @@ -1,5 +1,5 @@ -# statics checks -# - run only with latest TYPO3 and PHP version +# unit / functional tests +# - run with more PHP versions name: CI on: @@ -8,14 +8,12 @@ on: jobs: - testsuite_ci_static: + testsuite_ci: name: CI static runs-on: ubuntu-20.04 strategy: matrix: - # run static checks only with latest PHP version (for supported TYPO3 versions) - php: [ '8.1' ] - # run static checks only with latest TYPO3 version + php: [ '8.1', '8.2', '8.3' ] minMax: [ 'composerInstallMax' ] steps: - name: Checkout @@ -24,15 +22,6 @@ jobs: - name: Composer run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s ${{ matrix.minMax }} - - name: Composer validate - run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s composerValidate - - - name: cgl - run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s cgl -v -n - - - name: Lint PHP - run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s lint - # - name: Unit tests # run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s unit diff --git a/.github/workflows/tests_static.yml b/.github/workflows/tests_static.yml new file mode 100644 index 0000000..7c0deea --- /dev/null +++ b/.github/workflows/tests_static.yml @@ -0,0 +1,35 @@ +# statics checks +# - run only with latest TYPO3 and PHP version +name: CI (static) + +on: + push: + pull_request: + +jobs: + + testsuite_ci_static: + name: CI static + runs-on: ubuntu-20.04 + strategy: + matrix: + # run static checks only with latest PHP version (for supported TYPO3 versions) + #php: [ '8.1', '8.2', '8.3' ] + php: [ '8.3' ] + # run static checks only with latest TYPO3 version + minMax: [ 'composerInstallMax' ] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Composer + run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s ${{ matrix.minMax }} + + - name: Composer validate + run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s composerValidate + + - name: cgl + run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s cgl -v -n + + - name: Lint PHP + run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s lint diff --git a/Build/Scripts/runTests.sh b/Build/Scripts/runTests.sh index bbf8424..13a250f 100755 --- a/Build/Scripts/runTests.sh +++ b/Build/Scripts/runTests.sh @@ -7,7 +7,7 @@ # TYPO3 core test runner based on docker and docker-compose. # -PHP_VERSION="8.1" +PHP_VERSION="8.3" # Function to write a .env file in Build/testing-docker/local # This is read by docker-compose and vars defined here are @@ -80,12 +80,11 @@ Options: - postgres: use postgres - sqlite: use sqlite - -p <7.4|8.0|8.1|8.2> + -p <8.1|8.2|8.3> Specifies the PHP minor version to be used - - 7.4: use PHP 7.4 - - 8.0: use PHP 8.0 - 8.1: use PHP 8.1 - - 8.2: (default) use PHP 8.2 + - 8.2: use PHP 8.2 + - 8.3: (default) use PHP 8.3 -e "" Only with -s functional|unit|phpstan @@ -176,7 +175,7 @@ while getopts ":s:d:p:e:xy:huvn" OPT; do ;; p) PHP_VERSION=${OPTARG} - if ! [[ ${PHP_VERSION} =~ ^(7.4|8.0|8.1|8.2)$ ]]; then + if ! [[ ${PHP_VERSION} =~ ^(8.1|8.2|8.3)$ ]]; then INVALID_OPTIONS+=("${OPT} ${OPTARG} : unsupported php version") fi ;; @@ -222,7 +221,6 @@ if [ ${#INVALID_OPTIONS[@]} -ne 0 ]; then exit 1 fi -# Move "7.2" to "php72", the latter is the docker container name DOCKER_PHP_IMAGE=`echo "php${PHP_VERSION}" | sed -e 's/\.//'` # Set $1 to first mass argument, this is the optional test file or test directory to execute diff --git a/Classes/Xclass/PageLayoutControllerWithCallouts.php b/Classes/Xclass/PageLayoutControllerWithCallouts.php index 00cefa0..6df1d33 100644 --- a/Classes/Xclass/PageLayoutControllerWithCallouts.php +++ b/Classes/Xclass/PageLayoutControllerWithCallouts.php @@ -46,8 +46,7 @@ protected function generateMessagesForCurrentPage(ServerRequestInterface $reques ['Sypets/PageCallouts/Xclass/PageLayoutControllerWithCallouts'] ['addFlashMessageToPageModule'] ?? [] as $className - ) - { + ) { $hook = GeneralUtility::makeInstance($className); $result = $hook->addMessages($this->pageinfo); if ($result && is_array($result)) {