Class: GitHubRunnerMatrix

Inherits:
Object show all
Defined in:
github_runner_matrix.rb

Constant Summary collapse

NEWEST_HOMEBREW_CORE_MACOS_RUNNER =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

When bumping newest runner, run e.g. git log -p --reverse -G "sha256 tahoe" on homebrew/core and tag the first commit with a bottle e.g. git tag 15-sequoia f42c4a659e4da887fc714f8f41cc26794a4bb320 to allow people to jump to specific commits based on their macOS version.

:tahoe
OLDEST_HOMEBREW_CORE_MACOS_RUNNER =
:sonoma
NEWEST_HOMEBREW_CORE_INTEL_MACOS_RUNNER =
:sonoma

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(testing_formulae, deleted_formulae, all_supported:, dependent_matrix:, dependent_shards: nil) ⇒ void

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'github_runner_matrix.rb', line 57

def initialize(testing_formulae, deleted_formulae, all_supported:, dependent_matrix:, dependent_shards: nil)
  if all_supported && (testing_formulae.present? || deleted_formulae.present? || dependent_matrix)
    raise ArgumentError, "all_supported is mutually exclusive to other arguments"
  end

  @testing_formulae = testing_formulae
  @deleted_formulae = deleted_formulae
  @all_supported = all_supported
  @dependent_matrix = dependent_matrix
  @dependent_shards = T.let(dependent_shards || 1, Integer)
  @compatible_testing_formulae = T.let({}, T::Hash[GitHubRunner, T::Array[TestRunnerFormula]])
  @formulae_with_untested_dependents = T.let({}, T::Hash[GitHubRunner, T::Array[TestRunnerFormula]])

  @runners = T.let([], T::Array[GitHubRunner])
  generate_runners!

  freeze
end

Instance Attribute Details

#runnersArray<GitHubRunner> (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:



46
47
48
# File 'github_runner_matrix.rb', line 46

def runners
  @runners
end

Instance Method Details

#active_runner_specs_hashArray<RunnerSpecHash>

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Array<RunnerSpecHash>)


77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'github_runner_matrix.rb', line 77

def active_runner_specs_hash
  specs = runners.select(&:active)
                 .map(&:spec)
                 .map(&:to_h)
  return specs if !@dependent_matrix || @dependent_shards == 1

  specs.flat_map do |spec|
    (1..@dependent_shards).map do |shard|
      spec.merge(
        name:                      "#{spec.fetch(:name)} shard #{shard}/#{@dependent_shards}",
        formulae_dependents_shard: "#{shard}/#{@dependent_shards}",
      )
    end
  end
end