Skip to content

Commit 2692f0b

Browse files
authored
Merge pull request #168 from php-etl/fix/job-code-and-cloud-configuration
Made the step code mandatory to avoid problems
2 parents d631b9d + 891e3fd commit 2692f0b

File tree

11 files changed

+26
-23
lines changed

11 files changed

+26
-23
lines changed

.github/workflows/infection.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jobs:
44
infection:
55
runs-on: ubuntu-latest
66
steps:
7-
- uses: actions/checkout@v3
7+
- uses: actions/checkout@v4
88
- uses: shivammathur/setup-php@v2
99
with:
1010
php-version: '8.2'
@@ -29,6 +29,6 @@ jobs:
2929
./infection.phar
3030
3131
- name: Store infection log
32-
uses: actions/upload-artifact@v3
32+
uses: actions/upload-artifact@v4
3333
with:
3434
path: infection.log

.github/workflows/phpstan-5.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ jobs:
44
phpstan5:
55
runs-on: ubuntu-latest
66
steps:
7-
- uses: actions/checkout@v3
8-
- uses: actions/cache@v3
7+
- uses: actions/checkout@v4
8+
- uses: actions/cache@v4
99
with:
1010
path: '**/vendor'
1111
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}

.github/workflows/phpstan-6.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ jobs:
44
phpstan6:
55
runs-on: ubuntu-latest
66
steps:
7-
- uses: actions/checkout@v3
8-
- uses: actions/cache@v3
7+
- uses: actions/checkout@v4
8+
- uses: actions/cache@v4
99
with:
1010
path: '**/vendor'
1111
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}

.github/workflows/phpstan-7.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ jobs:
44
phpstan7:
55
runs-on: ubuntu-latest
66
steps:
7-
- uses: actions/checkout@v3
8-
- uses: actions/cache@v3
7+
- uses: actions/checkout@v4
8+
- uses: actions/cache@v4
99
with:
1010
path: '**/vendor'
1111
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}

.github/workflows/phpstan-8.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ jobs:
44
phpstan8:
55
runs-on: ubuntu-latest
66
steps:
7-
- uses: actions/checkout@v3
8-
- uses: actions/cache@v3
7+
- uses: actions/checkout@v4
8+
- uses: actions/cache@v4
99
with:
1010
path: '**/vendor'
1111
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}

.github/workflows/phpunit.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jobs:
44
phpunit:
55
runs-on: ubuntu-latest
66
steps:
7-
- uses: actions/checkout@v3
7+
- uses: actions/checkout@v4
88
- uses: shivammathur/setup-php@v2
99
with:
1010
php-version: '8.2'
@@ -25,6 +25,6 @@ jobs:
2525
run: bin/phpunit --coverage-html var/coverage
2626

2727
- name: Store coverage files
28-
uses: actions/upload-artifact@v3
28+
uses: actions/upload-artifact@v4
2929
with:
3030
path: var/coverage

.github/workflows/quality.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jobs:
44
cs-fixer:
55
runs-on: ubuntu-latest
66
steps:
7-
- uses: actions/checkout@v3
7+
- uses: actions/checkout@v4
88
- uses: shivammathur/setup-php@v2
99
with:
1010
php-version: '8.2'
@@ -19,8 +19,8 @@ jobs:
1919
phpstan:
2020
runs-on: ubuntu-latest
2121
steps:
22-
- uses: actions/checkout@v3
23-
- uses: actions/cache@v3
22+
- uses: actions/checkout@v4
23+
- uses: actions/cache@v4
2424
with:
2525
path: '**/vendor'
2626
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}

.github/workflows/rector.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
steps:
1212
-
1313
if: github.event.pull_request.head.repo.full_name == github.repository
14-
uses: actions/checkout@v3
14+
uses: actions/checkout@v4
1515

1616
-
1717
uses: shivammathur/setup-php@v2

src/Cloud/Workflow.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,9 @@ public static function fromLegacyConfiguration(array $configuration): DTO\Workfl
3434
$configuration['code'] ?? sprintf('workflow%s', $random),
3535
new DTO\JobList(
3636
...array_map(
37-
function (array $config, int $order) {
37+
function (string $code, array $config, int $order) {
3838
if (\array_key_exists('pipeline', $config)) {
3939
$name = $config['pipeline']['name'] ?? sprintf('pipeline%d', $order);
40-
$code = $config['pipeline']['code'] ?? sprintf('pipeline%d', $order);
4140
unset($config['pipeline']['name'], $config['pipeline']['code']);
4241

4342
array_walk_recursive($config, function (&$value): void {
@@ -50,13 +49,14 @@ function (array $config, int $order) {
5049
$name,
5150
new JobCode($code),
5251
new StepList(
53-
...array_map(fn (array $step, int $order) => new Step(
52+
...array_map(fn(string $code, array $step, int $order) => new Step(
5453
$step['name'] ?? sprintf('step%d', $order),
55-
new StepCode($step['code'] ?? sprintf('step%d', $order)),
54+
new StepCode($code ?? sprintf('step%d', $order)),
5655
$step,
5756
new ProbeList(),
5857
$order
5958
),
59+
array_keys($config['pipeline']['steps']),
6060
$config['pipeline']['steps'],
6161
range(0, (is_countable($config['pipeline']['steps']) ? \count($config['pipeline']['steps']) : 0) - 1)
6262
),
@@ -67,7 +67,6 @@ function (array $config, int $order) {
6767

6868
if (\array_key_exists('action', $config)) {
6969
$name = $config['action']['name'] ?? sprintf('action%d', $order);
70-
$code = $config['action']['code'] ?? sprintf('action%d', $order);
7170
unset($config['action']['name'], $config['action']['code']);
7271

7372
array_walk_recursive($config, function (&$value): void {
@@ -90,8 +89,9 @@ function (array $config, int $order) {
9089

9190
throw new \RuntimeException('This type is currently not supported.');
9291
},
92+
array_keys($configuration['workflow']['jobs']),
9393
$configuration['workflow']['jobs'],
94-
range(0, (is_countable($configuration['workflow']['jobs']) ? \count($configuration['workflow']['jobs']) : 0) - 1)
94+
range(0, (is_countable($configuration['workflow']['jobs']) ? \count($configuration['workflow']['jobs']) : 0) - 1),
9595
)
9696
),
9797
new Composer(

src/Runtime/Pipeline/Configuration.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public function getStepsTreeBuilder(): TreeBuilder
4444

4545
/* @phpstan-ignore-next-line */
4646
$builder->getRootNode()
47+
->useAttributeAsKey('code')
4748
->requiresAtLeastOneElement()
4849
->cannotBeEmpty()
4950
->isRequired()

0 commit comments

Comments
 (0)