Skip to content

Commit b05fa90

Browse files
gh-128446: Skip Windows CI for Unix build system changes (#128450)
Co-authored-by: Adam Turner <[email protected]> Authored-by: Adam Turner <[email protected]>
1 parent 06ac157 commit b05fa90

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

.github/workflows/build.yml

+8-2
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ jobs:
154154
Windows
155155
${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
156156
needs: build-context
157-
if: fromJSON(needs.build-context.outputs.run-tests)
157+
if: fromJSON(needs.build-context.outputs.run-windows-tests)
158158
strategy:
159159
fail-fast: false
160160
matrix:
@@ -654,13 +654,19 @@ jobs:
654654
build_ubuntu,
655655
build_ubuntu_ssltests,
656656
build_wasi,
657-
build_windows,
658657
build_asan,
659658
build_tsan,
660659
test_hypothesis,
661660
'
662661
|| ''
663662
}}
663+
${{
664+
!fromJSON(needs.build-context.outputs.run-windows-tests)
665+
&& '
666+
build_windows,
667+
'
668+
|| ''
669+
}}
664670
${{
665671
!fromJSON(needs.build-context.outputs.run-ci-fuzz)
666672
&& '

.github/workflows/reusable-context.yml

+4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ on: # yamllint disable-line rule:truthy
2626
run-tests:
2727
description: Whether to run the regular tests
2828
value: ${{ jobs.compute-changes.outputs.run-tests }} # bool
29+
run-windows-tests:
30+
description: Whether to run the Windows tests
31+
value: ${{ jobs.compute-changes.outputs.run-windows-tests }} # bool
2932
run-windows-msi:
3033
description: Whether to run the MSI installer smoke tests
3134
value: ${{ jobs.compute-changes.outputs.run-windows-msi }} # bool
@@ -44,6 +47,7 @@ jobs:
4447
run-docs: ${{ steps.changes.outputs.run-docs }}
4548
run-tests: ${{ steps.changes.outputs.run-tests }}
4649
run-windows-msi: ${{ steps.changes.outputs.run-windows-msi }}
50+
run-windows-tests: ${{ steps.changes.outputs.run-windows-tests }}
4751
steps:
4852
- name: Set up Python
4953
uses: actions/setup-python@v5

Tools/build/compute-changes.py

+25
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,27 @@
2121
GITHUB_DEFAULT_BRANCH = os.environ["GITHUB_DEFAULT_BRANCH"]
2222
GITHUB_CODEOWNERS_PATH = Path(".github/CODEOWNERS")
2323
GITHUB_WORKFLOWS_PATH = Path(".github/workflows")
24+
2425
CONFIGURATION_FILE_NAMES = frozenset({
2526
".pre-commit-config.yaml",
2627
".ruff.toml",
2728
"mypy.ini",
2829
})
30+
UNIX_BUILD_SYSTEM_FILE_NAMES = frozenset({
31+
Path("aclocal.m4"),
32+
Path("config.guess"),
33+
Path("config.sub"),
34+
Path("configure"),
35+
Path("configure.ac"),
36+
Path("install-sh"),
37+
Path("Makefile.pre.in"),
38+
Path("Modules/makesetup"),
39+
Path("Modules/Setup"),
40+
Path("Modules/Setup.bootstrap.in"),
41+
Path("Modules/Setup.stdlib.in"),
42+
Path("Tools/build/regen-configure.sh"),
43+
})
44+
2945
SUFFIXES_C_OR_CPP = frozenset({".c", ".h", ".cpp"})
3046
SUFFIXES_DOCUMENTATION = frozenset({".rst", ".md"})
3147

@@ -36,6 +52,7 @@ class Outputs:
3652
run_docs: bool = False
3753
run_tests: bool = False
3854
run_windows_msi: bool = False
55+
run_windows_tests: bool = False
3956

4057

4158
def compute_changes() -> None:
@@ -53,6 +70,8 @@ def compute_changes() -> None:
5370

5471
if outputs.run_tests:
5572
print("Run tests")
73+
if outputs.run_windows_tests:
74+
print("Run Windows tests")
5675

5776
if outputs.run_ci_fuzz:
5877
print("Run CIFuzz tests")
@@ -98,6 +117,7 @@ def process_changed_files(changed_files: Set[Path]) -> Outputs:
98117
run_tests = False
99118
run_ci_fuzz = False
100119
run_docs = False
120+
run_windows_tests = False
101121
run_windows_msi = False
102122

103123
for file in changed_files:
@@ -120,6 +140,9 @@ def process_changed_files(changed_files: Set[Path]) -> Outputs:
120140
):
121141
run_tests = True
122142

143+
if file not in UNIX_BUILD_SYSTEM_FILE_NAMES:
144+
run_windows_tests = True
145+
123146
# The fuzz tests are pretty slow so they are executed only for PRs
124147
# changing relevant files.
125148
if file.suffix in SUFFIXES_C_OR_CPP:
@@ -142,6 +165,7 @@ def process_changed_files(changed_files: Set[Path]) -> Outputs:
142165
run_ci_fuzz=run_ci_fuzz,
143166
run_docs=run_docs,
144167
run_tests=run_tests,
168+
run_windows_tests=run_windows_tests,
145169
run_windows_msi=run_windows_msi,
146170
)
147171

@@ -172,6 +196,7 @@ def write_github_output(outputs: Outputs) -> None:
172196
f.write(f"run-ci-fuzz={bool_lower(outputs.run_ci_fuzz)}\n")
173197
f.write(f"run-docs={bool_lower(outputs.run_docs)}\n")
174198
f.write(f"run-tests={bool_lower(outputs.run_tests)}\n")
199+
f.write(f"run-windows-tests={bool_lower(outputs.run_windows_tests)}\n")
175200
f.write(f"run-windows-msi={bool_lower(outputs.run_windows_msi)}\n")
176201

177202

0 commit comments

Comments
 (0)