Skip to content
Open
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
2 changes: 2 additions & 0 deletions .github/actions/install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,6 @@ runs:
composer require --quiet --no-update "symfony/process:${{ inputs.symfony-version }}" --dev
composer require --quiet --no-update "symfony/yaml:${{ inputs.symfony-version }}" --dev
composer require --quiet --no-update "symfony/http-client:${{ inputs.symfony-version }}" --dev
composer require --quiet --no-update "symfony/browser-kit:${{ inputs.symfony-version }}" --dev
composer require --quiet --no-update "symfony/translation:${{ inputs.symfony-version }}" --dev
composer update --no-interaction --no-progress
14 changes: 6 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ jobs:
strategy:
matrix:
include:
- php-version: '8.1'
symfony-version: '6.4.*'
- php-version: '8.4'
symfony-version: '6.4.*'
- php-version: '8.2'
symfony-version: '7.4.*'
- php-version: '8.4'
symfony-version: '7.4.*'
- php-version: '8.4'
symfony-version: '8.0.*'
steps:
- name: "Checkout"
uses: actions/checkout@v2
Expand All @@ -42,7 +40,7 @@ jobs:
uses: ./.github/actions/install
with:
php-version: '8.4'
symfony-version: '7.4.*'
symfony-version: '8.0.*'
- name: "Run static analyzis with phpstan/phpstan"
run: vendor/bin/phpstan analyze

Expand All @@ -56,7 +54,7 @@ jobs:
uses: ./.github/actions/install
with:
php-version: '8.4'
symfony-version: '7.4.*'
symfony-version: '8.0.*'
- name: "Run checkstyle with symplify/easy-coding-standard"
run: vendor/bin/ecs

Expand All @@ -70,7 +68,7 @@ jobs:
uses: ./.github/actions/install
with:
php-version: '8.4'
symfony-version: '7.4.*'
symfony-version: '8.0.*'
- name: "Run tests with phpunit/phpunit"
run: vendor/bin/phpunit --testsuite=Convention

Expand All @@ -85,7 +83,7 @@ jobs:
uses: ./.github/actions/install
with:
php-version: '8.4'
symfony-version: '7.4.*'
symfony-version: '8.0.*'
coverage-mode: 'xdebug'
- name: "Run tests with phpunit/phpunit"
run: |
Expand Down
2 changes: 1 addition & 1 deletion .led/config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[service]
project-name = yokai-batch
[default]
container = php83
container = php84
110 changes: 60 additions & 50 deletions .led/scripts/tests
Original file line number Diff line number Diff line change
@@ -1,67 +1,77 @@
#!/usr/bin/env php
<?php

use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\SingleCommandApplication;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Process\Process;
use Symfony\Component\Yaml\Yaml;

require_once __DIR__ . '/../../vendor/autoload.php';

$action = Yaml::parseFile(__DIR__ . '/../../.github/actions/install/action.yml');
$composer = \array_filter(\explode(\PHP_EOL, $action['runs']['steps'][1]['run']));
(new SingleCommandApplication())
->setCode(function (InputInterface $input, OutputInterface $output) {
$return = 0;

$io = new SymfonyStyle(new ArrayInput([]), new ConsoleOutput());
$action = Yaml::parseFile(__DIR__ . '/../../.github/actions/install/action.yml');
$composer = \array_filter(\explode(\PHP_EOL, $action['runs']['steps'][1]['run']));

$execute = function (array $job, string|null $php = null, string|null $symfony = null) use ($io, $composer) {
$io->section($job['name']);
$io = new SymfonyStyle($input, $output);

if ($php === null && $symfony === null) {
['php-version' => $php, 'symfony-version' => $symfony] = $job['steps'][1]['with'];
} else {
$io->definitionList(
['PHP' => $php],
['Symfony' => $symfony],
);
}
$execute = function (array $job, string|null $php = null, string|null $symfony = null) use ($io, $composer) {
$io->section($job['name']);

$process = function (string $command, bool $output) use ($io, $php) {
$container = 'php' . \str_replace('.', '', $php);
$command = "led in -s {$container} -- {$command}";
if ($php === null && $symfony === null) {
['php-version' => $php, 'symfony-version' => $symfony] = $job['steps'][1]['with'];
} else {
$io->definitionList(
['PHP' => $php],
['Symfony' => $symfony],
);
}

$callback = null;
if ($output) {
$io->writeln($command);
$callback = function ($type, $buffer) {
echo $buffer;
$process = function (string $command, bool $output) use ($io, $php) {
$container = 'php' . \str_replace('.', '', $php);
$command = "led in -s {$container} -- {$command}";

$callback = null;
if ($output) {
$io->writeln($command);
$callback = function ($type, $buffer) {
echo $buffer;
};
}

Process::fromShellCommandline($command)->mustRun($callback);
};

foreach ($composer as $command) {
$process(\str_replace('${{ inputs.symfony-version }}', $symfony, $command), false);
}
$process($job['steps'][2]['run'], true);
};

$tests = Yaml::parseFile(__DIR__ . '/../../.github/workflows/tests.yml');

try {
$execute($tests['jobs']['checkstyke']);
$execute($tests['jobs']['phpstan']);
$execute($tests['jobs']['conventions']);

$phpunitTestingMatrix = $tests['jobs']['phpunit']['strategy']['matrix']['include'];
foreach ($phpunitTestingMatrix as ['php-version' => $php, 'symfony-version' => $symfony]) {
$execute($tests['jobs']['phpunit'], $php, $symfony);
}
} catch (\Throwable) {
$return = 1;
$io->error('An error occurred, abort tests.');
}

Process::fromShellCommandline($command)->mustRun($callback);
};

foreach ($composer as $command) {
$process(\str_replace('${{ inputs.symfony-version }}', $symfony, $command), false);
}
$process($job['steps'][2]['run'], true);
};

$tests = Yaml::parseFile(__DIR__ . '/../../.github/workflows/tests.yml');

try {
$execute($tests['jobs']['checkstyke']);
$execute($tests['jobs']['phpstan']);
$execute($tests['jobs']['conventions']);

$phpunitTestingMatrix = $tests['jobs']['phpunit']['strategy']['matrix']['include'];
foreach ($phpunitTestingMatrix as ['php-version' => $php, 'symfony-version' => $symfony]) {
$execute($tests['jobs']['phpunit'], $php, $symfony);
}
} catch (\Throwable) {
$io->error('An error occurred, abort tests.');
}

$io->success('Revert changes made to composer.json');
Process::fromShellCommandline('git restore composer.json')->mustRun();
Process::fromShellCommandline('led in -- composer update')->mustRun();
$io->success('Revert changes made to composer.json');
Process::fromShellCommandline('git restore composer.json')->mustRun();
Process::fromShellCommandline('led in -- composer update')->mustRun();

return $return;
})
->run();
55 changes: 27 additions & 28 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,47 +11,46 @@
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": "^8.1",
"php": "^8.2",
"ext-json": "*",
"composer-runtime-api": "^2.0",
"doctrine/dbal": "^2.11|^3.0",
"doctrine/orm": "^2.8",
"doctrine/persistence": "^2.0|^3.0",
"doctrine/dbal": "^4.0",
"doctrine/orm": "^3.0",
"doctrine/persistence": "^4.0",
"league/flysystem": "^3.0",
"openspout/openspout": "^4.0",
"psr/container": "^1.0",
"psr/event-dispatcher": "^1.0",
"psr/log": "^1.0|^2.0|^3.0",
"symfony/config": "^6.4|^7.0",
"symfony/console": "^6.4|^7.0",
"symfony/dependency-injection": "^6.4|^7.0",
"symfony/form": "^6.4|^7.0",
"symfony/http-kernel": "^6.4|^7.0",
"symfony/framework-bundle": "^6.4|^7.0",
"symfony/messenger": "^6.4|^7.0",
"symfony/serializer": "^6.4|^7.0",
"symfony/uid": "^6.4|^7.0",
"symfony/validator": "^6.4|^7.0"
"psr/log": "^3.0",
"symfony/config": "^7.4|^8.0",
"symfony/console": "^7.4|^8.0",
"symfony/dependency-injection": "^7.4|^8.0",
"symfony/form": "^7.4|^8.0",
"symfony/http-kernel": "^7.4|^8.0",
"symfony/framework-bundle": "^7.4|^8.0",
"symfony/messenger": "^7.4|^8.0",
"symfony/serializer": "^7.4|^8.0",
"symfony/uid": "^7.4|^8.0",
"symfony/validator": "^7.4|^8.0"
},
"require-dev": {
"doctrine/annotations": "^1.14",
"doctrine/doctrine-bundle": "^2.5",
"doctrine/doctrine-bundle": "^2.0|^3.0",
"league/flysystem-memory": "^3.0",
"phpspec/prophecy-phpunit": "^2.0",
"phpstan/phpstan": "^1.4",
"phpunit/phpunit": "^9.5",
"phpunit/phpunit": "^11.0|^12.0",
"sonata-project/admin-bundle": "^4.0",
"symfony/browser-kit": "^6.4|^7.0",
"symfony/css-selector": "^6.4|^7.0",
"symfony/filesystem": "^6.4|^7.0",
"symfony/finder": "^6.4|^7.0",
"symfony/process": "^6.4|^7.0",
"symfony/security-bundle": "^6.4|^7.0",
"symfony/translation": "^6.4|^7.0",
"symfony/twig-bundle": "^6.4|^7.0",
"symfony/yaml": "^6.4|^7.0",
"symfony/browser-kit": "^7.4|^8.0",
"symfony/css-selector": "^7.4|^8.0",
"symfony/filesystem": "^7.4|^8.0",
"symfony/finder": "^7.4|^8.0",
"symfony/process": "^7.4|^8.0",
"symfony/security-bundle": "^7.4|^8.0",
"symfony/translation": "^7.4|^8.0",
"symfony/twig-bundle": "^7.4|^8.0",
"symfony/yaml": "^7.4|^8.0",
"symplify/easy-coding-standard": "^12.5",
"symfony/http-client": "^6.4|^7.0"
"symfony/http-client": "^7.4|^8.0"
},
"replace": {
"yokai/batch": "self.version",
Expand Down
3 changes: 3 additions & 0 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,8 @@
ArrayOpenerAndCloserNewlineFixer::class,
ExplicitStringVariableFixer::class,
StandaloneLineInMultilineArrayFixer::class,
NativeFunctionInvocationFixer::class => [
'src/batch-symfony-framework/src/Resources/*',
],
])
;
18 changes: 4 additions & 14 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,18 @@

<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="tests/bootstrap.php"
>
<php>
<env name="ARTIFACT_DIR" value="tests/.artifacts"/>
<env name="DATABASE_URL" value="sqlite:///:memory:"/>
<env name="DATABASE_URL" value="pdo-sqlite:///:memory:"/>
<env name="KERNEL_CLASS" value="Yokai\Batch\Sources\Tests\Symfony\App\Kernel"/>
</php>

<testsuites>
<testsuite name="Package">
<directory>./src/*/tests</directory>
</testsuite>
<testsuite name="Integration">
<directory>./tests/integration</directory>
</testsuite>
<testsuite name="Symfony">
<directory>./tests/symfony/tests</directory>
</testsuite>

<testsuite name="Code">
<directory>./src/*/tests</directory>
<directory>./tests/integration</directory>
Expand All @@ -34,9 +24,9 @@
</testsuite>
</testsuites>

<coverage>
<source>
<include>
<directory>./src/*/src</directory>
</include>
</coverage>
</source>
</phpunit>
6 changes: 3 additions & 3 deletions src/batch-doctrine-dbal/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
}
],
"require": {
"php": "^8.1",
"php": "^8.2",
"ext-json": "*",
"doctrine/dbal": "^2.11|^3.0",
"doctrine/persistence": "^2.0|^3.0",
"doctrine/dbal": "^4.0",
"doctrine/persistence": "^4.0",
"yokai/batch": "^0.7.0"
},
"autoload": {
Expand Down
Loading
Loading