Class: Perkins::BuildWorker

Inherits:
Object show all
Includes:
Sidekiq::Worker
Defined in:
lib/perkins/build_worker.rb

Instance Method Summary collapse

Instance Method Details

#perform(report_id, sha, branch) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# 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