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

chore: Stop using rake for the remaining workflows #28109

Merged
merged 1 commit into from
Dec 27, 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
58 changes: 21 additions & 37 deletions .toys/ci.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.

TASKS = ["test", "rubocop", "build", "yard", "linkinator", "acceptance", "samples-master", "samples-latest"].freeze
TASKS = [
"test",
"rubocop",
"build",
"yard",
"linkinator",
"acceptance",
"conformance",
"samples-master",
"samples-latest",
].freeze
OPTIONAL_TASKS = ["conformance"].freeze
ISSUE_TASKS = ["bundle", "test", "rubocop", "build", "yard", "linkinator"].freeze
FAILURES_REPORT_PATH = "tmp/ci-failures.json"

Expand Down Expand Up @@ -90,11 +101,6 @@ def run
require "json"
require "set"

# Temporary hack to allow minitest-rg 5.2.0 to work in minitest 5.19 or
# later. This should be removed if we have a better solution or decide to
# drop rg.
ENV["MT_COMPAT"] = "true"

set :failures_report, true if github_event_name == "schedule"
set :failures_report, FAILURES_REPORT_PATH if failures_report == true

Expand Down Expand Up @@ -291,7 +297,7 @@ def find_changed_directories files

def filter_gem_dirs dirs
dirs.find_all do |dir|
if ["Rakefile", "Gemfile", "#{dir}.gemspec"].all? { |file| File.file? File.join(dir, file) }
if ["Gemfile", "#{dir}.gemspec"].all? { |file| File.file? File.join(dir, file) }
result = capture_ruby [], in: :controller do |controller|
controller.in.puts "spec = Gem::Specification.load '#{dir}/#{dir}.gemspec'"
controller.in.puts "puts spec.required_ruby_version.satisfied_by? Gem::Version.new(#{RUBY_VERSION.inspect})"
Expand Down Expand Up @@ -334,42 +340,20 @@ def run_in_dir dir
end
@run_tasks.each do |task|
puts
puts "#{dir}: #{task} ...", :bold, :cyan
success =
if task == "linkinator"
run_linkinator dir
else
exec(["bundle", "exec", "rake", task.tr("-", ":")], env: @auth_env).success?
if OPTIONAL_TASKS.include? task
success = exec(["toys", "system", "tools", "show", task], out: :null).success?
unless success
puts "#{dir}: #{task} not available", :bold, :yellow
next
end
end
puts "#{dir}: #{task} ...", :bold, :cyan
success = exec(["toys", task] + verbosity_flags, env: @auth_env).success?
@errors << [dir, task] unless success
end
end
end

def run_linkinator dir
allowed_http_codes = ["200", "202"]
dir_without_version = dir.sub(/-v\d\w*$/, "")
skip_regexes = [
"\\w+\\.md$",
"^https://rubygems\\.org/gems/#{dir_without_version}",
"^https://cloud\\.google\\.com/ruby/docs/reference/#{dir}/latest$",
"^https://rubydoc\\.info/gems/#{dir}",
]
if dir == dir_without_version
skip_regexes << "^https://cloud\\.google\\.com/ruby/docs/reference/#{dir}-v\\d\\w*/latest$"
skip_regexes << "^https://rubydoc\\.info/gems/#{dir}-v\\d\\w*"
end
linkinator_cmd = ["npx", "linkinator", "./doc", "--retry-errors", "--skip", skip_regexes.join(" ")]
result = exec linkinator_cmd, out: :capture, err: [:child, :out]
puts result.captured_out
checked_links = result.captured_out.split "\n"
checked_links.select! { |link| link =~ /^\[(\d+)\]/ && !allowed_http_codes.include?(::Regexp.last_match[1]) }
checked_links.each do |link|
puts link, :yellow
end
checked_links.empty?
end

def handle_results
puts
if @errors.empty?
Expand Down
2 changes: 1 addition & 1 deletion .toys/new-library.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def add_fillers manifest
def test_library
Dir.chdir gem_name do
exec ["bundle", "install"]
exec ["bundle", "exec", "rake", "ci"]
exec ["toys", "ci", "--rubocop", "--yard", "--test"]
end
end

Expand Down
5 changes: 1 addition & 4 deletions .toys/owlbot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,7 @@ def process_single_gem name, temp_staging_dir
return unless enable_tests
cd name do
exec ["bundle", "install"]
# The MT_COMPAT environment variable is a temporary hack to allow
# minitest-rg 5.2.0 to work in minitest 5.19 or later. This should be
# removed if we have a better solution or decide to drop rg.
exec ["bundle", "exec", "rake", "ci"], env: { "MT_COMPAT" => "true" }
exec ["toys", "ci", "--rubocop", "--yard", "--test"]
end
end

Expand Down
2 changes: 1 addition & 1 deletion .toys/peek-client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def run_owl_bot

def run_test dir
exec ["bundle", "install"], chdir: dir
exec ["bundle", "exec", "rake", "ci"], chdir: dir
exec ["toys", "ci", "--rubocop", "--yard", "--test"], chdir: dir
end

def piper_client_dir
Expand Down
Loading