kanbanworkflowstimelinescrumrubyroadmapproject-planningproject-managementopenprojectangularissue-trackerifcgantt-chartganttbug-trackerboardsbcf
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.0 KiB
44 lines
1.0 KiB
5 years ago
|
#!/usr/bin/env ruby
|
||
|
require 'pathname'
|
||
|
require 'travis'
|
||
|
require 'rest-client'
|
||
|
require 'parallel'
|
||
|
require 'ruby-progressbar'
|
||
|
|
||
|
# current branch
|
||
|
branch_name = `git rev-parse --abbrev-ref HEAD`.strip
|
||
|
|
||
|
pr_number = nil
|
||
|
|
||
|
begin
|
||
|
response = RestClient.get "https://api.github.com/repos/opf/openproject/pulls?state=open&head=opf:#{branch_name}"
|
||
|
json = JSON.parse(response)
|
||
|
pr_number = json.first['number']
|
||
|
rescue => e
|
||
|
warn "Failed to get PR number from #{branch_name}: #{e} #{e.message}"
|
||
|
end
|
||
|
|
||
|
puts "Looking for PR #{pr_number}"
|
||
|
build = Travis::Repository.find('opf/openproject')
|
||
|
.each_build
|
||
|
.detect { |b| b.pull_request_number == pr_number.to_i }
|
||
|
|
||
|
raise "No build found for PR#{pr_number}" unless build
|
||
|
|
||
|
results = Parallel.map(build.jobs, progress: 'Searching logs') do |job|
|
||
|
# internal log access seems broken
|
||
|
errors = []
|
||
|
|
||
|
log = job.log.session.get_raw("jobs/#{job.id}/log")
|
||
|
log.scan(/^rspec (\S+) #.+$/) do |match|
|
||
|
errors << match
|
||
|
end
|
||
|
|
||
|
errors
|
||
|
end
|
||
|
|
||
|
specs = results.flatten.join(" ")
|
||
|
|
||
|
puts "Errors\n\n#{specs}"
|
||
|
|