Skip to content

Commit

Permalink
fix(#276): parses oss as list in matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
h1alexbel committed Dec 4, 2024
1 parent b310c9d commit 6f0be9d
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sr-data/src/sr_data/steps/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,11 @@ def workflow_info(content):
if len(keys) == 1:
if matrix.get(keys[0]):
for matrixed in matrix.get(keys[0]):
oss.append(matrixed)
if isinstance(matrixed, list):
for r in matrixed:
oss.append(r)
else:
oss.append(matrixed)
elif len(keys) > 1:
for system in dot_values(keys, matrix):
oss.append(system)
Expand Down
31 changes: 31 additions & 0 deletions sr-data/src/tests/test_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,3 +369,34 @@ def test_parses_none_matrix(self):
0,
f"Steps count in workflow: '{info}' does not match with expected"
)

@pytest.mark.fast
def test_parses_oss_as_list_in_matrix(self):
info = workflow_info(
"""
name: test
on: push
jobs:
build:
strategy:
matrix:
os:
- [self-hosted]
runs-on: ${{ matrix.os }}
"""
)
self.assertEqual(
info["w_oss"],
["self-hosted"],
f"Workflow OSs: '{info}' does not match with expected"
)
self.assertEqual(
info["w_jobs"],
1,
f"Jobs count in workflow: '{info}' does not match with expected"
)
self.assertEqual(
info["w_steps"],
0,
f"Steps count in workflow: '{info}' does not match with expected"
)

0 comments on commit 6f0be9d

Please sign in to comment.