Skip to content

Test generated workflow matrix schemas#6277

Open
ScottTodd wants to merge 6 commits into
mainfrom
users/scotttodd/matrix-workflow-tests
Open

Test generated workflow matrix schemas#6277
ScottTodd wants to merge 6 commits into
mainfrom
users/scotttodd/matrix-workflow-tests

Conversation

@ScottTodd

@ScottTodd ScottTodd commented Jun 30, 2026

Copy link
Copy Markdown
Member

Motivation

Overall CI test quality improvement as part of #3336.

We've been replacing inline workflow matrix code with dynamic matrix generator scripts but the data produced by these scripts was only tested by actually running the workflows. This adds unit test coverage ensuring that every matrix.value key in each workflow file is actually produced for every row of a generated matrix. This won't catch all errors, but it will give us more confidence and guard against typos.

See prior PRs:

Technical Details

I decided to start by just checking one way: every matrix.value in a workflow must be produced by the generator. The opposite direction (the generator producing a value not used by a workflow) is not checked yet. Some jobs may only want to read a subset of the values and that could be okay.

Test Plan

Each of the new tests can fail with mismatches in either the workflows or the generator scripts:

--- a/.github/workflows/multi_arch_build_windows_pytorch_wheels.yml
+++ b/.github/workflows/multi_arch_build_windows_pytorch_wheels.yml
@@ -473,7 +473,7 @@ jobs:
     uses: ./.github/workflows/test_pytorch_wheels.yml
     with:
       amdgpu_family: ${{ matrix.amdgpu_family }}
-      test_runs_on: ${{ matrix.test_runs_on }}
+      test_runs_on: ${{ matrix.unknown_key }}
--- a/build_tools/github_actions/configure_pytorch_test_matrix.py
+++ b/build_tools/github_actions/configure_pytorch_test_matrix.py
@@ -69,7 +69,7 @@ def build_test_matrix(
         include.append(
             {
                 "amdgpu_family": requested_family,
-                "test_runs_on": test_runs_on,
+                "different_unknown_key": test_runs_on,
             }
         )

with errors like

                for row in matrix["include"]:
                    # This checks the row schema, not whether values are
                    # truthy. Empty values are allowed when a workflow handles
                    # them explicitly. Undefined values are not: if the
                    # workflow reads `matrix.unknown`, this test fails until
                    # the generator emits that key for every row.
>                   self.assertEqual(matrix_references - set(row), set())
E                   AssertionError: Items in the first set but not the second:
E                   'test_runs_on'

build_tools\github_actions\tests\configure_pytorch_test_matrix_test.py:223: AssertionError

Submission Checklist

Mirror the PyTorch release workflow toggle for JAX so manual multi-arch dev releases can skip JAX wheels by default while workflow_call release runs continue to build them. Add a small JAX release matrix script so JAX can share the top-level python_version narrowing behavior.

Also add focused tests for the JAX matrix script and current PyTorch release matrix behavior.

Testing:

- D:/projects/TheRock/.venv/Scripts/python.exe -m pytest github_actions/tests/configure_jax_release_matrix_test.py github_actions/tests/configure_pytorch_release_matrix_test.py

- pre-commit run --files .github/workflows/multi_arch_release.yml .github/workflows/multi_arch_release_linux.yml .github/workflows/multi_arch_release_linux_jax_wheels.yml build_tools/github_actions/configure_jax_release_matrix.py build_tools/github_actions/configure_pytorch_release_matrix.py build_tools/github_actions/tests/configure_jax_release_matrix_test.py build_tools/github_actions/tests/configure_pytorch_release_matrix_test.py

Assisted-by: Codex
Avoid exhaustively asserting the expanded default matrix. Check that the default matrix spans multiple Python versions and JAX refs, and that explicit Python versions narrow every generated row.

Testing:

- D:/projects/TheRock/.venv/Scripts/python.exe -m pytest github_actions/tests/configure_jax_release_matrix_test.py

- D:/projects/TheRock/.venv/Scripts/python.exe -m pytest github_actions/tests/configure_pytorch_release_matrix_test.py

- pre-commit run --files build_tools/github_actions/tests/configure_jax_release_matrix_test.py

Assisted-by: Codex
Add workflow YAML helpers for extracting matrix references and use them to verify generated matrix rows satisfy the workflow with-block fields that consume them.

Assisted-by: Codex
@ScottTodd ScottTodd added the ci:skip Skip all CI builds/tests for this PR label Jun 30, 2026
@ScottTodd ScottTodd requested a review from geomin12 June 30, 2026 22:07
Base automatically changed from users/scotttodd/optional-jax to main June 30, 2026 23:44
@therock-pr-bot

therock-pr-bot Bot commented Jun 30, 2026

Copy link
Copy Markdown

❌ PR Check — Action Required

Check Status Details
🌿 Branch Name ✅ Pass
📝 PR Title/Description ❌ Fail Error: Title does not follow Conventional Commits style.
Expected: start with a valid type (feat, fix, docs, …).
Desired format: type(optional-scope): short description
Forbidden Files ✅ Pass
🧪 Unit Test ✅ Pass
🔎 pre-commit ✅ Pass
🚫 Draft PR 🔜 To Be Enabled
🚩 Feature Flag 🔜 To Be Enabled
📊 Code Coverage 🔜 To Be Enabled

⚠️ 1 policy check(s) failed. Please address the issues above before this PR can be Reviewed.

🚫 Please fix the failed policies

  • ❌ PR Title/Description

The Not ready to Review label was added to this PR. Once all policies pass, the label is removed automatically.

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

@therock-pr-bot

Copy link
Copy Markdown

🚫 Please fix the failed policies before requesting reviews.

The following policy checks failed:

  • ❌ PR Title/Description

The Not ready to Review label has been added to this PR.
Once all policies pass, the label will be removed automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:skip Skip all CI builds/tests for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant