From 46e9a1b9e6c2aab012d538e714010106601d52b6 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Thu, 6 Feb 2025 15:37:48 +0000 Subject: [PATCH 1/4] Skip Windows CI tests on Unix build system changes --- .github/workflows/build.yml | 2 +- .github/workflows/reusable-context.yml | 4 ++++ Tools/build/compute-changes.py | 25 +++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dc2f4858be6e8c..6fa79b43de5284 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -154,7 +154,7 @@ jobs: Windows ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }} needs: build-context - if: fromJSON(needs.build-context.outputs.run-tests) + if: fromJSON(needs.check_source.outputs.run-windows-tests) strategy: fail-fast: false matrix: diff --git a/.github/workflows/reusable-context.yml b/.github/workflows/reusable-context.yml index fa4df6f29711db..73e036a146f5d4 100644 --- a/.github/workflows/reusable-context.yml +++ b/.github/workflows/reusable-context.yml @@ -26,6 +26,9 @@ on: # yamllint disable-line rule:truthy run-tests: description: Whether to run the regular tests value: ${{ jobs.compute-changes.outputs.run-tests }} # bool + run-windows-tests: + description: Whether to run the Windows tests + value: ${{ jobs.compute-changes.outputs.run-windows-tests }} # bool run-windows-msi: description: Whether to run the MSI installer smoke tests value: ${{ jobs.compute-changes.outputs.run-windows-msi }} # bool @@ -44,6 +47,7 @@ jobs: run-docs: ${{ steps.changes.outputs.run-docs }} run-tests: ${{ steps.changes.outputs.run-tests }} run-windows-msi: ${{ steps.changes.outputs.run-windows-msi }} + run-windows-tests: ${{ steps.changes.outputs.run-windows-tests }} steps: - name: Set up Python uses: actions/setup-python@v5 diff --git a/Tools/build/compute-changes.py b/Tools/build/compute-changes.py index 105ba58cc9d941..5b72b81c79a69c 100644 --- a/Tools/build/compute-changes.py +++ b/Tools/build/compute-changes.py @@ -21,11 +21,27 @@ GITHUB_DEFAULT_BRANCH = os.environ["GITHUB_DEFAULT_BRANCH"] GITHUB_CODEOWNERS_PATH = Path(".github/CODEOWNERS") GITHUB_WORKFLOWS_PATH = Path(".github/workflows") + CONFIGURATION_FILE_NAMES = frozenset({ ".pre-commit-config.yaml", ".ruff.toml", "mypy.ini", }) +UNIX_BUILD_SYSTEM_FILE_NAMES = frozenset({ + Path("aclocal.m4"), + Path("config.guess"), + Path("config.sub"), + Path("configure"), + Path("configure.ac"), + Path("install-sh"), + Path("Makefile.pre.in"), + Path("Modules/makesetup"), + Path("Modules/Setup"), + Path("Modules/Setup.bootstrap.in"), + Path("Modules/Setup.stdlib.in"), + Path("Tools/build/regen-configure.sh"), +}) + SUFFIXES_C_OR_CPP = frozenset({".c", ".h", ".cpp"}) SUFFIXES_DOCUMENTATION = frozenset({".rst", ".md"}) @@ -36,6 +52,7 @@ class Outputs: run_docs: bool = False run_tests: bool = False run_windows_msi: bool = False + run_windows_tests: bool = False def compute_changes() -> None: @@ -53,6 +70,8 @@ def compute_changes() -> None: if outputs.run_tests: print("Run tests") + if outputs.run_windows: + print("Run Windows tests") if outputs.run_ci_fuzz: print("Run CIFuzz tests") @@ -98,6 +117,7 @@ def process_changed_files(changed_files: Set[Path]) -> Outputs: run_tests = False run_ci_fuzz = False run_docs = False + run_windows_tests = False run_windows_msi = False for file in changed_files: @@ -120,6 +140,9 @@ def process_changed_files(changed_files: Set[Path]) -> Outputs: ): run_tests = True + if file not in UNIX_BUILD_SYSTEM_FILE_NAMES: + run_windows_tests = True + # The fuzz tests are pretty slow so they are executed only for PRs # changing relevant files. if file.suffix in SUFFIXES_C_OR_CPP: @@ -142,6 +165,7 @@ def process_changed_files(changed_files: Set[Path]) -> Outputs: run_ci_fuzz=run_ci_fuzz, run_docs=run_docs, run_tests=run_tests, + run_windows_tests=run_windows_tests, run_windows_msi=run_windows_msi, ) @@ -172,6 +196,7 @@ def write_github_output(outputs: Outputs) -> None: f.write(f"run-ci-fuzz={bool_lower(outputs.run_ci_fuzz)}\n") f.write(f"run-docs={bool_lower(outputs.run_docs)}\n") f.write(f"run-tests={bool_lower(outputs.run_tests)}\n") + f.write(f"run-windows-tests={bool_lower(outputs.run_windows_tests)}\n") f.write(f"run-windows-msi={bool_lower(outputs.run_windows_msi)}\n") From 04455c45a5a006ce11cd1aaef88086a123f7b7dc Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Thu, 6 Feb 2025 15:40:10 +0000 Subject: [PATCH 2/4] fixup! Skip Windows CI tests on Unix build system changes --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6fa79b43de5284..a5d4834f1b63a8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -154,7 +154,7 @@ jobs: Windows ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }} needs: build-context - if: fromJSON(needs.check_source.outputs.run-windows-tests) + if: fromJSON(needs.build-context.outputs.run-windows-tests) strategy: fail-fast: false matrix: From 865d3b44c257192fd19d867e40ac4a536fbc6986 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Thu, 6 Feb 2025 15:41:45 +0000 Subject: [PATCH 3/4] fixup! Skip Windows CI tests on Unix build system changes --- Tools/build/compute-changes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/build/compute-changes.py b/Tools/build/compute-changes.py index 5b72b81c79a69c..86c447dd4f64e0 100644 --- a/Tools/build/compute-changes.py +++ b/Tools/build/compute-changes.py @@ -70,7 +70,7 @@ def compute_changes() -> None: if outputs.run_tests: print("Run tests") - if outputs.run_windows: + if outputs.run_windows_tests: print("Run Windows tests") if outputs.run_ci_fuzz: From c9e6cc975029f20ff3f07d5262a334bf617dc319 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Thu, 6 Feb 2025 15:54:06 +0000 Subject: [PATCH 4/4] Split build_windows from alls-green allowed-skips --- .github/workflows/build.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a5d4834f1b63a8..f9d5fb6e77f011 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -654,13 +654,19 @@ jobs: build_ubuntu, build_ubuntu_ssltests, build_wasi, - build_windows, build_asan, build_tsan, test_hypothesis, ' || '' }} + ${{ + !fromJSON(needs.build-context.outputs.run-windows-tests) + && ' + build_windows, + ' + || '' + }} ${{ !fromJSON(needs.build-context.outputs.run-ci-fuzz) && '