Skip to content

Commit

Permalink
Add environment to testing matrix
Browse files Browse the repository at this point in the history
garbast committed May 12, 2024
1 parent 6d01a42 commit 58dac9e
Showing 12 changed files with 454 additions and 303 deletions.
37 changes: 32 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -39,21 +39,48 @@ jobs:
framework: '^8.0.2'
prefer: ''
testpath: 'Tests/Functional'

- php: '8.1'
core: '^12.4'
framework: '^8.0.2'
prefer: '--prefer-lowest'
testpath: 'Tests/Functional'

- php: '8.2'
core: '^12.4'
framework: '^8.0.2'
prefer: ''
testpath: 'Tests/Functional'

- php: '8.2'
core: '^12.4'
framework: '^8.0.2'
prefer: '--prefer-lowest'
testpath: 'Tests/Functional'

- php: '8.2'
core: '^13.0'
framework: 'dev-main'
prefer: ''
testpath: 'Tests/Functional'

- php: '8.2'
core: '^13.0'
framework: 'dev-main'
prefer: '--prefer-lowest'
testpath: 'Tests/Functional'

- php: '8.3'
core: '^13.0'
framework: 'dev-main'
prefer: ''
testpath: 'Tests/Functional'

- php: '8.3'
core: '^13.0'
framework: 'dev-main'
prefer: '--prefer-lowest'
testpath: 'Tests/Functional'
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -64,11 +91,11 @@ jobs:
-p ${{ matrix.packages.php }} \
-s lintPhp
- name: Composer install
run: |
Build/Scripts/runTests.sh \
-p ${{ matrix.packages.php }} \
-s composerInstall
# - name: Composer install
# run: |
# Build/Scripts/runTests.sh \
# -p ${{ matrix.packages.php }} \
# -s composerInstall

- name: Composer install core
run: |
134 changes: 42 additions & 92 deletions Build/Scripts/additionalTests.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/usr/bin/env bash

#
# TYPO3 core test runner based on docker.
# TYPO3 core test runner based on docker or podman
#

trap 'cleanUp;exit 2' SIGINT

waitFor() {
local HOST=${1}
local PORT=${2}
@@ -19,14 +21,21 @@ waitFor() {
done;
"
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name wait-for-${SUFFIX} ${XDEBUG_MODE} -e XDEBUG_CONFIG="${XDEBUG_CONFIG}" ${IMAGE_ALPINE} /bin/sh -c "${TESTCOMMAND}"
if [[ $? -gt 0 ]]; then
kill -SIGINT -$$
fi
}

cleanUp() {
ATTACHED_CONTAINERS=$(${CONTAINER_BIN} ps --filter network=${NETWORK} --format='{{.Names}}')
for ATTACHED_CONTAINER in ${ATTACHED_CONTAINERS}; do
${CONTAINER_BIN} rm -f ${ATTACHED_CONTAINER} >/dev/null
${CONTAINER_BIN} kill ${ATTACHED_CONTAINER} >/dev/null
done
${CONTAINER_BIN} network rm ${NETWORK} >/dev/null
if [ ${CONTAINER_BIN} = "docker" ]; then
${CONTAINER_BIN} network rm ${NETWORK} >/dev/null
else
${CONTAINER_BIN} network rm -f ${NETWORK} >/dev/null
fi
}

handleDbmsOptions() {
@@ -40,8 +49,8 @@ handleDbmsOptions() {
echo "Use \".Build/Scripts/runTests.sh -h\" to display help and valid options" >&2
exit 1
fi
[ -z "${DBMS_VERSION}" ] && DBMS_VERSION="10.3"
if ! [[ ${DBMS_VERSION} =~ ^(10.3|10.4|10.5|10.6|10.7|10.8|10.9|10.10|10.11|11.0|11.1)$ ]]; then
[ -z "${DBMS_VERSION}" ] && DBMS_VERSION="10.4"
if ! [[ ${DBMS_VERSION} =~ ^(10.4|10.5|10.6|10.7|10.8|10.9|10.10|10.11|11.0|11.1)$ ]]; then
echo "Invalid combination -d ${DBMS} -i ${DBMS_VERSION}" >&2
echo >&2
echo "Use \".Build/Scripts/runTests.sh -h\" to display help and valid options" >&2
@@ -57,7 +66,7 @@ handleDbmsOptions() {
exit 1
fi
[ -z "${DBMS_VERSION}" ] && DBMS_VERSION="8.0"
if ! [[ ${DBMS_VERSION} =~ ^(8.0)$ ]]; then
if ! [[ ${DBMS_VERSION} =~ ^(8.0|8.1|8.2|8.3)$ ]]; then
echo "Invalid combination -d ${DBMS} -i ${DBMS_VERSION}" >&2
echo >&2
echo "Use \".Build/Scripts/runTests.sh -h\" to display help and valid options" >&2
@@ -72,7 +81,7 @@ handleDbmsOptions() {
exit 1
fi
[ -z "${DBMS_VERSION}" ] && DBMS_VERSION="10"
if ! [[ ${DBMS_VERSION} =~ ^(10|11|12|13|14|15)$ ]]; then
if ! [[ ${DBMS_VERSION} =~ ^(10|11|12|13|14|15|16)$ ]]; then
echo "Invalid combination -d ${DBMS} -i ${DBMS_VERSION}" >&2
echo >&2
echo "Use \".Build/Scripts/runTests.sh -h\" to display help and valid options" >&2
@@ -111,16 +120,6 @@ cleanBuildFiles() {
echo "done"
}

cleanCacheFiles() {
echo -n "Clean caches ... "
rm -rf \
.cache \
Build/.cache \
Build/composer/.cache/ \
.php-cs-fixer.cache
echo "done"
}

cleanTestFiles() {
# test related
echo -n "Clean test related files ... "
@@ -136,11 +135,18 @@ cleanTestFiles() {
echo "done"
}

cleanRenderedDocumentationFiles() {
echo -n "Clean rendered documentation files ... "
rm -rf \
typo3/sysext/*/Documentation-GENERATED-temp
echo "done"
getPhpImageVersion() {
case ${1} in
8.1)
echo -n "2.12"
;;
8.2)
echo -n "1.12"
;;
8.3)
echo -n "1.13"
;;
esac
}

loadHelp() {
@@ -155,56 +161,20 @@ Usage: $0 [options] [file]
Options:
-s <...>
Specifies the test suite to run
- acceptance: main application acceptance tests
- acceptanceInstall: installation acceptance tests, only with -d mariadb|postgres|sqlite
- buildCss: execute scss to css builder
- buildJavascript: execute typescript to javascript builder
- cgl: test and fix all core php files
- cglGit: test and fix latest committed patch for CGL compliance
- cglHeader: test and fix file header for all core php files
- cglHeaderGit: test and fix latest committed patch for CGL file header compliance
- checkAnnotations: check php code for allowed annotations
- checkBom: check UTF-8 files do not contain BOM
- checkComposer: check composer.json files for version integrity
- checkExceptionCodes: test core for duplicate exception codes
- checkExtensionScannerRst: test all .rst files referenced by extension scanner exist
- checkFilePathLength: test core file paths do not exceed maximum length
- checkGitSubmodule: test core git has no sub modules defined
- checkGruntClean: Verify "grunt build" is clean. Warning: Executes git commands! Usually used in CI only.
- checkIsoDatabase: Verify "updateIsoDatabase.php" does not change anything.
- checkNamespaceIntegrity: Verify namespace integrity in class and test code files are in good shape.
- checkPermissions: test some core files for correct executable bits
- checkRst: test .rst files for integrity
- checkTestClassFinal: check test case classes are final
- checkTestMethodsPrefix: check tests methods do not start with "test"
- buildDocumentation: test build the documentation
- clean: clean up build, cache and testing related files and folders
- cleanBuild: clean up build related files and folders
- 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
- 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.
- composerTestDistribution: "composer update" in Build/composer to verify core dependencies
- composerValidate: "composer validate"
- functional: PHP functional tests
- functionalDeprecated: deprecated PHP functional tests
- lintPhp: PHP linting
- lintScss: SCSS linting
- lintTypescript: TS linting
- lintHtml: HTML linting
- listExceptionCodes: list core exception codes in JSON format
- phpstan: phpstan tests
- phpstanGenerateBaseline: regenerate phpstan baseline, handy after phpstan updates
- unit (default): PHP unit tests
- unitDeprecated: deprecated PHP unit tests
- unitJavascript: JavaScript unit tests
- unitRandom: PHP unit tests in random order, add -o <number> to use specific seed
- composerInstallPackage: install a package with composer
- lintXliff: test XLIFF language files
-b <docker|podman>
Container environment:
- podman (default)
- docker
-p <8.1|8.2|8.3>
Specifies the PHP minor version to be used
- 8.1 (default): use PHP 8.1
- 8.2: use PHP 8.2
- 8.1: use PHP 8.1
- 8.2 (default): use PHP 8.2
- 8.3: use PHP 8.3
-q
@@ -221,16 +191,13 @@ Options:
Examples:
# Run install a package with composer
./Build/Scripts/additionalTests.sh -p 8.1 -s composerInstallPackage "typo3/cms-core:12.4"
# Linting scss files
./Build/Scripts/additionalTests.sh -s lintScss
# Linting typescript files
./Build/Scripts/additionalTests.sh -s lintTypescript
./Build/Scripts/additionalTests.sh -p 8.2 -s composerInstallPackage "typo3/cms-core:13.0"
# Test build the documentation
./Build/Scripts/additionalTests.sh -s buildDocumentation
# Test XLIFF language files
./Build/Scripts/additionalTests.sh -s lintXliff
EOF
}

@@ -403,30 +370,13 @@ case ${TEST_SUITE} in
;;
clean)
cleanBuildFiles
cleanCacheFiles
cleanRenderedDocumentationFiles
cleanTestFiles
;;
composerInstallPackage)
COMMAND="[ ${SCRIPT_VERBOSE} -eq 1 ] && set -x; composer require -W -n ${COMPOSER_PARAMETER} ${COMPOSER_PACKAGE};"
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name composer-require-package-${SUFFIX} -w ${CORE_ROOT} -e COMPOSER_CACHE_DIR=${CORE_ROOT}/Build/.cache/composer ${IMAGE_PHP} /bin/sh -c "${COMMAND}"
SUITE_EXIT_CODE=$?
;;
lintPhp)
COMMAND="[ ${SCRIPT_VERBOSE} -eq 1 ] && set -x; php -v | grep '^PHP'; find Classes/ -name \\*.php -print0 | xargs -0 -n1 -P4 php -dxdebug.mode=off -l > /dev/null;"
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name lint-php-${SUFFIX} -w ${CORE_ROOT} ${IMAGE_PHP} /bin/sh -c "${COMMAND}"
SUITE_EXIT_CODE=$?
;;
lintScss)
COMMAND="[ ${SCRIPT_VERBOSE} -eq 1 ] && set -x; cd Build; npm ci || exit 1; npm run lint:css;"
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name lint-css-${SUFFIX} -w ${CORE_ROOT} -e HOME=${CORE_ROOT}/.cache ${IMAGE_NODEJS} /bin/sh -c "${COMMAND}"
SUITE_EXIT_CODE=$?
;;
lintTypescript)
COMMAND="[ ${SCRIPT_VERBOSE} -eq 1 ] && set -x; cd Build; npm ci || exit 1; npm run lint:ts;"
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name lint-typescript-${SUFFIX} -w ${CORE_ROOT} -e HOME=${CORE_ROOT}/.cache ${IMAGE_NODEJS} /bin/sh -c "${COMMAND}"
SUITE_EXIT_CODE=$?
;;
lintXliff)
COMMAND="[ ${SCRIPT_VERBOSE} -eq 1 ] && set -x; xmllint --schema /xliff-core-1.2-strict.xsd --noout *.xlf;"
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name lint-xliff-${SUFFIX} -w ${CORE_ROOT}/Resources/Private/Language ${IMAGE_XLIFF} /bin/sh -c "${COMMAND}"
507 changes: 334 additions & 173 deletions Build/Scripts/runTests.sh

Large diffs are not rendered by default.

43 changes: 28 additions & 15 deletions Build/Scripts/test.sh
Original file line number Diff line number Diff line change
@@ -72,11 +72,6 @@ runFunctionalTests () {
-s lintPhp || exit 1 ; \
EXIT_CODE_LINT=$?

./runTests.sh \
-p ${PHP_VERSION} \
-s composerInstall || exit 1 ; \
EXIT_CODE_LINT=$?

./additionalTests.sh \
-p ${PHP_VERSION} \
-s composerInstallPackage \
@@ -121,8 +116,9 @@ runFunctionalTests () {
echo -e "${RED}FAILURE${NC}" >&2
exit 1
fi
echo "#################################################################" >&2
echo "###########################################################################" >&2
echo "" >&2
cleanup
}

#################################################
@@ -136,13 +132,30 @@ cleanup () {
git checkout ../../composer.json
}

checkResources
DEBUG_TESTS=false
if [[ $DEBUG_TESTS != true ]]; then
checkResources

TCORE="^12.4"
TFRAMEWORK="^8.0.2"
TPATH="Tests/Functional"
LOWEST="--prefer-lowest"
runFunctionalTests "8.1" ${TCORE} ${TFRAMEWORK} ${TPATH} || exit 1
runFunctionalTests "8.1" ${TCORE} ${TFRAMEWORK} ${TPATH} ${LOWEST} || exit 1
runFunctionalTests "8.2" ${TCORE} ${TFRAMEWORK} ${TPATH} || exit 1
runFunctionalTests "8.2" ${TCORE} ${TFRAMEWORK} ${TPATH} ${LOWEST} || exit 1

TCORE="^13.0"
TFRAMEWORK="dev-main"
runFunctionalTests "8.2" ${TCORE} ${TFRAMEWORK} ${TPATH} || exit 1
runFunctionalTests "8.2" ${TCORE} ${TFRAMEWORK} ${TPATH} ${LOWEST} || exit 1
runFunctionalTests "8.3" ${TCORE} ${TFRAMEWORK} ${TPATH} || exit 1
runFunctionalTests "8.3" ${TCORE} ${TFRAMEWORK} ${TPATH} ${LOWEST} || exit 1
else
cleanup
runFunctionalTests "8.2" "^13.0" "dev-main" "Tests/Functional" || exit 1
cleanup
# ./runTests.sh -x -p 8.2 -d sqlite -s functional -e "--group selected" Tests/Functional
# ./runTests.sh -x -p 8.2 -d sqlite -s functional Tests/Functional
fi

runFunctionalTests "8.1" "^12.4" "^8.0.2" "Tests/Functional" || exit 1
cleanup
runFunctionalTests "8.1" "^12.4" "^8.0.2" "Tests/Functional" "--prefer-lowest" || exit 1
cleanup
runFunctionalTests "8.2" "^12.4" "^8.0.2" "Tests/Functional" || exit 1
cleanup
runFunctionalTests "8.2" "^12.4" "^8.0.2" "Tests/Functional" "--prefer-lowest" || exit 1
cleanup
2 changes: 1 addition & 1 deletion Classes/Controller/AbstractController.php
Original file line number Diff line number Diff line change
@@ -138,7 +138,7 @@ protected function getPaginator(QueryResultInterface|array $result): PaginatorIn

$paginatorClass = is_array($result) ? ArrayPaginator::class : QueryResultPaginator::class;

/** @var QueryResultPaginator $resultPaginator */
/** @var PaginatorInterface $resultPaginator */
$resultPaginator = GeneralUtility::makeInstance(
$paginatorClass,
$result,
5 changes: 4 additions & 1 deletion Classes/Controller/CategoryController.php
Original file line number Diff line number Diff line change
@@ -42,7 +42,10 @@ protected function listAction(): ResponseInterface
{
if (
count($this->settings['category']) == 0
|| (count($this->settings['category']) == 1 && reset($this->settings['category']) < 1)
|| (
count($this->settings['category']) == 1
&& reset($this->settings['category']) < 1
)
) {
$categories = $this->categoryRepository->findAll();
} else {
2 changes: 1 addition & 1 deletion Classes/Domain/Repository/AuthorRepository.php
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ public function findAuthorGroupedByLetters(): array
->from('tx_sfbooks_domain_model_author');

$storagePageIds = $query->getQuerySettings()->getStoragePageIds();
if ($query->getQuerySettings()->getRespectStoragePage() && count($storagePageIds)) {
if (count($storagePageIds) && $query->getQuerySettings()->getRespectStoragePage()) {
$queryBuilder->where($queryBuilder->expr()->in('pid', $storagePageIds));
}

2 changes: 1 addition & 1 deletion Classes/Domain/Repository/SeriesRepository.php
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ public function findSeriesGroupedByLetters(): array
->from('tx_sfbooks_domain_model_series');

$storagePageIds = $query->getQuerySettings()->getStoragePageIds();
if ($query->getQuerySettings()->getRespectStoragePage() && count($storagePageIds)) {
if (count($storagePageIds) && $query->getQuerySettings()->getRespectStoragePage()) {
$queryBuilder->where($queryBuilder->expr()->in('pid', $storagePageIds));
}

3 changes: 2 additions & 1 deletion Classes/Updates/AbstractPopulateSlugs.php
Original file line number Diff line number Diff line change
@@ -37,7 +37,8 @@ abstract class AbstractPopulateSlugs implements UpgradeWizardInterface

protected string $fieldName = 'path_segment';

public function __construct(protected ConnectionPool $connectionPool) {
public function __construct(protected ConnectionPool $connectionPool)
{
}

abstract public function getTitle(): string;
4 changes: 2 additions & 2 deletions Documentation/guides.xml
Original file line number Diff line number Diff line change
@@ -16,8 +16,8 @@
interlink-shortcode="evoweb/sf-books"
/>
<project title="sf_books"
release="7.0.1"
version="7.0.1"
release="8.1.0"
version="8.1.0"
copyright="since 2004 by evoWeb"
/>
<inventory id="t3tsref" url="https://docs.typo3.org/m/typo3/reference-typoscript/main/en-us/"/>
14 changes: 5 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
@@ -17,26 +17,22 @@
},
"config": {
"bin-dir": "bin",
"platform": {
"php": "8.1.1"
},
"sort-packages": true,
"allow-plugins": {
"typo3/class-alias-loader": true,
"typo3/cms-composer-installers": true
}
},
"require": {
"typo3/cms-core": "^12.4 || 12.4.x-dev || dev-main",
"typo3/cms-extbase": "^12.4 || 12.4.x-dev || dev-main",
"typo3/cms-fluid": "^12.4 || 12.4.x-dev || dev-main",
"typo3/cms-install": "^12.4 || 12.4.x-dev || dev-main",
"typo3/cms-core": "^12.4 || 12.4.x-dev || ^13.0 || 13.0.x-dev || dev-main",
"typo3/cms-extbase": "^12.4 || 12.4.x-dev || ^13.0 || 13.0.x-dev || dev-main",
"typo3/cms-fluid": "^12.4 || 12.4.x-dev || ^13.0 || 13.0.x-dev || dev-main",
"typo3/cms-install": "^12.4 || 12.4.x-dev || ^13.0 || 13.0.x-dev || dev-main",
"psr/http-message": "^1.1 || ^2.0",
"doctrine/dbal": "^3.7.2 || ^4.0"
},
"require-dev": {
"typo3/testing-framework": "^8.0.2 || dev-main",
"sbuerk/typo3-cmscomposerinstallers-testingframework-bridge": "dev-main"
"typo3/testing-framework": "^8.0.2 || dev-main"
},
"extra": {
"typo3/cms": {
4 changes: 2 additions & 2 deletions ext_emconf.php
Original file line number Diff line number Diff line change
@@ -10,10 +10,10 @@
'author_email' => 'typo3@evoweb.de',
'author_company' => 'evoWeb',
'state' => 'stable',
'version' => '8.0.0',
'version' => '8.1.0',
'constraints' => [
'depends' => [
'typo3' => '12.0.0-12.4.99',
'typo3' => '12.0.0-13.4.99',
],
'conflicts' => [],
'suggests' => [],

0 comments on commit 58dac9e

Please sign in to comment.