]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-128446: Skip Windows CI for Unix build system changes (GH-128450) (#130435)
authorAdam Turner <9087854+AA-Turner@users.noreply.github.com>
Sat, 22 Feb 2025 01:33:56 +0000 (01:33 +0000)
committerGitHub <noreply@github.com>
Sat, 22 Feb 2025 01:33:56 +0000 (01:33 +0000)
(cherry picked from commit b05fa90b21dd01bb836285cdd41920320b09e681)

Authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
Co-authored-by: Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి) <thatiparthysreenivas@gmail.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
.github/workflows/build.yml
.github/workflows/reusable-context.yml
Tools/build/compute-changes.py

index 3a8da513d2528dae09bef8dbf82a5882b8cd3bdd..31dc16abd3149d5e1ed71ae150cdd50d57e0526e 100644 (file)
@@ -200,7 +200,7 @@ jobs:
       Windows
       ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
     needs: build-context
-    if: fromJSON(needs.build-context.outputs.run-tests)
+    if: fromJSON(needs.build-context.outputs.run-windows-tests)
     strategy:
       matrix:
         arch:
@@ -578,11 +578,17 @@ jobs:
             build_macos,
             build_ubuntu,
             build_ubuntu_ssltests,
-            build_windows,
             build_asan,
             build_tsan,
             test_hypothesis,
             '
             || ''
           }}
+          ${{
+            !fromJSON(needs.build-context.outputs.run-windows-tests)
+            && '
+            build_windows,
+            '
+            || ''
+          }}
         jobs: ${{ toJSON(needs) }}
index fa4df6f29711dbc4f0eec488ebc8f84a7e9f8356..73e036a146f5d420069cb72328a65a08a1122d40 100644 (file)
@@ -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
index 105ba58cc9d94141a8a9f6034377ae659b805a5b..86c447dd4f64e05799465a38cfc873d0a4b99ce4 100644 (file)
@@ -21,11 +21,27 @@ if TYPE_CHECKING:
 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_tests:
+        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")