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 4c5c2ea
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 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,

Check failure on line 35 in lib/tests/bottles_fetch.rb

View workflow job for this annotation

GitHub Actions / macOS

Layout/ArgumentAlignment: Align the arguments of a method call if they span more than one line.
formula_name

Check failure on line 36 in lib/tests/bottles_fetch.rb

View workflow job for this annotation

GitHub Actions / macOS

Layout/ArgumentAlignment: Align the arguments of a method call if they span more than one line.
end
end
end
Expand Down
13 changes: 9 additions & 4 deletions lib/tests/formulae.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,17 @@ 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,

Check failure on line 156 in lib/tests/formulae.rb

View workflow job for this annotation

GitHub Actions / macOS

Layout/ArgumentAlignment: Align the arguments of a method call if they span more than one line.
*@unchanged_dependencies

Check failure on line 157 in lib/tests/formulae.rb

View workflow job for this annotation

GitHub Actions / macOS

Layout/ArgumentAlignment: Align the arguments of a method call if they span more than one line.
end

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

Check failure on line 163 in lib/tests/formulae.rb

View workflow job for this annotation

GitHub Actions / macOS

Layout/ArgumentAlignment: Align the arguments of a method call if they span more than one line.
*changed_dependencies

Check failure on line 164 in lib/tests/formulae.rb

View workflow job for this annotation

GitHub Actions / macOS

Layout/ArgumentAlignment: Align the arguments of a method call if they span more than one line.

ignore_failures = !args.test_default_formula? && changed_dependencies.any? do |dep|
!bottled?(Formulary.factory(dep), no_older_versions: true)
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,

Check failure on line 257 in lib/tests/formulae_dependents.rb

View workflow job for this annotation

GitHub Actions / macOS

Layout/ArgumentAlignment: Align the arguments of a method call if they span more than one line.
dependent.full_name

Check failure on line 258 in lib/tests/formulae_dependents.rb

View workflow job for this annotation

GitHub Actions / macOS

Layout/ArgumentAlignment: Align the arguments of a method call if they span more than one line.
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 4c5c2ea

Please sign in to comment.