Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github_runner_matrix: deploy new x86_64 runner when required #18363

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

carlocab
Copy link
Member

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

Closes #18356.

@carlocab carlocab requested a review from Bo98 September 20, 2024 10:51
Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @carlocab, great work so far!

Comment on lines +132 to +147
NEW_INTEL_MACOS_MUST_BUILD_FORMULAE = %w[pkg-config pkgconf].freeze

sig { returns(T::Boolean) }
def deploy_new_x86_64_runner?
return true if @testing_formulae.any? { |f| NEW_INTEL_MACOS_MUST_BUILD_FORMULAE.include?(f.name) }
return true if @testing_formulae.any? { |f| f.formula.class.pour_bottle_only_if == :clt_installed }

Formula.all.any? do |formula|
non_test_dependencies = Dependency.expand(formula, cache_key: "determine-test-runners") do |_, dependency|
Dependency.prune if dependency.test?
end
next false if non_test_dependencies.none? { |dep| @testing_formulae.map(&:name).include?(dep.name) }

formula.class.pour_bottle_only_if == :clt_installed
end
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned before: I'd love to see this be a temporary stop-gap while we add a DSL. I think this needs some pretty hefty amounts of comments until then explaining why these particular formulae need to be doing what they are doing here.

return true if @testing_formulae.any? { |f| NEW_INTEL_MACOS_MUST_BUILD_FORMULAE.include?(f.name) }
return true if @testing_formulae.any? { |f| f.formula.class.pour_bottle_only_if == :clt_installed }

Formula.all.any? do |formula|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this instead use e.g. the relevant tap(s) instead of reading all formulae unconditionally here?

# `#deploy_new_x86_64_runner?` is expensive, so:
# - avoid calling it if we don't have to
# - cache the result to a variable to avoid calling it multiple times
deploy_new_x86_64_runner = @all_supported || deploy_new_x86_64_runner?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's slow: be worth putting this in the loop lazily evaluated as late as possible and memoized so that we can avoid more cases where it might not need to be called at all e.g. for the last possible next

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setup brew determine-test-runners for macOS 15 x86_64
2 participants