Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TASK] Adjust tooling for v13 compatibility #408

Merged
merged 1 commit into from
Dec 19, 2024
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
134 changes: 134 additions & 0 deletions .github/workflows/testcore13.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: tests core 13

on:
pull_request:
workflow_dispatch:

jobs:
code-quality:
name: "code quality with core v13"
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
php-version: [ '8.2']
permissions:
# actions: read|write|none
actions: none
# checks: read|write|none
checks: none
# contents: read|write|none
contents: read
# deployments: read|write|none
deployments: none
# id-token: read|write|none
id-token: none
# issues: read|write|none
issues: none
# discussions: read|write|none
discussions: none
# packages: read|write|none
packages: read
# pages: read|write|none
pages: none
# pull-requests: read|write|none
pull-requests: none
# repository-projects: read|write|none
repository-projects: read
# security-events: read|write|none
security-events: none
# statuses: read|write|none
statuses: none
steps:
- name: "Checkout"
uses: actions/checkout@v4

- name: "Prepare dependencies for TYPO3 v13"
run: "Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php-version }} -s composerUpdate"

- name: "Run TypoScript lint"
run: "Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php-version }} -s lintTypoScript"

- name: "Run PHP lint"
run: "Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php-version }} -s lintPhp"

- name: "Validate CGL"
run: "Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php-version }} -s cgl -n"

- name: "Ensure tests methods do not start with \"test\""
run: "Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php-version }} -s checkTestMethodsPrefix"

- name: "Ensure UTF-8 files do not contain BOM"
run: "Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php-version }} -s checkBom"

- name: "Test .rst files for integrity"
run: "Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php-version }} -s checkRst"

- name: "Find duplicate exception codes"
run: "Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php-version }} -s checkExceptionCodes"

# - name: "Run PHPStan"
# run: "Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php-version }} -s phpstan"

testsuite:
name: all tests with core v13
runs-on: ubuntu-24.04
needs: code-quality
strategy:
fail-fast: false
matrix:
php-version: ['8.2', '8.3', '8.4']
permissions:
# actions: read|write|none
actions: none
# checks: read|write|none
checks: none
# contents: read|write|none
contents: read
# deployments: read|write|none
deployments: none
# id-token: read|write|none
id-token: none
# issues: read|write|none
issues: none
# discussions: read|write|none
discussions: none
# packages: read|write|none
packages: read
# pages: read|write|none
pages: none
# pull-requests: read|write|none
pull-requests: none
# repository-projects: read|write|none
repository-projects: read
# security-events: read|write|none
security-events: none
# statuses: read|write|none
statuses: none
steps:
- name: "Checkout"
uses: actions/checkout@v4

- name: "Prepare dependencies for TYPO3 v13"
run: "Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php-version }} -s composerUpdate"

- name: "Unit"
run: "Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php-version }} -s unit"
# @todo Enable after functional tests setup has been fixed
# - name: "Functional SQLite"
# run: "Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php-version }} -s functional -d sqlite"
#
# - name: "Functional MariaDB 10.5 mysqli"
# run: "Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php-version }} -s functional -d mariadb -a mysqli"
#
# - name: "Functional MariaDB 10.5 pdo_mysql"
# run: "Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php-version }} -s functional -d mariadb -a pdo_mysql"
#
# - name: "Functional MySQL 8.0 mysqli"
# run: "Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php-version }} -s functional -d mariadb -a mysqli"
#
# - name: "Functional MySQL 8.0 pdo_mysql"
# run: "Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php-version }} -s functional -d mariadb -a pdo_mysql"
#
# - name: "Functional PostgresSQL 10"
# run: "Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php-version }} -s functional -d postgres"
26 changes: 24 additions & 2 deletions Build/Scripts/composer-for-core-version.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env bash

# @todo This script is crap. It must fall and properly implemented in Build/Scripts/runTests.sh along with
# adding two ddev core instances decoupled from the root composer.json.

composer_cleanup() {
echo -e "💥 Cleanup folders"
rm -Rf \
Expand All @@ -25,14 +28,33 @@ update_v12() {
php -dxdebug.mode=off $(which composer) require --dev --no-update \
"phpunit/phpunit":"^10.5"
php -dxdebug.mode=off $(which composer) require --no-update \
"typo3/cms-core":"^12.4.2"
"typo3/minimal":"^12.4"
echo -e "🔥 Update to selected dependencies"
php -dxdebug.mode=off $(which composer) install
php -dxdebug.mode=off $(which composer) remove --no-update \
"typo3/minimal"
}

update_v13() {
echo -e "💪 Enforce TYPO3 v13"
php -dxdebug.mode=off $(which composer) require --dev --no-update \
"phpunit/phpunit":"^10.5"
php -dxdebug.mode=off $(which composer) require --no-update \
"typo3/minimal":"^13.4"
echo -e "🔥 Update to selected dependencies"
php -dxdebug.mode=off $(which composer) install
php -dxdebug.mode=off $(which composer) remove --no-update \
"typo3/minimal"
}

case "$1" in
12)
composer_cleanup
update_v12
composer_update
;;
13)
composer_cleanup
update_v13
;;
*)
echo -e "🌀 Usage: ddev update-to (12)" >&2
Expand Down
11 changes: 6 additions & 5 deletions Build/Scripts/runTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,16 @@ Options:
- 15 maintained until 2027-11-11
- 16 maintained until 2028-11-09

-t <12>
-t <12|13>
Only with -s composerInstall|composerInstallMin|composerInstallMax
Specifies the TYPO3 CORE Version to be used
- 12: (default) use TYPO3 v12
- 12: use TYPO3 v13

-p <8.1|8.2|8.3|8.4>
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
- 8.4: use PHP 8.4

Expand Down Expand Up @@ -294,7 +295,7 @@ fi
TEST_SUITE="unit"
CORE_VERSION="12"
DBMS="sqlite"
PHP_VERSION="8.1"
PHP_VERSION="8.2"
PHP_XDEBUG_ON=0
PHP_XDEBUG_PORT=9003
PHPUNIT_RANDOM=""
Expand Down Expand Up @@ -338,7 +339,7 @@ while getopts "a:b:s:d:i:p:t:xy:o:nhu" OPT; do
;;
t)
CORE_VERSION=${OPTARG}
if ! [[ ${CORE_VERSION} =~ ^(12)$ ]]; then
if ! [[ ${CORE_VERSION} =~ ^(12|13)$ ]]; then
INVALID_OPTIONS+=("t ${OPTARG}")
fi
;;
Expand Down
7 changes: 6 additions & 1 deletion Build/Scripts/testMethodPrefixChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ public function enterNode(Node $node): void
}
}

$parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7);
if ((new \TYPO3\CMS\Core\Information\Typo3Version())->getMajorVersion() >= 13) {
$parser = (new ParserFactory())->createForVersion(\PhpParser\PhpVersion::fromComponents(8, 1));
} else {
$parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7);
}


$finder = new Symfony\Component\Finder\Finder();
$finder->files()
Expand Down
Loading