From 5767f88cb416c9f3fcb0fecaf1658b542f48b31a Mon Sep 17 00:00:00 2001 From: eric8810 Date: Mon, 27 Jul 2026 16:37:49 +0800 Subject: [PATCH] =?UTF-8?q?fix(ci):=20=E9=94=81=E5=8D=B7=E5=BD=92=E4=BD=8D?= =?UTF-8?q?=EF=BC=8C=E5=8F=8C=E6=B5=81=E5=A4=8D=E6=98=8E=20=C2=B7=20restor?= =?UTF-8?q?e=20model=20metadata=20gates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/core.yml | 1 + .github/workflows/webgpu-native.yml | 3 +- tests/python/test_ci_workflow_contracts.py | 39 ++++++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 tests/python/test_ci_workflow_contracts.py diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index 929270a..797fa87 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -86,6 +86,7 @@ jobs: run: | python tools/bootstrap_dependencies.py --cache-dir .cache/dependencies python tools/bootstrap_models.py --cache-dir .cache/models + python tools/package_model_bundle.py - name: Configure without dependency network access (Unix) if: runner.os != 'Windows' shell: bash diff --git a/.github/workflows/webgpu-native.yml b/.github/workflows/webgpu-native.yml index 3ee235e..d1cdb57 100644 --- a/.github/workflows/webgpu-native.yml +++ b/.github/workflows/webgpu-native.yml @@ -220,7 +220,8 @@ jobs: --build-dir build-webgpu \ --configuration Release \ --platform-id "${{ matrix.id }}" \ - --output-dir "reports/webgpu/${{ matrix.id }}" + --output-dir "reports/webgpu/${{ matrix.id }}" \ + --model-free qualification_args=() if [[ "$WEBGPU_QUALIFICATION_BUILD" == "ON" ]]; then qualification_args+=(--qualification-build) diff --git a/tests/python/test_ci_workflow_contracts.py b/tests/python/test_ci_workflow_contracts.py new file mode 100644 index 0000000..81fcaf9 --- /dev/null +++ b/tests/python/test_ci_workflow_contracts.py @@ -0,0 +1,39 @@ +from __future__ import annotations + +from pathlib import Path +import unittest + + +ROOT = Path(__file__).resolve().parents[2] + + +def workflow_step(source: str, name: str) -> str: + marker = f" - name: {name}\n" + start = source.index(marker) + end = source.find("\n - ", start + len(marker)) + return source[start:] if end == -1 else source[start:end] + + +class CiWorkflowContractTests(unittest.TestCase): + def test_core_packages_the_locked_model_before_model_bound_metadata(self) -> None: + source = (ROOT / ".github/workflows/core.yml").read_text("utf-8") + bootstrap = workflow_step(source, "Bootstrap locked dependencies and models") + metadata = workflow_step( + source, "Generate build manifest, licenses, and SPDX SBOM" + ) + + self.assertIn("python tools/package_model_bundle.py", bootstrap) + self.assertNotIn("--model-free", metadata) + + def test_webgpu_native_metadata_is_model_free(self) -> None: + source = (ROOT / ".github/workflows/webgpu-native.yml").read_text("utf-8") + metadata = workflow_step( + source, "Generate license, SBOM, and native package input" + ) + + self.assertIn("python tools/generate_release_metadata.py", metadata) + self.assertIn("--model-free", metadata) + + +if __name__ == "__main__": + unittest.main()