class Perkins::BuildWorker

Public Instance Methods

perform(report_id, sha, branch) click to toggle source
# File lib/perkins/build_worker.rb, line 9
def perform(report_id, sha, branch)
  report = Perkins::BuildReport.find(report_id)
  report.retrieve_commit_info
  repo = report.repo
  repo.virtual_sha = "-#{report.id}-#{sha}"
  #repo.build_runner_config
  #it actually clone repo and instantiates git data & check travis.yml
  repo.load_git

  return if repo.runner.blank?
  repo.runner.report = report
  repo.runner.sha    = sha
  repo.runner.branch = branch

  repo.send_sse(status: "start")

  repo.runner.run(sha)

  report = repo.build_reports.find_by(sha: sha)
  report.send_github_status(sha)

  repo.send_sse({ status: "stop", report: report })
end