github_runner_matrix: deploy arm64 Linux runners on PRs with :arm64_linux
bottles
This will help us avoid losing bottles on version bumps. Also, let's do the same on Intel macOS 15 and newer. This is essentially a simpler version of #18363. Instead of trying to use complicated criteria or a DSL, let's just run the build on Intel macOS 15 if the formula already has a `:sequoia` bottle.
This commit is contained in:
parent
f3bd91d3af
commit
84e50f50ec
@ -83,9 +83,13 @@ class GitHubRunnerMatrix
|
|||||||
GITHUB_ACTIONS_SHORT_TIMEOUT = 60
|
GITHUB_ACTIONS_SHORT_TIMEOUT = 60
|
||||||
private_constant :SELF_HOSTED_LINUX_RUNNER, :GITHUB_ACTIONS_LONG_TIMEOUT, :GITHUB_ACTIONS_SHORT_TIMEOUT
|
private_constant :SELF_HOSTED_LINUX_RUNNER, :GITHUB_ACTIONS_LONG_TIMEOUT, :GITHUB_ACTIONS_SHORT_TIMEOUT
|
||||||
|
|
||||||
sig { returns(LinuxRunnerSpec) }
|
sig { params(arch: Symbol).returns(LinuxRunnerSpec) }
|
||||||
def linux_runner_spec
|
def linux_runner_spec(arch)
|
||||||
linux_runner = ENV.fetch("HOMEBREW_LINUX_RUNNER")
|
linux_runner = case arch
|
||||||
|
when :arm64 then "ubuntu-22.04-arm"
|
||||||
|
when :x86_64 then ENV.fetch("HOMEBREW_LINUX_RUNNER")
|
||||||
|
else raise "Unknown Linux architecture: #{arch}"
|
||||||
|
end
|
||||||
|
|
||||||
LinuxRunnerSpec.new(
|
LinuxRunnerSpec.new(
|
||||||
name: "Linux",
|
name: "Linux",
|
||||||
@ -108,14 +112,16 @@ class GitHubRunnerMatrix
|
|||||||
params(
|
params(
|
||||||
platform: Symbol,
|
platform: Symbol,
|
||||||
arch: Symbol,
|
arch: Symbol,
|
||||||
spec: RunnerSpec,
|
spec: T.nilable(RunnerSpec),
|
||||||
macos_version: T.nilable(MacOSVersion),
|
macos_version: T.nilable(MacOSVersion),
|
||||||
).returns(GitHubRunner)
|
).returns(GitHubRunner)
|
||||||
}
|
}
|
||||||
def create_runner(platform, arch, spec, macos_version = nil)
|
def create_runner(platform, arch, spec = nil, macos_version = nil)
|
||||||
raise "Unexpected platform: #{platform}" if VALID_PLATFORMS.exclude?(platform)
|
raise "Unexpected platform: #{platform}" if VALID_PLATFORMS.exclude?(platform)
|
||||||
raise "Unexpected arch: #{arch}" if VALID_ARCHES.exclude?(arch)
|
raise "Unexpected arch: #{arch}" if VALID_ARCHES.exclude?(arch)
|
||||||
|
raise "Missing `spec` argument" if spec.nil? && platform != :linux
|
||||||
|
|
||||||
|
spec ||= linux_runner_spec(arch)
|
||||||
runner = GitHubRunner.new(platform:, arch:, spec:, macos_version:)
|
runner = GitHubRunner.new(platform:, arch:, spec:, macos_version:)
|
||||||
runner.spec.testing_formulae += testable_formulae(runner)
|
runner.spec.testing_formulae += testable_formulae(runner)
|
||||||
runner.active = active_runner?(runner)
|
runner.active = active_runner?(runner)
|
||||||
@ -141,7 +147,12 @@ class GitHubRunnerMatrix
|
|||||||
return if @runners.present?
|
return if @runners.present?
|
||||||
|
|
||||||
if !@all_supported || ENV.key?("HOMEBREW_LINUX_RUNNER")
|
if !@all_supported || ENV.key?("HOMEBREW_LINUX_RUNNER")
|
||||||
@runners << create_runner(:linux, :x86_64, linux_runner_spec)
|
@runners << create_runner(:linux, :x86_64)
|
||||||
|
|
||||||
|
if !@dependent_matrix &&
|
||||||
|
@testing_formulae.any? { |tf| tf.formula.bottle_specification.tag?(Utils::Bottles.tag(:arm64_linux)) }
|
||||||
|
@runners << create_runner(:linux, :arm64)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
github_run_id = ENV.fetch("GITHUB_RUN_ID")
|
github_run_id = ENV.fetch("GITHUB_RUN_ID")
|
||||||
@ -184,7 +195,11 @@ class GitHubRunnerMatrix
|
|||||||
)
|
)
|
||||||
@runners << create_runner(:macos, :arm64, spec, macos_version)
|
@runners << create_runner(:macos, :arm64, spec, macos_version)
|
||||||
|
|
||||||
next if !@all_supported && macos_version > NEWEST_HOMEBREW_CORE_INTEL_MACOS_RUNNER
|
skip_intel_runner = !@all_supported && macos_version > NEWEST_HOMEBREW_CORE_INTEL_MACOS_RUNNER
|
||||||
|
skip_intel_runner &&= @dependent_matrix || @testing_formulae.none? do |testing_formula|
|
||||||
|
testing_formula.formula.bottle_specification.tag?(Utils::Bottles.tag(macos_version.to_sym))
|
||||||
|
end
|
||||||
|
next if skip_intel_runner
|
||||||
|
|
||||||
github_runner_available = macos_version.between?(OLDEST_GITHUB_ACTIONS_INTEL_MACOS_RUNNER,
|
github_runner_available = macos_version.between?(OLDEST_GITHUB_ACTIONS_INTEL_MACOS_RUNNER,
|
||||||
NEWEST_GITHUB_ACTIONS_INTEL_MACOS_RUNNER)
|
NEWEST_GITHUB_ACTIONS_INTEL_MACOS_RUNNER)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user