diff --git a/sr-data/src/sr_data/steps/workflows.py b/sr-data/src/sr_data/steps/workflows.py index 7bed0d9..9d8ca72 100644 --- a/sr-data/src/sr_data/steps/workflows.py +++ b/sr-data/src/sr_data/steps/workflows.py @@ -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) diff --git a/sr-data/src/tests/test_workflows.py b/sr-data/src/tests/test_workflows.py index 6234be8..c2666d5 100644 --- a/sr-data/src/tests/test_workflows.py +++ b/sr-data/src/tests/test_workflows.py @@ -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" + )