Skip to content

2024-08-07 v. 6.4.1.1: refactored CI jobs #701

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

Merged
merged 1 commit into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions ci/ci_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,24 @@ module CI
# Use it to create concrete CI jobs.
class CIJob
PROCESS_NO_IMPL_ERROR = "No implementation for process in #{self.class.name}"

private_constant :PROCESS_NO_IMPL_ERROR

# Main entry of job class that runs your check.
def run
puts("#{self.class.name} started...")

process

puts("#{self.class.name} ended without errors!")
end

# Use this method in your realization when task completed with error.
def end_with_error(details)
details.call

puts("#{self.class.name} ended with an error.")

exit(1)
end

Expand Down
9 changes: 5 additions & 4 deletions ci/links_checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ def check(difficulty)
lines = ::IO.readlines("#{path}/#{file_name}")
has_comment = false
lines.each do |line|
if line.start_with?('# https://leetcode.com/')
has_comment = true
break
end
next unless line.start_with?('# https://leetcode.com/')

has_comment = true

break
end

end_with_error(-> { puts("LinksChecker ends with an error from #{file_name}.") }) unless has_comment
Expand Down
5 changes: 1 addition & 4 deletions ci/readme_checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ def check(difficulty)
readme = ::File.readlines('./README.md')

solutions.each do |file_name|
links_count = 0
readme.each do |line|
links_count += 1 if line.include?(file_name)
end
links_count = readme.count { |line| line.include?(file_name) }

end_with_error(-> { puts("ReadmeChecker ends with an error from #{file_name}.") }) if links_count != 1
end
Expand Down
Loading