mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
github_runner_matrix: fix skipped runner creation
This commit is contained in:
parent
019a799fae
commit
f92e961ff1
@ -255,17 +255,10 @@ class GitHubRunnerMatrix
|
||||
@testing_formulae.select do |formula|
|
||||
next false if macos_version && !formula.compatible_with?(macos_version)
|
||||
|
||||
simulate_arch = case arch
|
||||
when :x86_64
|
||||
:intel
|
||||
when :arm64
|
||||
:arm
|
||||
else
|
||||
:dunno
|
||||
end
|
||||
Homebrew::SimulateSystem.with(os: platform, arch: simulate_arch) do
|
||||
formula.public_send(:"#{platform}_compatible?") &&
|
||||
formula.public_send(:"#{arch}_compatible?")
|
||||
Homebrew::SimulateSystem.with(os: platform, arch: Homebrew::SimulateSystem.arch_symbols.fetch(arch)) do
|
||||
simulated_formula = TestRunnerFormula.new(Formulary.factory(formula.name))
|
||||
simulated_formula.public_send(:"#{platform}_compatible?") &&
|
||||
simulated_formula.public_send(:"#{arch}_compatible?")
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -283,8 +276,11 @@ class GitHubRunnerMatrix
|
||||
.select do |dependent_f|
|
||||
next false if macos_version && !dependent_f.compatible_with?(macos_version)
|
||||
|
||||
dependent_f.public_send(:"#{platform}_compatible?") &&
|
||||
dependent_f.public_send(:"#{arch}_compatible?")
|
||||
Homebrew::SimulateSystem.with(os: platform, arch: Homebrew::SimulateSystem.arch_symbols.fetch(arch)) do
|
||||
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
|
||||
|
||||
# These arrays will generally have been generated by different Formulary caches,
|
||||
|
@ -10,6 +10,11 @@ module Homebrew
|
||||
class << self
|
||||
attr_reader :arch, :os
|
||||
|
||||
sig { returns(T::Hash[Symbol, Symbol]) }
|
||||
def arch_symbols
|
||||
{ arm64: :arm, x86_64: :intel }.freeze
|
||||
end
|
||||
|
||||
sig {
|
||||
type_parameters(:U).params(
|
||||
os: Symbol,
|
||||
|
@ -20,7 +20,7 @@ RSpec.describe GitHubRunnerMatrix, :no_api do
|
||||
MacOSVersion::SYMBOLS.find { |k, _| k == described_class::NEWEST_HOMEBREW_CORE_MACOS_RUNNER }
|
||||
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_linux) { setup_test_runner_formula("testball-depender-linux", ["testball", :linux]) }
|
||||
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
|
||||
|
||||
stub_formula_loader f
|
||||
TestRunnerFormula.new(f)
|
||||
end
|
||||
end
|
||||
|
@ -77,8 +77,6 @@ class TestRunnerFormula
|
||||
macos_version.public_send(requirement.comparator, requirement.version)
|
||||
end
|
||||
|
||||
SIMULATE_SYSTEM_SYMBOLS = T.let({ arm64: :arm, x86_64: :intel }.freeze, T::Hash[Symbol, Symbol])
|
||||
|
||||
sig {
|
||||
params(
|
||||
platform: Symbol,
|
||||
@ -98,7 +96,7 @@ class TestRunnerFormula
|
||||
|
||||
with_env(HOMEBREW_EVAL_ALL: eval_all_env) do
|
||||
os = macos_version || platform
|
||||
arch = SIMULATE_SYSTEM_SYMBOLS.fetch(arch)
|
||||
arch = Homebrew::SimulateSystem.arch_symbols.fetch(arch)
|
||||
|
||||
Homebrew::SimulateSystem.with(os:, arch:) do
|
||||
Formula.public_send(formula_selector)
|
||||
|
Loading…
x
Reference in New Issue
Block a user