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

Fix modified test files #10

Merged
merged 2 commits into from
Nov 10, 2023
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
12 changes: 8 additions & 4 deletions lib/selective/ruby/core/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,10 @@ def transport_url
end

def build_env
result = `#{Pathname.new(__dir__) + BUILD_ENV_SCRIPT_PATH}`
JSON.parse(result)
@build_env ||= begin
result = `#{Pathname.new(__dir__) + BUILD_ENV_SCRIPT_PATH}`
JSON.parse(result)
end
end

def spawn_transport_process(url)
Expand Down Expand Up @@ -237,8 +239,10 @@ def handle_remove_failed_test_case_result(test_case_id)
end

def modified_test_files
# Todo: This should find files changed in the current branch
`git diff --name-only`.split("\n").filter do |f|
target_branch = build_env["target_branch"]
return [] if target_branch.nil? || target_branch.empty?

`git diff #{target_branch} --name-only`.split("\n").filter do |f|
f.match?(/^#{runner.base_test_path}/)
end
end
Expand Down
Loading