Merge pull request #15313 from carlocab/deps-build-on-github

github_runner_matrix: test dependents on GitHub runners
This commit is contained in:
Mike McQuaid 2023-04-27 00:34:54 +01:00 committed by GitHub
commit 6b33197d54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -100,6 +100,9 @@ class GitHubRunnerMatrix
runner.freeze
end
NEWEST_GITHUB_ACTIONS_MACOS_RUNNER = :ventura
GITHUB_ACTIONS_RUNNER_TIMEOUT = 360
sig { void }
def generate_runners!
return if @runners.present?
@ -109,6 +112,8 @@ class GitHubRunnerMatrix
github_run_id = ENV.fetch("GITHUB_RUN_ID")
github_run_attempt = ENV.fetch("GITHUB_RUN_ATTEMPT")
timeout = ENV.fetch("HOMEBREW_MACOS_TIMEOUT").to_i
use_github_runner = ENV.fetch("HOMEBREW_MACOS_BUILD_ON_GITHUB_RUNNER", "false") == "true"
ephemeral_suffix = +"-#{github_run_id}-#{github_run_attempt}"
ephemeral_suffix << "-deps" if @dependent_matrix
ephemeral_suffix.freeze
@ -123,9 +128,18 @@ class GitHubRunnerMatrix
runner_timeout = timeout
runner_timeout += 30 if macos_version <= :big_sur
# Use GitHub Actions macOS Runner for testing dependents if compatible with timeout.
runner = if (@dependent_matrix || use_github_runner) &&
macos_version <= NEWEST_GITHUB_ACTIONS_MACOS_RUNNER &&
runner_timeout <= GITHUB_ACTIONS_RUNNER_TIMEOUT
"macos-#{version}"
else
"#{version}#{ephemeral_suffix}"
end
spec = MacOSRunnerSpec.new(
name: "macOS #{version}-x86_64",
runner: "#{version}#{ephemeral_suffix}",
runner: runner,
timeout: runner_timeout,
cleanup: false,
)

View File

@ -8,6 +8,7 @@ describe GitHubRunnerMatrix do
allow(ENV).to receive(:fetch).with("HOMEBREW_LINUX_RUNNER").and_return("ubuntu-latest")
allow(ENV).to receive(:fetch).with("HOMEBREW_LINUX_CLEANUP").and_return("false")
allow(ENV).to receive(:fetch).with("HOMEBREW_MACOS_TIMEOUT").and_return("90")
allow(ENV).to receive(:fetch).with("HOMEBREW_MACOS_BUILD_ON_GITHUB_RUNNER", "false").and_return("false")
allow(ENV).to receive(:fetch).with("GITHUB_RUN_ID").and_return("12345")
allow(ENV).to receive(:fetch).with("GITHUB_RUN_ATTEMPT").and_return("1")
end