mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
github_runner_matrix: support GitHub-hosted M1 macOS runners
Also, we don't build for Big Sur anymore, so remove the special case for Big Sur timeouts here.
This commit is contained in:
parent
0476c2e5e4
commit
d9cd55eca9
@ -105,8 +105,10 @@ class GitHubRunnerMatrix
|
|||||||
runner.freeze
|
runner.freeze
|
||||||
end
|
end
|
||||||
|
|
||||||
NEWEST_GITHUB_ACTIONS_MACOS_RUNNER = :ventura
|
NEWEST_GITHUB_ACTIONS_INTEL_MACOS_RUNNER = :ventura
|
||||||
OLDEST_GITHUB_ACTIONS_MACOS_RUNNER = :big_sur
|
OLDEST_GITHUB_ACTIONS_INTEL_MACOS_RUNNER = :big_sur
|
||||||
|
NEWEST_GITHUB_ACTIONS_ARM_MACOS_RUNNER = :sonoma
|
||||||
|
OLDEST_GITHUB_ACTIONS_ARM_MACOS_RUNNER = :sonoma
|
||||||
GITHUB_ACTIONS_RUNNER_TIMEOUT = 360
|
GITHUB_ACTIONS_RUNNER_TIMEOUT = 360
|
||||||
|
|
||||||
sig { void }
|
sig { void }
|
||||||
@ -118,9 +120,13 @@ class GitHubRunnerMatrix
|
|||||||
end
|
end
|
||||||
|
|
||||||
github_run_id = ENV.fetch("GITHUB_RUN_ID")
|
github_run_id = ENV.fetch("GITHUB_RUN_ID")
|
||||||
timeout = ENV.fetch("HOMEBREW_MACOS_TIMEOUT").to_i
|
runner_timeout = ENV.fetch("HOMEBREW_MACOS_TIMEOUT").to_i
|
||||||
use_github_runner = ENV.fetch("HOMEBREW_MACOS_BUILD_ON_GITHUB_RUNNER", "false") == "true"
|
use_github_runner = ENV.fetch("HOMEBREW_MACOS_BUILD_ON_GITHUB_RUNNER", "false") == "true"
|
||||||
|
|
||||||
|
# Use GitHub Actions macOS Runner for testing dependents if compatible with timeout.
|
||||||
|
use_github_runner ||= @dependent_matrix
|
||||||
|
use_github_runner &&= runner_timeout <= GITHUB_ACTIONS_RUNNER_TIMEOUT
|
||||||
|
|
||||||
ephemeral_suffix = +"-#{github_run_id}"
|
ephemeral_suffix = +"-#{github_run_id}"
|
||||||
ephemeral_suffix << "-deps" if @dependent_matrix
|
ephemeral_suffix << "-deps" if @dependent_matrix
|
||||||
ephemeral_suffix.freeze
|
ephemeral_suffix.freeze
|
||||||
@ -129,17 +135,10 @@ class GitHubRunnerMatrix
|
|||||||
macos_version = MacOSVersion.new(version)
|
macos_version = MacOSVersion.new(version)
|
||||||
next if macos_version.unsupported_release?
|
next if macos_version.unsupported_release?
|
||||||
|
|
||||||
# Intel Big Sur is a bit slower than the other runners,
|
github_runner_available = macos_version <= NEWEST_GITHUB_ACTIONS_INTEL_MACOS_RUNNER &&
|
||||||
# so give it a little bit more time. The comparison below
|
macos_version >= OLDEST_GITHUB_ACTIONS_INTEL_MACOS_RUNNER
|
||||||
# should be `==`, but it returns typecheck errors.
|
|
||||||
runner_timeout = timeout
|
|
||||||
runner_timeout += 30 if macos_version <= :big_sur
|
|
||||||
|
|
||||||
# Use GitHub Actions macOS Runner for testing dependents if compatible with timeout.
|
runner, timeout = if use_github_runner && github_runner_available
|
||||||
runner, runner_timeout = if (@dependent_matrix || use_github_runner) &&
|
|
||||||
macos_version <= NEWEST_GITHUB_ACTIONS_MACOS_RUNNER &&
|
|
||||||
macos_version >= OLDEST_GITHUB_ACTIONS_MACOS_RUNNER &&
|
|
||||||
runner_timeout <= GITHUB_ACTIONS_RUNNER_TIMEOUT
|
|
||||||
["macos-#{version}", GITHUB_ACTIONS_RUNNER_TIMEOUT]
|
["macos-#{version}", GITHUB_ACTIONS_RUNNER_TIMEOUT]
|
||||||
else
|
else
|
||||||
["#{version}#{ephemeral_suffix}", runner_timeout]
|
["#{version}#{ephemeral_suffix}", runner_timeout]
|
||||||
@ -148,27 +147,30 @@ class GitHubRunnerMatrix
|
|||||||
spec = MacOSRunnerSpec.new(
|
spec = MacOSRunnerSpec.new(
|
||||||
name: "macOS #{version}-x86_64",
|
name: "macOS #{version}-x86_64",
|
||||||
runner:,
|
runner:,
|
||||||
timeout: runner_timeout,
|
timeout:,
|
||||||
cleanup: !runner.end_with?(ephemeral_suffix),
|
cleanup: !runner.end_with?(ephemeral_suffix),
|
||||||
)
|
)
|
||||||
@runners << create_runner(:macos, :x86_64, spec, macos_version)
|
@runners << create_runner(:macos, :x86_64, spec, macos_version)
|
||||||
|
|
||||||
next if macos_version < :big_sur
|
next if macos_version < :big_sur
|
||||||
|
|
||||||
runner = +"#{version}-arm64"
|
github_runner_available = macos_version <= NEWEST_GITHUB_ACTIONS_ARM_MACOS_RUNNER &&
|
||||||
runner_timeout = timeout
|
macos_version >= OLDEST_GITHUB_ACTIONS_ARM_MACOS_RUNNER
|
||||||
|
|
||||||
use_ephemeral = macos_version >= :monterey
|
runner, timeout = if use_github_runner && github_runner_available
|
||||||
runner << ephemeral_suffix if use_ephemeral
|
["macos-#{version}", GITHUB_ACTIONS_RUNNER_TIMEOUT]
|
||||||
|
elsif macos_version >= :monterey
|
||||||
runner.freeze
|
["#{version}-arm64#{ephemeral_suffix}", runner_timeout]
|
||||||
|
else
|
||||||
|
["#{version}-arm64", runner_timeout]
|
||||||
|
end
|
||||||
|
|
||||||
# The ARM runners are typically over twice as fast as the Intel runners.
|
# The ARM runners are typically over twice as fast as the Intel runners.
|
||||||
runner_timeout /= 2 if runner_timeout < GITHUB_ACTIONS_LONG_TIMEOUT
|
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:,
|
||||||
timeout: runner_timeout,
|
timeout:,
|
||||||
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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user