Merge pull request #11600 from dawidd6/dispatch-linux-unify
dispatch-build-bottle: support self-hosted Linux and unified workflow
This commit is contained in:
commit
71eb2fee73
@ -96,6 +96,15 @@ module Homebrew
|
|||||||
sig { returns(T::Boolean) }
|
sig { returns(T::Boolean) }
|
||||||
def upload?; end
|
def upload?; end
|
||||||
|
|
||||||
|
sig { returns(T::Boolean) }
|
||||||
|
def linux?; end
|
||||||
|
|
||||||
|
sig { returns(T::Boolean) }
|
||||||
|
def linux_self_hosted?; end
|
||||||
|
|
||||||
|
sig { returns(T::Boolean) }
|
||||||
|
def wheezy?; end
|
||||||
|
|
||||||
sig { returns(T::Boolean) }
|
sig { returns(T::Boolean) }
|
||||||
def total?; end
|
def total?; end
|
||||||
|
|
||||||
|
|||||||
@ -27,8 +27,12 @@ module Homebrew
|
|||||||
description: "Upload built bottles."
|
description: "Upload built bottles."
|
||||||
switch "--linux",
|
switch "--linux",
|
||||||
description: "Dispatch bottle for Linux (using GitHub runners)."
|
description: "Dispatch bottle for Linux (using GitHub runners)."
|
||||||
|
switch "--linux-self-hosted",
|
||||||
|
description: "Dispatch bottle for Linux (using self-hosted runner)."
|
||||||
|
switch "--wheezy",
|
||||||
|
description: "Use Debian Wheezy container for building the bottle on Linux."
|
||||||
|
|
||||||
conflicts "--macos", "--linux"
|
conflicts "--macos", "--linux", "--linux-self-hosted"
|
||||||
named_args :formula, min: 1
|
named_args :formula, min: 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -45,7 +49,7 @@ module Homebrew
|
|||||||
# TODO: remove when core taps are merged
|
# TODO: remove when core taps are merged
|
||||||
repo.gsub!("linux", "home") unless args.tap
|
repo.gsub!("linux", "home") unless args.tap
|
||||||
|
|
||||||
if (macos = args.macos)
|
runner = if (macos = args.macos)
|
||||||
# We accept runner name syntax (11-arm64) or bottle syntax (arm64_big_sur)
|
# We accept runner name syntax (11-arm64) or bottle syntax (arm64_big_sur)
|
||||||
os, arch = macos.yield_self do |s|
|
os, arch = macos.yield_self do |s|
|
||||||
tag = Utils::Bottles::Tag.from_symbol(s.to_sym)
|
tag = Utils::Bottles::Tag.from_symbol(s.to_sym)
|
||||||
@ -55,33 +59,33 @@ module Homebrew
|
|||||||
[MacOS::Version.new(os), arch&.to_sym]
|
[MacOS::Version.new(os), arch&.to_sym]
|
||||||
end
|
end
|
||||||
|
|
||||||
macos_label = if arch.present? && arch != :x86_64
|
if arch.present? && arch != :x86_64
|
||||||
"#{os}-#{arch}"
|
"#{os}-#{arch}"
|
||||||
else
|
else
|
||||||
os.to_s
|
os.to_s
|
||||||
end
|
end
|
||||||
|
elsif args.linux?
|
||||||
dispatching_for = "macOS #{macos_label}"
|
"ubuntu-latest"
|
||||||
elsif T.unsafe(args).linux?
|
elsif args.linux_self_hosted?
|
||||||
workflow = args.workflow || "linux-#{workflow}"
|
"linux-self-hosted-1"
|
||||||
dispatching_for = "Linux"
|
|
||||||
else
|
else
|
||||||
raise UsageError, "Must specify --macos or --linux option"
|
raise UsageError, "Must specify --macos or --linux or --linux-self-hosted option"
|
||||||
end
|
end
|
||||||
|
|
||||||
args.named.to_resolved_formulae.each do |formula|
|
args.named.to_resolved_formulae.each do |formula|
|
||||||
# Required inputs
|
# Required inputs
|
||||||
inputs = {
|
inputs = {
|
||||||
|
runner: runner,
|
||||||
formula: formula.name,
|
formula: formula.name,
|
||||||
}
|
}
|
||||||
|
|
||||||
# Optional inputs
|
# Optional inputs
|
||||||
# These cannot be passed as nil to GitHub API
|
# These cannot be passed as nil to GitHub API
|
||||||
inputs[:macos] = macos_label if args.macos
|
|
||||||
inputs[:issue] = args.issue if args.issue
|
inputs[:issue] = args.issue if args.issue
|
||||||
inputs[:upload] = args.upload?.to_s if args.upload?
|
inputs[:upload] = args.upload?.to_s if args.upload?
|
||||||
|
inputs[:wheezy] = args.wheezy?.to_s if args.wheezy?
|
||||||
|
|
||||||
ohai "Dispatching #{tap} bottling request of formula \"#{formula.name}\" for #{dispatching_for}"
|
ohai "Dispatching #{tap} bottling request of formula \"#{formula.name}\" for #{runner}"
|
||||||
GitHub.workflow_dispatch_event(user, repo, workflow, ref, inputs)
|
GitHub.workflow_dispatch_event(user, repo, workflow, ref, inputs)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user