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

CI: Add TYPO3 v13 to test matrix #1113

Draft
wants to merge 38 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
ffbc1a8
CI: Add TYPO3 v13 to test matrix
tomasnorre Oct 14, 2024
a98bef4
Update Tests.yml
tomasnorre Oct 14, 2024
a2942f0
Update Tests.yml
tomasnorre Oct 14, 2024
ff56181
Update Tests.yml to include TYPO3 ^13.3
tomasnorre Oct 14, 2024
7dbfd33
Fix Unittests for TYPO3 v13
tomasnorre Oct 15, 2024
1166247
bump TYPO3 to 13.4
tomasnorre Oct 15, 2024
d20e08c
small updates
tomasnorre Oct 15, 2024
57cccac
add $this->resetSingletonInstances = true;
tomasnorre Oct 15, 2024
c8d7005
Add BackendModuleLinkService to services.yaml
tomasnorre Oct 16, 2024
949913f
Switch to Attribute for tests
tomasnorre Oct 16, 2024
2c9d7e9
Remove unneded mock
tomasnorre Oct 16, 2024
7831073
Update composer.json
tomasnorre Oct 16, 2024
09a1f48
TCA for tx_crawler_queue
tomasnorre Oct 16, 2024
d9348e2
Add XDEBUG conf
tomasnorre Oct 16, 2024
fca72cf
Fix more tests
tomasnorre Oct 16, 2024
3b91182
Remove SystemSleep Helper Test
tomasnorre Oct 16, 2024
88faeb6
Empty TCA
tomasnorre Oct 16, 2024
b9eb34b
Add IF statement for SiteBasedTrait
tomasnorre Oct 16, 2024
edb3b14
Fix CS Styles
tomasnorre Oct 16, 2024
dc0da39
include 13.4
tomasnorre Oct 17, 2024
bab6b24
use shorthandles
tomasnorre Oct 17, 2024
77e5964
Use Core SiteBasedTrait in test
tomasnorre Oct 17, 2024
5af3506
add runTest.sh
tomasnorre Oct 17, 2024
6512d11
sync runTests.sh
tomasnorre Oct 17, 2024
4ec0fc6
Disable docker containers default
tomasnorre Oct 17, 2024
4c9249a
Adjust tests
tomasnorre Oct 17, 2024
1464337
Remove obsolete TCA configs
tomasnorre Oct 17, 2024
92934b8
Remove RunInSeperateProcess Attribute
tomasnorre Oct 17, 2024
a3749c5
Adjust devbox composer + Acc Test action
tomasnorre Oct 17, 2024
6addfc4
Add Playwright Acceptance Tests for TYPO3 13 LTS
tomasnorre Oct 18, 2024
35b3791
Add Playwright Acceptance Test to CI
tomasnorre Oct 22, 2024
94fdff5
Adjust CI
tomasnorre Oct 22, 2024
af25caf
Add georgringer/news to V12 acceptance
tomasnorre Oct 22, 2024
5d15536
Ignore HTTPS errors in playwright
tomasnorre Oct 22, 2024
3cf3baf
CI: FIX AcC for v12
tomasnorre Oct 22, 2024
6b0202e
Add more tests
tomasnorre Oct 23, 2024
68d3d99
Add georgringer/news back in devbox
tomasnorre Oct 23, 2024
b7fef94
Adjust news test
tomasnorre Oct 23, 2024
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
4 changes: 2 additions & 2 deletions .Docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: '3.1'
services:
db:
image: mariadb:10.3
restart: unless-stopped
restart: never
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: crawler
Expand All @@ -14,7 +14,7 @@ services:

db_postgres:
image: postgres:13.5-alpine3.15
restart: unless-stopped
restart: never
environment:
POSTGRES_DB: crawler
POSTGRES_USER: root
Expand Down
19 changes: 10 additions & 9 deletions .devbox/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,17 @@
"issues": "https://github.com/tomasnorre/crawler/issues"
},
"require": {
"georgringer/news": "^11.4",
"tnm/crawler-devbox-sitepackage": "^0.0.2",
"tnm/crawler-devbox-sitepackage": "^0.0.3",
"tomasnorre/crawler": "*@dev",
"typo3/cms-belog": "^12.4 || dev-main" ,
"typo3/cms-beuser": "^12.4 || dev-main",
"typo3/cms-felogin": "^12.4 || dev-main",
"typo3/cms-indexed-search": "^12.4 || dev-main",
"typo3/cms-info": "^12.4 || dev-main",
"typo3/cms-tstemplate": "^12.4 || dev-main",
"typo3/minimal": "^12.4 || dev-main"
"typo3/cms-belog": "^12.4 || ^13.4" ,
"typo3/cms-beuser": "^12.4 || ^13.4",
"typo3/cms-felogin": "^12.4 || ^13.4",
"typo3/cms-indexed-search": "^12.4 || ^13.4",
"typo3/cms-info": "^12.4 || ^13.4",
"typo3/cms-tstemplate": "^12.4 || ^13.4",
"typo3/minimal": "^12.4 || ^13.4",
"typo3/cms-install": "^12.4 || ^13.4",
"georgringer/news": "^12"
},
"require-dev": {
"roave/security-advisories": "dev-latest"
Expand Down
116 changes: 63 additions & 53 deletions .github/workflows/Acceptance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- "main"

jobs:
Acceptance:
Acceptance-CodeCeption:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
Expand Down Expand Up @@ -96,56 +96,66 @@ jobs:
source_dir: 'Tests/Acceptance/_output/'
destination_dir: '${{ matrix.typo3 }}-${{ matrix.php }}'

Acceptance-Playwright:
strategy:
fail-fast: false
matrix:
typo3:
- ^13.4
php:
- '8.2'
- '8.3'
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- name: Get branch name (merge)
if: github.event_name != 'pull_request'
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV

# Non Composer is commented out for now, till I find a better way to run them, the are failing more than not, so they
# don't bring much value atm as they are often ignored. I know not good, but none the less the case.
# NonComposer:
# runs-on: self-hosted
# strategy:
# fail-fast: false
# matrix:
# typo3:
# - 'v11'
# - 'v11p80'
#
# steps:
# - uses: shivammathur/setup-php@v2
# with:
# php-version: '8.1'
# tools: composer:v2
# coverage: none
#
# - name: Version information
# run: |
# php -v
# composer --version
#
# - uses: actions/checkout@v4
# - run: |
# cd .devbox/.ddev
# docker-compose -f docker-compose.selenium.yaml up -d
# cd ../.. # Going back to "root" directory
# rm -rf .Build composer.lock
# composer require nimut/typo3-complete:^11.5
# wget https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh
# chmod +x wait-for-it.sh
# docker ps
# ./wait-for-it.sh -t 60 localhost:4444
# php .Build/bin/codecept run --env=${{ matrix.typo3 }}-non-composer
#
# - name: Upload Codeception output
# if: ${{ failure() }}
# uses: actions/upload-artifact@v4
# with:
# name: codeception-results
# path: Tests/Acceptance/_output/
#
# - uses: shallwefootball/s3-upload-action@master
# if: ${{ failure() }}
# with:
# aws_key_id: ${{ secrets.AWS_KEY_ID }}
# aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
# aws_bucket: ${{ secrets.AWS_BUCKET }}
# source_dir: 'Tests/Acceptance/_output/'
# destination_dir: '${{ matrix.typo3 }}-non-composer'
#
- name: Get branch name (pull request)
if: github.event_name == 'pull_request'
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF})" >> $GITHUB_ENV

- uses: actions/checkout@v4
- uses: ddev/github-action-setup-ddev@v1
with:
ddevDir: ".devbox"
- name: CodeCeption
run: |
export FROM_PATH='../../'
export TO_PATH=$(echo $GITHUB_WORKSPACE)
cd .devbox
sed -i 's/php_version: "8.1"/php_version: "${{ matrix.php }}"/g' .ddev/config.yaml
sed -i "s|$FROM_PATH|$TO_PATH|g" .ddev/docker-compose.volume.yaml
ddev restart
rm -rf vendor composer.lock
ddev composer require typo3/cms-core=${{ matrix.typo3 }} tomasnorre/crawler=dev-$BRANCH_NAME
ddev exec bin/typo3 backend:lock
ddev exec bin/typo3 extension:setup
ddev exec bin/typo3 cache:flush
ddev exec bin/typo3 cache:warmup
ddev exec bin/typo3 upgrade:run
ddev exec bin/typo3 backend:unlock
cd .. # Going back to "root" directory
wget https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh
chmod +x wait-for-it.sh
docker ps
./wait-for-it.sh -t 60 127.0.0.1:80
./wait-for-it.sh -t 60 127.0.0.1:443
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: cd Tests/Acceptance-Playwright && npm ci
- name: Install Playwright Browsers
run: cd Tests/Acceptance-Playwright && npx playwright install --with-deps
- name: Run Playwright tests
run: cd Tests/Acceptance-Playwright && npx playwright test
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30
18 changes: 11 additions & 7 deletions .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ jobs:
- '8.3'
mysql:
- '8.0'
include:
- typo3: '^13.4'
php: '8.3'
mysql: '8.0'

steps:
- name: Set up MySQL ${{ matrix.mysql }}
Expand All @@ -49,7 +53,7 @@ jobs:
run: composer validate

- name: Install dependencies with typo3/cms-core:${{ matrix.typo3 }}
if: matrix.typo3 != 'dev-main'
if: matrix.typo3 != '^13.4'
run: |
composer require typo3/cms-core:${{ matrix.typo3 }} --no-progress
git checkout composer.json
Expand All @@ -59,7 +63,7 @@ jobs:
run: find . -name \*.php ! -path "./.Build/*" ! -path "./scripts/*" ! -path "./typo3_src/*" ! -path "./Resources/*" | parallel --gnu php -d display_errors=stderr -l {} > /dev/null \;

- name: Unit Tests
if: matrix.typo3 != 'dev-main'
if: matrix.typo3 != '^13.4'
run: |
export "UNIT_XML"=Tests/UnitTests.xml
.Build/bin/phpunit --coverage-filter Classes --coverage-clover=unittest-coverage.clover --colors -c $UNIT_XML Tests/Unit
Expand All @@ -68,24 +72,24 @@ jobs:
run: |
export "FUNCTIONAL_XML"=Tests/FunctionalTests.xml
.Build/bin/phpunit --coverage-filter Classes --coverage-clover=functional-coverage.clover --colors -c $FUNCTIONAL_XML Tests/Functional --process-isolation
if: matrix.typo3 != 'dev-main'
if: matrix.typo3 != '^13.4'
env:
typo3DatabaseHost: 127.0.0.1
typo3DatabaseName: typo3
typo3DatabasePassword: root
typo3DatabaseUsername: root

- name: Tests for dev-main
- name: Tests for ^13.4
run: |
export "FUNCTIONAL_XML"=Tests/FunctionalTests.xml
export "UNIT_XML"=Tests/UnitTests.xml
composer remove --dev ssch/typo3-rector
composer remove --dev ssch/typo3-rector infection/infection
rm -rf composer.lock .Build
composer require typo3/cms-core:dev-main
composer require typo3/cms-backend:^13.4 typo3/cms-core:^13.4 typo3/cms-frontend:^13.4 typo3/cms-info:^13.4 typo3/cms-seo:^13.4
ln -nfs .Build/vendor/typo3/cms/typo3 typo3
.Build/bin/phpunit --colors -c $UNIT_XML Tests/Unit
.Build/bin/phpunit --colors -c $FUNCTIONAL_XML Tests/Functional --process-isolation
if: matrix.typo3 == 'dev-main' && matrix.php == '8.1'
if: matrix.typo3 == '^13.4' && matrix.php == '8.3'
env:
typo3DatabaseHost: 127.0.0.1
typo3DatabaseName: typo3
Expand Down
5 changes: 5 additions & 0 deletions .run/Xdebug.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Xdebug" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="NOT_FILTER">
<method v="2" />
</configuration>
</component>
19 changes: 16 additions & 3 deletions Classes/Domain/Repository/ProcessRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,18 @@
use AOE\Crawler\Domain\Model\Process;
use AOE\Crawler\Domain\Model\ProcessCollection;
use Doctrine\DBAL\ArrayParameterType;
use Doctrine\DBAL\Exception;
use Symfony\Contracts\Service\Attribute\Required;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
use TYPO3\CMS\Core\Database\Query\Restriction\HiddenRestriction;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Persistence\Repository;

/**
* @internal since v9.2.5
*/
class ProcessRepository extends Repository
class ProcessRepository
{
final public const TABLE_NAME = 'tx_crawler_process';

Expand All @@ -66,12 +68,16 @@ public function setQueryBuilder(): void

/**
* This method is used to find all cli processes within a limit.
* @throws Exception
*/
public function findAll(): ProcessCollection
{
/** @var ProcessCollection $collection */
$collection = GeneralUtility::makeInstance(ProcessCollection::class);
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(self::TABLE_NAME);
$queryBuilder->getRestrictions()
->removeByType(HiddenRestriction::class)
->removeByType(DeletedRestriction::class);

$statement = $queryBuilder
->select('*')
Expand Down Expand Up @@ -143,6 +149,10 @@ public function removeByProcessId($processId): void
public function getActiveProcessesOlderThanOneHour()
{
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(self::TABLE_NAME);
$queryBuilder->getRestrictions()
->removeByType(HiddenRestriction::class)
->removeByType(DeletedRestriction::class);

$activeProcesses = [];
$statement = $queryBuilder
->select('process_id', 'system_process_id')
Expand Down Expand Up @@ -172,6 +182,9 @@ public function getActiveProcessesOlderThanOneHour()
public function getActiveOrphanProcesses()
{
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(self::TABLE_NAME);
$queryBuilder->getRestrictions()
->removeByType(HiddenRestriction::class)
->removeByType(DeletedRestriction::class);

return $queryBuilder
->select('process_id', 'system_process_id')
Expand Down Expand Up @@ -212,7 +225,7 @@ public function deleteProcessesMarkedAsDeleted(): void
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(self::TABLE_NAME);
$queryBuilder
->delete(self::TABLE_NAME)
->where($queryBuilder->expr()->eq('deleted', 1))
->where($queryBuilder->expr()->eq('deleted', $queryBuilder->createNamedParameter(1)))
->executeStatement();
}

Expand Down
36 changes: 31 additions & 5 deletions Classes/Domain/Repository/QueueRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,18 @@
use AOE\Crawler\Domain\Model\Process;
use AOE\Crawler\Value\QueueFilter;
use Doctrine\DBAL\ArrayParameterType;
use PDO;
use Doctrine\DBAL\Exception;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use Symfony\Contracts\Service\Attribute\Required;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Persistence\Repository;

/**
* @internal since v9.2.5
*/
class QueueRepository extends Repository implements LoggerAwareInterface
class QueueRepository implements LoggerAwareInterface
{
use LoggerAwareTrait;

Expand Down Expand Up @@ -129,7 +128,7 @@ public function getQueueEntriesByQid(int $queueId, bool $force): array|false
->select('*')
->from(self::TABLE_NAME)
->where(
$queryBuilder->expr()->eq('qid', $queryBuilder->createNamedParameter($queueId, PDO::PARAM_INT))
$queryBuilder->expr()->eq('qid', $queryBuilder->createNamedParameter($queueId, Connection::PARAM_INT))
);
if (!$force) {
$queryBuilder
Expand Down Expand Up @@ -431,7 +430,7 @@ public function getDuplicateQueueItemsIfExists(
$timeBegin = $currentTime - 100;
$timeEnd = $currentTime + 100;
$queryBuilder
->where('scheduled BETWEEN ' . $timeBegin . ' AND ' . $timeEnd . '')
->where('scheduled BETWEEN ' . $timeBegin . ' AND ' . $timeEnd . ' ')
->orWhere($queryBuilder->expr()->lte('scheduled', $currentTime));
} else {
$queryBuilder
Expand Down Expand Up @@ -506,6 +505,33 @@ public function getQueueEntriesForPageId(int $id, int $itemsPerPage, QueueFilter
return $queryBuilder->executeQuery()->fetchAllAssociative();
}

/**
* @throws Exception
*/
public function findAll(): array
{
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(self::TABLE_NAME);
$queryBuilder
->select('*')
->from(self::TABLE_NAME);
return $queryBuilder->executeQuery()->fetchAllAssociative();
}

public function findByProcessId(string $processId): array
{
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(self::TABLE_NAME);
return $queryBuilder
->select('*')
->from(self::TABLE_NAME)
->where(
$queryBuilder->expr()->eq('process_id', $queryBuilder->createNamedParameter(
$processId,
Connection::PARAM_INT
))
)
->executeQuery()->fetchAllAssociative();
}

/**
* This internal helper method is used to create an instance of an entry object
*
Expand Down
Loading
Loading