github_runner_matrix: fix skipped runner creation

This commit is contained in:
Eric Knibbe 2025-06-30 15:32:21 -04:00
parent 019a799fae
commit f92e961ff1
No known key found for this signature in database
4 changed files with 17 additions and 17 deletions

View File

@ -255,17 +255,10 @@ class GitHubRunnerMatrix
@testing_formulae.select do |formula| @testing_formulae.select do |formula|
next false if macos_version && !formula.compatible_with?(macos_version) next false if macos_version && !formula.compatible_with?(macos_version)
simulate_arch = case arch Homebrew::SimulateSystem.with(os: platform, arch: Homebrew::SimulateSystem.arch_symbols.fetch(arch)) do
when :x86_64 simulated_formula = TestRunnerFormula.new(Formulary.factory(formula.name))
:intel simulated_formula.public_send(:"#{platform}_compatible?") &&
when :arm64 simulated_formula.public_send(:"#{arch}_compatible?")
:arm
else
:dunno
end
Homebrew::SimulateSystem.with(os: platform, arch: simulate_arch) do
formula.public_send(:"#{platform}_compatible?") &&
formula.public_send(:"#{arch}_compatible?")
end end
end end
end end
@ -283,8 +276,11 @@ class GitHubRunnerMatrix
.select do |dependent_f| .select do |dependent_f|
next false if macos_version && !dependent_f.compatible_with?(macos_version) next false if macos_version && !dependent_f.compatible_with?(macos_version)
dependent_f.public_send(:"#{platform}_compatible?") && Homebrew::SimulateSystem.with(os: platform, arch: Homebrew::SimulateSystem.arch_symbols.fetch(arch)) do
dependent_f.public_send(:"#{arch}_compatible?") simulated_dependent_f = TestRunnerFormula.new(Formulary.factory(dependent_f.name))
simulated_dependent_f.public_send(:"#{platform}_compatible?") &&
simulated_dependent_f.public_send(:"#{arch}_compatible?")
end
end end
# These arrays will generally have been generated by different Formulary caches, # These arrays will generally have been generated by different Formulary caches,

View File

@ -10,6 +10,11 @@ module Homebrew
class << self class << self
attr_reader :arch, :os attr_reader :arch, :os
sig { returns(T::Hash[Symbol, Symbol]) }
def arch_symbols
{ arm64: :arm, x86_64: :intel }.freeze
end
sig { sig {
type_parameters(:U).params( type_parameters(:U).params(
os: Symbol, os: Symbol,

View File

@ -20,7 +20,7 @@ RSpec.describe GitHubRunnerMatrix, :no_api do
MacOSVersion::SYMBOLS.find { |k, _| k == described_class::NEWEST_HOMEBREW_CORE_MACOS_RUNNER } MacOSVersion::SYMBOLS.find { |k, _| k == described_class::NEWEST_HOMEBREW_CORE_MACOS_RUNNER }
end end
let(:testball) { TestRunnerFormula.new(Testball.new) } let(:testball) { setup_test_runner_formula("testball") }
let(:testball_depender) { setup_test_runner_formula("testball-depender", ["testball"]) } let(:testball_depender) { setup_test_runner_formula("testball-depender", ["testball"]) }
let(:testball_depender_linux) { setup_test_runner_formula("testball-depender-linux", ["testball", :linux]) } let(:testball_depender_linux) { setup_test_runner_formula("testball-depender-linux", ["testball", :linux]) }
let(:testball_depender_macos) { setup_test_runner_formula("testball-depender-macos", ["testball", :macos]) } let(:testball_depender_macos) { setup_test_runner_formula("testball-depender-macos", ["testball", :macos]) }
@ -315,6 +315,7 @@ RSpec.describe GitHubRunnerMatrix, :no_api do
end end
end end
stub_formula_loader f
TestRunnerFormula.new(f) TestRunnerFormula.new(f)
end end
end end

View File

@ -77,8 +77,6 @@ class TestRunnerFormula
macos_version.public_send(requirement.comparator, requirement.version) macos_version.public_send(requirement.comparator, requirement.version)
end end
SIMULATE_SYSTEM_SYMBOLS = T.let({ arm64: :arm, x86_64: :intel }.freeze, T::Hash[Symbol, Symbol])
sig { sig {
params( params(
platform: Symbol, platform: Symbol,
@ -98,7 +96,7 @@ class TestRunnerFormula
with_env(HOMEBREW_EVAL_ALL: eval_all_env) do with_env(HOMEBREW_EVAL_ALL: eval_all_env) do
os = macos_version || platform os = macos_version || platform
arch = SIMULATE_SYSTEM_SYMBOLS.fetch(arch) arch = Homebrew::SimulateSystem.arch_symbols.fetch(arch)
Homebrew::SimulateSystem.with(os:, arch:) do Homebrew::SimulateSystem.with(os:, arch:) do
Formula.public_send(formula_selector) Formula.public_send(formula_selector)