Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Hugo's review
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
  • Loading branch information
StanFromIreland and hugovk committed Dec 7, 2025
commit 3133d2c5e6c451a0baca66883ff7a45b03efd620
56 changes: 7 additions & 49 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -712,13 +712,7 @@ jobs:
test-hypothesis,
cifuzz,
allowed-skips: >-
${{
!fromJSON(needs.build-context.outputs.run-docs)
&& '
check-docs,
'
|| ''
}}
${{ !fromJSON(needs.build-context.outputs.run-docs) && 'check-docs,' || '' }}
${{
needs.build-context.outputs.run-tests != 'true'
&& '
Expand All @@ -727,27 +721,9 @@ jobs:
'
|| ''
}}
${{
!fromJSON(needs.build-context.outputs.run-windows-tests)
&& '
build-windows,
'
|| ''
}}
${{
!fromJSON(needs.build-context.outputs.run-ci-fuzz)
&& '
cifuzz,
'
|| ''
}}
${{
!fromJSON(needs.build-context.outputs.run-macos)
&& '
build-macos,
'
|| ''
}}
${{ !fromJSON(needs.build-context.outputs.run-windows-tests) && 'build-windows,' || '' }}
${{ !fromJSON(needs.build-context.outputs.run-ci-fuzz) && 'cifuzz,' || '' }}
${{ !fromJSON(needs.build-context.outputs.run-macos) && 'build-macos,' || '' }}
${{
!fromJSON(needs.build-context.outputs.run-ubuntu)
&& '
Expand All @@ -761,25 +737,7 @@ jobs:
'
|| ''
}}
${{
!fromJSON(needs.build-context.outputs.run-android)
&& '
build-android,
'
|| ''
}}
${{
!fromJSON(needs.build-context.outputs.run-ios)
&& '
build-ios,
'
|| ''
}}
${{
!fromJSON(needs.build-context.outputs.run-wasi)
&& '
build-wasi,
'
|| ''
}}
${{ !fromJSON(needs.build-context.outputs.run-android) && 'build-android,' || '' }}
${{ !fromJSON(needs.build-context.outputs.run-ios) && 'build-ios,' || '' }}
${{ !fromJSON(needs.build-context.outputs.run-wasi) && 'build-wasi,' || '' }}
jobs: ${{ toJSON(needs) }}
46 changes: 23 additions & 23 deletions .github/workflows/reusable-context.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,53 +17,53 @@ on: # yamllint disable-line rule:truthy
# || 'falsy-branch'
# }}
#
run-docs:
description: Whether to build the docs
value: ${{ jobs.compute-changes.outputs.run-docs }} # bool
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
run-android:
description: Whether to run the Android tests
value: ${{ jobs.compute-changes.outputs.run-android }} # bool
run-ci-fuzz:
description: Whether to run the CIFuzz job
value: ${{ jobs.compute-changes.outputs.run-ci-fuzz }} # bool
run-docs:
description: Whether to build the docs
value: ${{ jobs.compute-changes.outputs.run-docs }} # bool
run-ios:
description: Whether to run the iOS tests
value: ${{ jobs.compute-changes.outputs.run-ios }} # bool
run-macos:
description: Whether to run the macOS tests
value: ${{ jobs.compute-changes.outputs.run-macos }} # bool
run-tests:
description: Whether to run the regular tests
value: ${{ jobs.compute-changes.outputs.run-tests }} # bool
run-ubuntu:
description: Whether to run the Ubuntu tests
value: ${{ jobs.compute-changes.outputs.run-ubuntu }} # bool
run-android:
description: Whether to run the Android tests
value: ${{ jobs.compute-changes.outputs.run-android }} # bool
run-ios:
description: Whether to run the iOS tests
value: ${{ jobs.compute-changes.outputs.run-ios }} # bool
run-wasi:
description: Whether to run the WASI tests
value: ${{ jobs.compute-changes.outputs.run-wasi }} # bool
Comment thread
StanFromIreland marked this conversation as resolved.
run-windows-msi:
description: Whether to run the MSI installer smoke tests
value: ${{ jobs.compute-changes.outputs.run-windows-msi }} # bool
run-windows-tests:
description: Whether to run the Windows tests
value: ${{ jobs.compute-changes.outputs.run-windows-tests }} # bool

jobs:
compute-changes:
name: Create context from changed files
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
run-android: ${{ steps.changes.outputs.run-android }}
run-ci-fuzz: ${{ steps.changes.outputs.run-ci-fuzz }}
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 }}
run-ios: ${{ steps.changes.outputs.run-ios }}
run-macos: ${{ steps.changes.outputs.run-macos }}
run-tests: ${{ steps.changes.outputs.run-tests }}
run-ubuntu: ${{ steps.changes.outputs.run-ubuntu }}
run-android: ${{ steps.changes.outputs.run-android }}
run-ios: ${{ steps.changes.outputs.run-ios }}
run-wasi: ${{ steps.changes.outputs.run-wasi }}
Comment thread
StanFromIreland marked this conversation as resolved.
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
Expand Down
55 changes: 28 additions & 27 deletions Tools/build/compute-changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,24 @@
SUFFIXES_C_OR_CPP = frozenset({".c", ".h", ".cpp"})
SUFFIXES_DOCUMENTATION = frozenset({".rst", ".md"})

MACOS_DIRS = frozenset({"Mac"})
IOS_DIRS = frozenset({"Apple", "iOS"})
ANDROID_DIRS = frozenset({"Android"})
IOS_DIRS = frozenset({"Apple", "iOS"})
MACOS_DIRS = frozenset({"Mac"})
WASI_DIRS = frozenset({Path("Tools", "wasm")})
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is technically too broad as it includes Emscripten (since 3,14), but I don't think it's worth changing until the Platforms/ move happens.



@dataclass(kw_only=True, slots=True)
class Outputs:
run_android: bool = False
run_ci_fuzz: bool = False
run_docs: bool = False
run_tests: bool = False
run_windows_msi: bool = False
run_windows_tests: bool = False
run_ios: bool = False
run_macos: bool = False
run_tests: bool = False
run_ubuntu: bool = False
run_android: bool = False
run_ios: bool = False
run_wasi: bool = False
Comment thread
StanFromIreland marked this conversation as resolved.
run_windows_msi: bool = False
run_windows_tests: bool = False


def compute_changes() -> None:
Expand All @@ -74,13 +74,13 @@ def compute_changes() -> None:
else:
# Otherwise, just run the tests
outputs = Outputs(
run_tests=True,
run_windows_tests=True,
run_macos=True,
run_ubuntu=True,
run_android=True,
run_ios=True,
run_macos=True,
run_tests=True,
run_ubuntu=True,
run_wasi=True,
run_windows_tests=True,
)
outputs = process_target_branch(outputs, target_branch)

Expand Down Expand Up @@ -129,7 +129,7 @@ def get_changed_files(
return frozenset(map(Path, filter(None, map(str.strip, changed_files))))


def is_platform_specific(file: Path) -> str | None:
def get_file_platform(file: Path) -> str | None:
if not file.parts:
return None
first_part = file.parts[0]
Expand All @@ -152,7 +152,7 @@ def process_changed_files(changed_files: Set[Path]) -> Outputs:
run_windows_msi = False

platforms_changed = set()
has_non_plat_specific_change = False
has_platform_specific_change = True

for file in changed_files:
# Documentation files
Expand All @@ -161,7 +161,8 @@ def process_changed_files(changed_files: Set[Path]) -> Outputs:

if file.parent == GITHUB_WORKFLOWS_PATH:
if file.name == "build.yml":
run_tests = run_ci_fuzz = has_non_plat_specific_change = True
run_tests = run_ci_fuzz = True
has_platform_specific_change = False
if file.name == "reusable-docs.yml":
run_docs = True
if file.name == "reusable-windows-msi.yml":
Expand All @@ -178,11 +179,11 @@ def process_changed_files(changed_files: Set[Path]) -> Outputs:
):
run_tests = True

platform = is_platform_specific(file)
platform = get_file_platform(file)
if platform is not None:
platforms_changed.add(platform)
else:
has_non_plat_specific_change = True
has_platform_specific_change = False
if file not in UNIX_BUILD_SYSTEM_FILE_NAMES:
run_windows_tests = True

Expand All @@ -206,7 +207,7 @@ def process_changed_files(changed_files: Set[Path]) -> Outputs:

# Check which platform specific tests to run
if run_tests:
if has_non_plat_specific_change or not platforms_changed:
if not has_platform_specific_change or not platforms_changed:
run_macos = True
run_ubuntu = True
run_android = True
Expand All @@ -226,16 +227,16 @@ def process_changed_files(changed_files: Set[Path]) -> Outputs:
run_wasi = False

return Outputs(
run_android=run_android,
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,
run_ios=run_ios,
run_macos=run_macos,
run_tests=run_tests,
run_ubuntu=run_ubuntu,
run_android=run_android,
run_ios=run_ios,
run_wasi=run_wasi,
run_windows_msi=run_windows_msi,
run_windows_tests=run_windows_tests,
)


Expand All @@ -262,16 +263,16 @@ def write_github_output(outputs: Outputs) -> None:
return

with open(os.environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as f:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the naming being so consistent, this could be simplified with a for loop with https://docs.python.org/3/library/dataclasses.html#dataclasses.fields .

f.write(f"run-android={bool_lower(outputs.run_android)}\n")
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")
f.write(f"run-ios={bool_lower(outputs.run_ios)}\n")
f.write(f"run-macos={bool_lower(outputs.run_macos)}\n")
f.write(f"run-tests={bool_lower(outputs.run_tests)}\n")
f.write(f"run-ubuntu={bool_lower(outputs.run_ubuntu)}\n")
f.write(f"run-android={bool_lower(outputs.run_android)}\n")
f.write(f"run-ios={bool_lower(outputs.run_ios)}\n")
f.write(f"run-wasi={bool_lower(outputs.run_wasi)}\n")
f.write(f"run-windows-msi={bool_lower(outputs.run_windows_msi)}\n")
f.write(f"run-windows-tests={bool_lower(outputs.run_windows_tests)}\n")


def bool_lower(value: bool, /) -> str:
Expand Down
Loading