mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
github_runner_matrix: decouple macOS versions from MacOSVersion#supported_release?
See discussion at #18296.
This commit is contained in:
parent
d20fdada4a
commit
d0d1d451ae
@ -77,8 +77,10 @@ class GitHubRunnerMatrix
|
|||||||
private
|
private
|
||||||
|
|
||||||
SELF_HOSTED_LINUX_RUNNER = "linux-self-hosted-1"
|
SELF_HOSTED_LINUX_RUNNER = "linux-self-hosted-1"
|
||||||
GITHUB_ACTIONS_LONG_TIMEOUT = 4320
|
# ARM macOS timeout, keep this under 1/2 of GitHub's job execution time limit for self-hosted runners.
|
||||||
GITHUB_ACTIONS_SHORT_TIMEOUT = 120
|
# https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners#usage-limits
|
||||||
|
GITHUB_ACTIONS_LONG_TIMEOUT = 2160 # 36 hours
|
||||||
|
GITHUB_ACTIONS_SHORT_TIMEOUT = 60
|
||||||
|
|
||||||
sig { returns(LinuxRunnerSpec) }
|
sig { returns(LinuxRunnerSpec) }
|
||||||
def linux_runner_spec
|
def linux_runner_spec
|
||||||
@ -118,6 +120,15 @@ class GitHubRunnerMatrix
|
|||||||
runner.freeze
|
runner.freeze
|
||||||
end
|
end
|
||||||
|
|
||||||
|
NEWEST_HOMEBREW_CORE_MACOS_RUNNER = :sonoma
|
||||||
|
OLDEST_HOMEBREW_CORE_MACOS_RUNNER = :monterey
|
||||||
|
NEWEST_HOMEBREW_CORE_INTEL_MACOS_RUNNER = :sonoma
|
||||||
|
|
||||||
|
sig { params(macos_version: MacOSVersion).returns(T::Boolean) }
|
||||||
|
def runner_enabled?(macos_version)
|
||||||
|
macos_version <= NEWEST_HOMEBREW_CORE_MACOS_RUNNER && macos_version >= OLDEST_HOMEBREW_CORE_MACOS_RUNNER
|
||||||
|
end
|
||||||
|
|
||||||
NEWEST_GITHUB_ACTIONS_INTEL_MACOS_RUNNER = :ventura
|
NEWEST_GITHUB_ACTIONS_INTEL_MACOS_RUNNER = :ventura
|
||||||
OLDEST_GITHUB_ACTIONS_INTEL_MACOS_RUNNER = :big_sur
|
OLDEST_GITHUB_ACTIONS_INTEL_MACOS_RUNNER = :big_sur
|
||||||
NEWEST_GITHUB_ACTIONS_ARM_MACOS_RUNNER = :sonoma
|
NEWEST_GITHUB_ACTIONS_ARM_MACOS_RUNNER = :sonoma
|
||||||
@ -149,28 +160,7 @@ class GitHubRunnerMatrix
|
|||||||
|
|
||||||
MacOSVersion::SYMBOLS.each_value do |version|
|
MacOSVersion::SYMBOLS.each_value do |version|
|
||||||
macos_version = MacOSVersion.new(version)
|
macos_version = MacOSVersion.new(version)
|
||||||
next if macos_version.unsupported_release?
|
next unless runner_enabled?(macos_version)
|
||||||
|
|
||||||
github_runner_available = macos_version <= NEWEST_GITHUB_ACTIONS_INTEL_MACOS_RUNNER &&
|
|
||||||
macos_version >= OLDEST_GITHUB_ACTIONS_INTEL_MACOS_RUNNER
|
|
||||||
|
|
||||||
runner, timeout = if use_github_runner && github_runner_available
|
|
||||||
["macos-#{version}", GITHUB_ACTIONS_RUNNER_TIMEOUT]
|
|
||||||
else
|
|
||||||
["#{version}-x86_64#{ephemeral_suffix}", runner_timeout]
|
|
||||||
end
|
|
||||||
|
|
||||||
# macOS 12-x86_64 is usually slower.
|
|
||||||
timeout += 30 if macos_version <= :monterey
|
|
||||||
spec = MacOSRunnerSpec.new(
|
|
||||||
name: "macOS #{version}-x86_64",
|
|
||||||
runner:,
|
|
||||||
timeout:,
|
|
||||||
cleanup: !runner.end_with?(ephemeral_suffix),
|
|
||||||
)
|
|
||||||
@runners << create_runner(:macos, :x86_64, spec, macos_version)
|
|
||||||
|
|
||||||
next if macos_version < :big_sur
|
|
||||||
|
|
||||||
github_runner_available = macos_version <= NEWEST_GITHUB_ACTIONS_ARM_MACOS_RUNNER &&
|
github_runner_available = macos_version <= NEWEST_GITHUB_ACTIONS_ARM_MACOS_RUNNER &&
|
||||||
macos_version >= OLDEST_GITHUB_ACTIONS_ARM_MACOS_RUNNER
|
macos_version >= OLDEST_GITHUB_ACTIONS_ARM_MACOS_RUNNER
|
||||||
@ -183,8 +173,6 @@ class GitHubRunnerMatrix
|
|||||||
["#{version}-arm64", runner_timeout]
|
["#{version}-arm64", runner_timeout]
|
||||||
end
|
end
|
||||||
|
|
||||||
# The ARM runners are typically over twice as fast as the Intel runners.
|
|
||||||
timeout /= 2 if !(use_github_runner && github_runner_available) && timeout < GITHUB_ACTIONS_LONG_TIMEOUT
|
|
||||||
spec = MacOSRunnerSpec.new(
|
spec = MacOSRunnerSpec.new(
|
||||||
name: "macOS #{version}-arm64",
|
name: "macOS #{version}-arm64",
|
||||||
runner:,
|
runner:,
|
||||||
@ -192,6 +180,29 @@ class GitHubRunnerMatrix
|
|||||||
cleanup: !runner.end_with?(ephemeral_suffix),
|
cleanup: !runner.end_with?(ephemeral_suffix),
|
||||||
)
|
)
|
||||||
@runners << create_runner(:macos, :arm64, spec, macos_version)
|
@runners << create_runner(:macos, :arm64, spec, macos_version)
|
||||||
|
|
||||||
|
next if macos_version > NEWEST_HOMEBREW_CORE_INTEL_MACOS_RUNNER
|
||||||
|
|
||||||
|
github_runner_available = macos_version <= NEWEST_GITHUB_ACTIONS_INTEL_MACOS_RUNNER &&
|
||||||
|
macos_version >= OLDEST_GITHUB_ACTIONS_INTEL_MACOS_RUNNER
|
||||||
|
|
||||||
|
runner, timeout = if use_github_runner && github_runner_available
|
||||||
|
["macos-#{version}", GITHUB_ACTIONS_RUNNER_TIMEOUT]
|
||||||
|
else
|
||||||
|
["#{version}-x86_64#{ephemeral_suffix}", runner_timeout]
|
||||||
|
end
|
||||||
|
|
||||||
|
# macOS 12-x86_64 is usually slower.
|
||||||
|
timeout += 30 if macos_version <= :monterey
|
||||||
|
# The ARM runners are typically over twice as fast as the Intel runners.
|
||||||
|
timeout *= 2 if !(use_github_runner && github_runner_available) && timeout < GITHUB_ACTIONS_LONG_TIMEOUT
|
||||||
|
spec = MacOSRunnerSpec.new(
|
||||||
|
name: "macOS #{version}-x86_64",
|
||||||
|
runner:,
|
||||||
|
timeout:,
|
||||||
|
cleanup: !runner.end_with?(ephemeral_suffix),
|
||||||
|
)
|
||||||
|
@runners << create_runner(:macos, :x86_64, spec, macos_version)
|
||||||
end
|
end
|
||||||
|
|
||||||
@runners.freeze
|
@runners.freeze
|
||||||
|
Loading…
x
Reference in New Issue
Block a user