Skip to content

Commit 90d1ce6

Browse files
committed
Added php-etl/action-contracts + added rector action
1 parent 14b6249 commit 90d1ce6

File tree

8 files changed

+102
-22
lines changed

8 files changed

+102
-22
lines changed

.github/workflows/phpstan-7.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ jobs:
1515
with:
1616
args: --prefer-dist
1717
php_version: 8.2
18-
1918
- name: PHPStan
2019
uses: php-actions/phpstan@v3
2120
with:

.github/workflows/phpstan-8.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ jobs:
1515
with:
1616
args: --prefer-dist
1717
php_version: 8.2
18-
1918
- name: PHPStan
2019
uses: php-actions/phpstan@v3
2120
with:

.github/workflows/rector.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# github action that checks code with Rector
2+
name: Rector
3+
4+
on: pull_request
5+
6+
jobs:
7+
rector:
8+
runs-on: ubuntu-latest
9+
if: github.event.pull_request.head.repo.full_name == 'php-etl/action-console-runtime'
10+
steps:
11+
-
12+
if: github.event.pull_request.head.repo.full_name == github.repository
13+
uses: actions/checkout@v3
14+
with:
15+
# Must be used to trigger workflow after push
16+
token: ${{ secrets.ACCESS_TOKEN }}
17+
18+
-
19+
uses: shivammathur/setup-php@v2
20+
with:
21+
php-version: 8.1
22+
coverage: none
23+
24+
- uses: "ramsey/composer-install@v2"
25+
26+
- run: bin/rector --ansi
27+
28+
-
29+
# commit only to core contributors who have repository access
30+
uses: stefanzweifel/git-auto-commit-action@v4
31+
with:
32+
commit_message: '[rector] Rector fixes'
33+
commit_author: 'GitHub Action <[email protected]>'
34+
commit_user_email: '[email protected]'

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"require": {
1919
"php": "^8.2",
2020
"symfony/console": "^5.2",
21-
"php-etl/pipeline-contracts": "^0.3.0",
22-
"php-etl/console-state": "^0.1.0"
21+
"php-etl/console-state": "^0.1.0",
22+
"php-etl/action-contracts": "^0.1.0"
2323
},
2424
"autoload": {
2525
"psr-4": {

composer.lock

Lines changed: 55 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rector.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
return static function (RectorConfig $rectorConfig): void {
1212
$rectorConfig->paths([
1313
__DIR__ . '/src',
14-
__DIR__ . '/tests',
1514
]);
1615

1716
$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);

src/ActionRuntimeInterface.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace Kiboko\Component\Runtime\Action;
44

5-
use Kiboko\Contract\Pipeline\ActionInterface;
6-
use Kiboko\Contract\Pipeline\RejectionInterface;
7-
use Kiboko\Contract\Pipeline\RunnableInterface;
8-
use Kiboko\Contract\Pipeline\StateInterface;
5+
use Kiboko\Contract\Action\ActionInterface;
6+
use Kiboko\Contract\Action\RejectionInterface;
7+
use Kiboko\Contract\Action\RunnableInterface;
8+
use Kiboko\Contract\Action\StateInterface;
99

1010
interface ActionRuntimeInterface extends RunnableInterface
1111
{

src/Console.php

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
namespace Kiboko\Component\Runtime\Action;
44

55
use Kiboko\Component\State;
6-
use Kiboko\Contract\Pipeline\ActionInterface;
7-
use Kiboko\Contract\Pipeline\ExecutingActionInterface;
8-
use Kiboko\Contract\Pipeline\RejectionInterface;
9-
use Kiboko\Contract\Pipeline\StateInterface;
6+
use Kiboko\Contract\Action\ActionState;
7+
use Kiboko\Contract\Action\ActionInterface;
8+
use Kiboko\Contract\Action\ExecutingActionInterface;
9+
use Kiboko\Contract\Action\RejectionInterface;
10+
use Kiboko\Contract\Action\StateInterface;
1011
use Symfony\Component\Console\Output\ConsoleOutput;
1112

1213
final class Console implements ActionRuntimeInterface
@@ -26,7 +27,7 @@ public function execute(
2627
RejectionInterface $rejection,
2728
StateInterface $state,
2829
): self {
29-
$this->action->execute($action, $rejection, $state = new State\MemoryState($state));
30+
$this->action->execute($action, $rejection, $state = new ActionState($state));
3031

3132
$this->state
3233
->addMetric('read', $state->observeAccept())
@@ -38,14 +39,8 @@ public function execute(
3839

3940
public function run(int $interval = 1000): int
4041
{
41-
$line = 0;
42-
foreach ($this->action->walk() as $item) {
43-
if ($line++ % $interval === 0) {
44-
$this->state->update();
45-
}
46-
};
4742
$this->state->update();
4843

49-
return $line;
44+
return 1;
5045
}
5146
}

0 commit comments

Comments
 (0)