Skip to content

Commit e5896bc

Browse files
committed
workflows/dispatch-rebottle: support formulae with arm64 Linux bottles
This will allow the `dispatch-rebottle.yml` workflow to just work for formulae with `:arm64_linux` bottles.
1 parent 2f77e85 commit e5896bc

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

Diff for: .github/workflows/dispatch-rebottle.yml

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ env:
4747
HOMEBREW_NO_AUTO_UPDATE: 1
4848
HOMEBREW_NO_INSTALL_FROM_API: 1
4949
HOMEBREW_NO_BUILD_ERROR_ISSUES: 1
50+
HOMEBREW_ARM64_TESTING: 1
5051
RUN_URL: ${{github.event.repository.html_url}}/actions/runs/${{github.run_id}}
5152
DISPATCH_REBOTTLE_SENDER: ${{ github.event.sender.login }}
5253
DISPATCH_REBOTTLE_FORMULA: ${{ inputs.formula }}

Diff for: cmd/determine-rebottle-runners.rb

+18-10
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,32 @@ class DetermineRebottleRunnersCmd < AbstractCommand
1919
hide_from_man_page!
2020
end
2121

22-
sig { override.void }
23-
def run
24-
formula = Formula[T.must(args.named.first)]
25-
timeout = args.named.second.to_i
26-
27-
linux_runner = if timeout > 360
22+
sig { params(arch: Symbol, timeout: Integer).returns(T::Hash[Symbol, T.any(String, T::Hash[Symbol, String])]) }
23+
def linux_runner_spec(arch, timeout)
24+
linux_runner = if arch == :arm64
25+
"ubuntu-22.04-arm"
26+
elsif timeout > 360
2827
"linux-self-hosted-1"
2928
else
3029
"ubuntu-latest"
3130
end
32-
linux_runner_spec = {
31+
32+
{
3333
runner: linux_runner,
3434
container: {
3535
image: "ghcr.io/homebrew/ubuntu22.04:master",
3636
options: "--user=linuxbrew -e GITHUB_ACTIONS_HOMEBREW_SELF_HOSTED",
3737
},
3838
workdir: "/github/home",
3939
}
40+
end
41+
42+
KNOWN_LINUX_ARCHES = [:arm64, :x86_64].freeze
43+
44+
sig { override.void }
45+
def run
46+
formula = Formula[T.must(args.named.first)]
47+
timeout = args.named.second.to_i
4048

4149
tags = formula.bottle_specification.collector.tags
4250
runners = if tags.count == 1 && tags.first.system == :all
@@ -51,7 +59,7 @@ def run
5159
macos_runners << { runner: "#{macos_version}-arm64#{ephemeral_suffix}" }
5260
macos_runners
5361
end
54-
end << linux_runner_spec
62+
end << linux_runner_spec(:x86_64, timeout)
5563
else
5664
tags.map do |tag|
5765
macos_version = tag.to_macos_version
@@ -66,8 +74,8 @@ def run
6674
{ runner: }
6775
end
6876
rescue MacOSVersion::Error
69-
if tag.system == :linux && tag.arch == :x86_64
70-
linux_runner_spec
77+
if tag.system == :linux && KNOWN_LINUX_ARCHES.include?(tag.arch)
78+
linux_runner_spec(tag.arch, timeout)
7179
elsif tag.system == :all
7280
# An all bottle with OS-specific bottles also present - ignore it.
7381
nil

0 commit comments

Comments
 (0)