diff --git a/.toys/ci.rb b/.toys/ci.rb index 1470e2b0f959..f6fa94095526 100644 --- a/.toys/ci.rb +++ b/.toys/ci.rb @@ -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" @@ -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 @@ -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})" @@ -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? diff --git a/.toys/new-library.rb b/.toys/new-library.rb index 7724e00ee888..a210d13fae82 100644 --- a/.toys/new-library.rb +++ b/.toys/new-library.rb @@ -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 diff --git a/.toys/owlbot.rb b/.toys/owlbot.rb index beeefa21bc3f..02893c8c2b4f 100644 --- a/.toys/owlbot.rb +++ b/.toys/owlbot.rb @@ -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 diff --git a/.toys/peek-client.rb b/.toys/peek-client.rb index 7ad2ea44f5a4..c0f467ebed5b 100644 --- a/.toys/peek-client.rb +++ b/.toys/peek-client.rb @@ -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