Skip to content

Commit

Permalink
Use --concurrency with brew fetch
Browse files Browse the repository at this point in the history
This should hopefully make CI just a little bit faster. It'll help us
kick the tires on `--concurrency`.
  • Loading branch information
carlocab committed Sep 29, 2024
1 parent ffa1754 commit a4cea91
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
4 changes: 3 additions & 1 deletion lib/tests/bottles_fetch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ def fetch_bottles!(formula_name, args:)

tags.each do |tag|
cleanup_during!(args:)
test "brew", "fetch", "--retry", "--formulae", "--bottle-tag=#{tag}", formula_name
test "brew", "fetch", "--retry", "--formulae", "--bottle-tag=#{tag}",
"--concurrency", Homebrew::EnvConfig.make_jobs,
formula_name
end
end
end
Expand Down
11 changes: 8 additions & 3 deletions lib/tests/formulae.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,16 @@ def setup_formulae_deps_instances(formula, formula_name, args:)

dependencies -= installed
@unchanged_dependencies = dependencies - @testing_formulae
test "brew", "fetch", "--formulae", "--retry", *@unchanged_dependencies unless @unchanged_dependencies.empty?
unless @unchanged_dependencies.empty?
test "brew", "fetch", "--formulae", "--retry",
"--concurrency", Homebrew::EnvConfig.make_jobs,
*@unchanged_dependencies
end

changed_dependencies = dependencies - @unchanged_dependencies
unless changed_dependencies.empty?
test "brew", "fetch", "--formulae", "--retry", "--build-from-source",
"--concurrency", Homebrew::EnvConfig.make_jobs,
*changed_dependencies

ignore_failures = !args.test_default_formula? && changed_dependencies.any? do |dep|
Expand Down Expand Up @@ -453,7 +458,7 @@ def formula!(formula_name, args:)
install_ca_certificates_if_needed

if (messages = unsatisfied_requirements_messages(formula))
test "brew", "fetch", "--formula", "--retry", *fetch_args
test "brew", "fetch", "--formula", "--retry", "--concurrency", Homebrew::EnvConfig.make_jobs, *fetch_args
test "brew", "audit", "--formula", *audit_args

skipped formula_name, messages
Expand Down Expand Up @@ -485,7 +490,7 @@ def formula!(formula_name, args:)

info_header "Starting tests for #{formula_name}"

test "brew", "fetch", "--formula", "--retry", *fetch_args
test "brew", "fetch", "--formula", "--retry", "--concurrency", Homebrew::EnvConfig.make_jobs, *fetch_args

env = {}
env["HOMEBREW_GIT_PATH"] = nil if deps.any? do |d|
Expand Down
6 changes: 4 additions & 2 deletions lib/tests/formulae_dependents.rb
Original file line number Diff line number Diff line change
Expand Up @@ -253,14 +253,16 @@ def install_dependent(dependent, testable_dependents, args:, build_from_source:

build_args << "--build-from-source"

test "brew", "fetch", "--build-from-source", "--retry", dependent.full_name
test "brew", "fetch", "--build-from-source", "--retry",
"--concurrency", Homebrew::EnvConfig.make_jobs,
dependent.full_name
return if steps.last.failed?
else
fetch_formulae << dependent.full_name
end

if fetch_formulae.present?
test "brew", "fetch", "--retry", *fetch_formulae
test "brew", "fetch", "--retry", "--concurrency", Homebrew::EnvConfig.make_jobs, *fetch_formulae
return if steps.last.failed?
end

Expand Down

0 comments on commit a4cea91

Please sign in to comment.