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

Closed
wants to merge 1 commit into 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 148
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?

Copy link
Member Author

@carlocab carlocab Sep 21, 2024

Choose a reason for hiding this comment

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

I can skip formulae not in the given tap, but Tap objects don't seem to have a nice way to recover the formulae they contain. They can give me the formulae files, but not sure handling those directly is nicer than this.

Copy link
Member

Choose a reason for hiding this comment

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

I think handling formulae files is always nicer than doing Formula.all and evaluating every formula, whether needed or not.

Library/Homebrew/github_runner_matrix.rb Outdated Show resolved Hide resolved
Library/Homebrew/github_runner_matrix.rb Show resolved Hide resolved
Library/Homebrew/github_runner_matrix.rb Outdated Show resolved Hide resolved
@carlocab carlocab force-pushed the deploy-new-x86_64-runner branch from 22ccc44 to 30e25c5 Compare September 21, 2024 14:23
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.

You probably need to pass eval_all here

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, will add it when I get around to updating the calls in homebrew/core

Comment on lines -184 to +205
next if !@all_supported && macos_version > NEWEST_HOMEBREW_CORE_INTEL_MACOS_RUNNER
# `#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
if macos_version > NEWEST_DEFAULT_HOMEBREW_CORE_INTEL_MACOS_RUNNER &&
Copy link
Member

Choose a reason for hiding this comment

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

Was removing the !@all_supported intentional?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's up here:

@deploy_new_x86_64_runner = T.let(all_supported, T::Boolean)

Copy link
Member

@Bo98 Bo98 Sep 21, 2024

Choose a reason for hiding this comment

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

Ah thanks, that wasn't obvious at first.

@carlocab carlocab force-pushed the deploy-new-x86_64-runner branch from 30e25c5 to c8d1644 Compare September 21, 2024 14:56
Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale No recent activity label Oct 15, 2024
@carlocab carlocab removed the stale No recent activity label Oct 16, 2024
Copy link

github-actions bot commented Nov 7, 2024

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale No recent activity label Nov 7, 2024
@carlocab
Copy link
Member Author

carlocab commented Nov 7, 2024

I'll get to this late next week (or in the first half of the week following that).

@github-actions github-actions bot removed the stale No recent activity label Nov 7, 2024
Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale No recent activity label Nov 29, 2024
@github-actions github-actions bot closed this Dec 6, 2024
@github-actions github-actions bot deleted the deploy-new-x86_64-runner branch December 6, 2024 00:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale No recent activity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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