Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(ci): keep an expression matrix directive out of the comparison

mateo-berri4edf6f4dc530
diff --git a/tests/code_coverage_tests/check_workflow_job_name_collisions.py b/tests/code_coverage_tests/check_workflow_job_name_collisions.py
index 482f8386536..ae2c1d80c8f 100644
--- a/tests/code_coverage_tests/check_workflow_job_name_collisions.py
+++ b/tests/code_coverage_tests/check_workflow_job_name_collisions.py
@@ -162,8 +162,10 @@ def listed_values(matrix: Mapping[str, object]) -> tuple[tuple[str, tuple[str, .
def directive_rows(matrix: Mapping[str, object], directive: str) -> tuple[Mapping[str, str], ...] | Opaque:
"""One `include` or `exclude` row, or why the combinations they shape cannot be worked out."""
rows: Final = matrix.get(directive)
- if not isinstance(rows, Sequence) or isinstance(rows, str):
+ if rows is None:
return ()
+ if not isinstance(rows, Sequence) or isinstance(rows, str):
+ return Opaque(f"a matrix `{directive}` is itself an expression rather than a list of rows")
mappings: Final = tuple(row for row in rows if isinstance(row, Mapping))
if len(mappings) != len(rows):
return Opaque(f"a matrix `{directive}` row is not a mapping of values")
diff --git a/tests/code_coverage_tests/test_workflow_job_name_collisions.py b/tests/code_coverage_tests/test_workflow_job_name_collisions.py
index aeb10985e1b..0f5ba43bd7a 100644
--- a/tests/code_coverage_tests/test_workflow_job_name_collisions.py
+++ b/tests/code_coverage_tests/test_workflow_job_name_collisions.py
@@ -846,3 +846,35 @@ def test_a_file_holding_two_yaml_documents_is_reported_rather_than_raising() ->
assert len(unreadable(sources)) == 1
assert exit_code(sources) == 1
+
+
+def test_an_exclude_that_is_itself_an_expression_is_reported_rather_than_ignored() -> None:
+ sources: Final = {
+ "a.yml": (
+ "on: pull_request\njobs:\n one:\n name: build\n runs-on: ubuntu-latest\n"
+ " strategy:\n matrix:\n python: ['3.11', '3.12']\n"
+ " exclude: ${{ fromJson(vars.SKIP) }}\n"
+ ),
+ }
+
+ found: Final = blind_spots(sources)
+
+ assert collisions(sources) == ()
+ assert len(found) == 1
+ assert "a matrix `exclude` is itself an expression" in found[0]
+
+
+def test_an_include_that_is_itself_an_expression_is_reported_rather_than_ignored() -> None:
+ sources: Final = {
+ "a.yml": (
+ "on: pull_request\njobs:\n one:\n name: build-${{ matrix.python }}\n runs-on: ubuntu-latest\n"
+ " strategy:\n matrix:\n python: ['3.11']\n"
+ " include: ${{ fromJson(vars.EXTRA) }}\n"
+ ),
+ }
+
+ found: Final = blind_spots(sources)
+
+ assert collisions(sources) == ()
+ assert len(found) == 1
+ assert "a matrix `include` is itself an expression" in found[0]