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

Add comments to Compats::Check #85

Merged
merged 1 commit into from
Sep 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions app/services/compats/check.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require "fileutils"

# The purpose of this service is to check a compat, i.e. determine whether its set of dependencies is compatible with its Rails release or not. To do so, several approaches are taken, from least to most complex.
module Compats
class Check < Baseline::Service
RAILS_GEMS = %w(
Expand Down Expand Up @@ -34,6 +35,7 @@ def call(compat)

private

# This method checks for the simplest case: if the compat has no dependencies, it's marked as compatible.
def check_empty_dependencies
return unless @compat.pending?

Expand All @@ -43,6 +45,7 @@ def check_empty_dependencies
end
end

# This method checks if the dependencies include any Rail gems, and if so, if any of them have a different version than the compat's Rails version. If that's the case, the compat is marked as incompatible.
def check_rails_gems
return unless @compat.pending?

Expand All @@ -59,6 +62,7 @@ def check_rails_gems
end
end

# This method checks if any other compats exist, that are marked as incompatible and have a subset of the compat's dependencies. If so, the compat must be incompatible and is marked as such.
def check_dependency_subsets
return unless @compat.pending? && (2..10).cover?(@compat.dependencies.size)

Expand All @@ -75,6 +79,7 @@ def check_dependency_subsets
end
end

# This method checks if any other compats exist, that are marked as compatible and have a superset of the compat's dependencies. If so, the compat must be compatible and is marked as such.
def check_dependency_supersets
# return unless @compat.pending?
#
Expand All @@ -86,6 +91,7 @@ def check_dependency_supersets
# end
end

# This method checks a compat by actually attempting to install the compat's dependencies with the compat's Rails version locally. If the installation fails, the compat is marked as incompatible. If it succeeds, it is marked as compatible. If any of the dependencies have native extensions that cannot be built, the compat is marked as inconclusive.
def check_with_bundler_locally
return unless @compat.pending? && @compat.check_locally

Expand Down Expand Up @@ -158,6 +164,7 @@ def check_with_bundler_locally
@compat.status_determined_by = "bundler_local"
end

# This method checks a compat by creating a new branch in the "checker" repository, adding a Gemfile with the compat's dependencies and pushing it to GitHub. A GitHub Actions workflow is then triggered in the "checker" repo, which tries to run `bundler lock` to resolve the dependencies. Afterwards, GitHub sends a notification to the "github_notifications" API endpoint, which creates a new GithubNotification and processes it in `GithubNotifications::Process`.
def check_with_bundler_github
return unless @compat.pending? && Rails.env.production?

Expand Down
Loading