github_runner_matrix: simplify

This commit is contained in:
Carlo Cabrera 2023-04-25 14:54:44 +08:00
parent 3baacbbc72
commit 97655276b2
No known key found for this signature in database
GPG Key ID: C74D447FC549A1D0

View File

@ -136,8 +136,7 @@ class GitHubRunnerMatrix
next unless macos_version >= :big_sur
# Use bare metal runner when testing dependents on ARM64 Monterey.
use_ephemeral = (macos_version >= :ventura && @dependent_matrix) ||
(macos_version >= :monterey && !@dependent_matrix)
use_ephemeral = macos_version >= (@dependent_matrix ? :ventura : :monterey)
runner, cleanup = if use_ephemeral
["#{version}-arm64#{ephemeral_suffix}", false]
else
@ -164,9 +163,12 @@ class GitHubRunnerMatrix
arch = runner.arch
macos_version = runner.macos_version
compatible_formulae.select! { |formula| formula.public_send(:"#{platform}_compatible?") }
compatible_formulae.select! { |formula| formula.public_send(:"#{arch}_compatible?") }
compatible_formulae.select! { |formula| formula.compatible_with?(macos_version) } if macos_version
compatible_formulae.select! do |formula|
next false if macos_version && !formula.compatible_with?(macos_version)
formula.public_send(:"#{platform}_compatible?") &&
formula.public_send(:"#{arch}_compatible?")
end
compatible_formulae.present?
end
@ -188,9 +190,12 @@ class GitHubRunnerMatrix
compatible_dependents = formula.dependents(platform: platform, arch: arch, macos_version: macos_version&.to_sym)
.dup
compatible_dependents.select! { |dependent_f| dependent_f.public_send(:"#{platform}_compatible?") }
compatible_dependents.select! { |dependent_f| dependent_f.public_send(:"#{arch}_compatible?") }
compatible_dependents.select! { |dependent_f| dependent_f.compatible_with?(macos_version) } if macos_version
compatible_dependents.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?")
end
# These arrays will generally have been generated by different Formulary caches,
# so we can only compare them by name and not directly.