Skip to content

Commit

Permalink
Debug parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
druzsan committed Feb 7, 2024
1 parent 2963700 commit eca286e
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,28 @@ def parse_include_exclude(input_include_exclude: str) -> list:


def assert_valid_extra(extra: Any) -> None:
"""
Validate strategy include/exclude.
"""
if not isinstance(extra, list):
raise TypeError(
f"Include/exclude must be an array (Python list), but Python "
f"{type(extra)} received."
)
# for combination in extra:
# if not isinstance(combination, dict):
# raise TypeError(
# f"Each include/exclude combination must a dict, but "
# f"{type(combination)} received."
# )


def assert_valid_matrix(matrix: Any) -> None:
"""
Validate strategy matrix.
"""
if matrix is None:
raise RuntimeError("Strategy matrix must define at least one combination.")
if not isinstance(matrix, dict):
raise TypeError(
f"Matrix must be a mapping (Python dict), but Python "
Expand All @@ -100,8 +114,7 @@ def parse_matrix(input_matrix: str) -> dict:
matrix = yaml.load(input_matrix, Loader=yaml.loader.BaseLoader)
print(matrix)

if matrix is None:
raise RuntimeError("Strategy matrix must define at least one combination.")
assert_valid_matrix(matrix)

return matrix

Expand All @@ -112,7 +125,7 @@ def parse_matrix(input_matrix: str) -> dict:
print(yaml.dump({"matrix": matrix}))

# output_matrix = json.dumps(matrix)
output_matrix = "{'include':[],'exclude':[]}"
output_matrix = "{'include':[['a','b']]}"

output("matrix", output_matrix)
setenv("MATRIX", output_matrix)

0 comments on commit eca286e

Please sign in to comment.