diff options
Diffstat (limited to 'tests/test_runtime_paths.py')
| -rw-r--r-- | tests/test_runtime_paths.py | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/tests/test_runtime_paths.py b/tests/test_runtime_paths.py index 6afc9228b..97431bd73 100644 --- a/tests/test_runtime_paths.py +++ b/tests/test_runtime_paths.py | |||
| @@ -1,13 +1,13 @@ | |||
| 1 | """The Runtime workflow's path filter still lists every file under tools/ that its jobs read. | 1 | """The Runtime workflow's path-filter scanner and manual-only trigger check. |
| 2 | 2 | ||
| 3 | python -I tests/test_runtime_paths.py | 3 | python -I tests/test_runtime_paths.py |
| 4 | 4 | ||
| 5 | ``.github/workflows/runtime.yml`` starts on the paths it lists, not on everything outside an ignore list | 5 | ``.github/workflows/runtime.yml`` builds the deprecated legacy C++ Vulkan ``runtime/`` (superseded by ``d3d12/`` |
| 6 | (BUILD-856): a change to a tool the runtime build never reads should not queue a Windows, Wine and llvmpipe run. | 6 | and the new Rust Vulkan runtime in progress), so it is now manual-only (``workflow_dispatch``) and excluded from |
| 7 | The price is that the list can fall behind. If ``tools/rdna2spirv.py`` starts importing a new ``tools/foo.py``, | 7 | automatic ``push``, ``pull_request``, and ``schedule`` CI runs. |
| 8 | that pull request still runs Runtime (it touches ``rdna2spirv.py``), but a later one that changes only | 8 | |
| 9 | ``foo.py`` would skip the GPU tests without anyone noticing. This test recomputes what the jobs read and fails | 9 | If automatic ``push`` / ``pull_request`` path filters are ever restored on ``runtime.yml``, ``problems()`` |
| 10 | when an entry is missing: | 10 | recomputes every file under ``tools/`` that its jobs read and fails when an entry is missing: |
| 11 | 11 | ||
| 12 | * the seeds are the code that runs during the jobs: the CMake files under ``runtime/`` and the workflow's | 12 | * the seeds are the code that runs during the jobs: the CMake files under ``runtime/`` and the workflow's |
| 13 | ``jobs:``, with ``#`` comments removed, and the Python under ``runtime/`` plus the scripts the workflow runs. | 13 | ``jobs:``, with ``#`` comments removed, and the Python under ``runtime/`` plus the scripts the workflow runs. |
| @@ -22,10 +22,6 @@ Comments, docstrings and the C++, shader and header sources are not read as depe | |||
| 22 | them says where a table or a test came from, not that the build runs it, and counting those would make every | 22 | them says where a table or a test came from, not that the build runs it, and counting those would make every |
| 23 | such note a required entry. | 23 | such note a required entry. |
| 24 | 24 | ||
| 25 | It also checks that the ``push`` and ``pull_request`` lists are the same, and that no ``tools/`` entry names a | ||
| 26 | file that no longer exists. Listing more than the jobs need is allowed on purpose: an extra run costs one | ||
| 27 | queue slot, a missing entry loses the build for a tool the workflow reads. | ||
| 28 | |||
| 29 | Only tracked sources and the workflow are read; no game files, no build tools, no PyYAML. | 25 | Only tracked sources and the workflow are read; no game files, no build tools, no PyYAML. |
| 30 | """ | 26 | """ |
| 31 | import ast | 27 | import ast |
| @@ -235,9 +231,16 @@ class RepositoryRuntimePathsTest(unittest.TestCase): | |||
| 235 | self.assertIn("tools/rdna2spirv.py", found) | 231 | self.assertIn("tools/rdna2spirv.py", found) |
| 236 | self.assertIn("tools/gen_d3d12_stubs.py", found) | 232 | self.assertIn("tools/gen_d3d12_stubs.py", found) |
| 237 | 233 | ||
| 238 | def test_every_tool_the_jobs_read_triggers_the_workflow(self): | 234 | def test_runtime_workflow_is_manual_dispatch_only(self): |
| 239 | issues = problems(ROOT) | 235 | # Legacy C++ runtime/ is deprecated and excluded from automatic CI runs; manual dispatch stays available. |
| 240 | self.assertFalse(issues, f"{WORKFLOW} path filter:\n" + "\n".join(f" {i}" for i in issues)) | 236 | text = read(ROOT, WORKFLOW) |
| 237 | self.assertRegex(text, r"(?m)^ workflow_dispatch:\s*$") | ||
| 238 | for trigger in ("push", "pull_request", "schedule"): | ||
| 239 | self.assertNotRegex( | ||
| 240 | text, | ||
| 241 | rf"(?m)^ {trigger}:", | ||
| 242 | f"{WORKFLOW} must not run automatically on `{trigger}:` while legacy runtime/ is deprecated", | ||
| 243 | ) | ||
| 241 | 244 | ||
| 242 | 245 | ||
| 243 | class SyntheticTreeTest(unittest.TestCase): | 246 | class SyntheticTreeTest(unittest.TestCase): |