Support tests in the builder

This commit is contained in:
Graham Christensen 2017-11-24 14:14:26 -05:00
parent 20c4d2a302
commit e35c3d7575
No known key found for this signature in database
GPG key ID: ACA1C1D120C83D5C
2 changed files with 19 additions and 1 deletions

View file

@ -27,6 +27,12 @@ impl Actions {
]; ];
} }
pub fn nasty_hack_linux_only(&mut self, _job: &BuildJob) -> worker::Actions {
return vec![
worker::Action::Ack
];
}
pub fn merge_failed(&mut self, job: &BuildJob) -> worker::Actions { pub fn merge_failed(&mut self, job: &BuildJob) -> worker::Actions {
let msg = buildresult::BuildResult { let msg = buildresult::BuildResult {
repo: job.repo.clone(), repo: job.repo.clone(),

View file

@ -10,6 +10,7 @@ use std::io::BufRead;
use ofborg::checkout; use ofborg::checkout;
use ofborg::message::buildjob; use ofborg::message::buildjob;
use ofborg::nix; use ofborg::nix;
use ofborg::commentparser;
use ofborg::worker; use ofborg::worker;
use amqp::protocol::basic::{Deliver,BasicProperties}; use amqp::protocol::basic::{Deliver,BasicProperties};
@ -62,6 +63,17 @@ impl worker::SimpleWorker for BuildWorker {
None => { String::from("origin/master") } None => { String::from("origin/master") }
}; };
let buildfile = match job.subset {
Some(commentparser::Subset::NixOS) => "./nixos/default.nix",
_ => "./default.nix"
};
if buildfile == "./nixos/default.nix" && self.system != "x86_64-linux" {
// NixOS jobs get routed to all builders, even though darwin
// cannot build them.
return self.actions().nasty_hack_linux_only(&job);
}
let refpath = co.checkout_origin_ref(target_branch.as_ref()).unwrap(); let refpath = co.checkout_origin_ref(target_branch.as_ref()).unwrap();
co.fetch_pr(job.pr.number).unwrap(); co.fetch_pr(job.pr.number).unwrap();
@ -81,7 +93,7 @@ impl worker::SimpleWorker for BuildWorker {
let success: bool; let success: bool;
let reader: BufReader<File>; let reader: BufReader<File>;
match self.nix.safely_build_attrs(refpath.as_ref(), match self.nix.safely_build_attrs(refpath.as_ref(),
"./default.nix", buildfile,
job.attrs.clone()) { job.attrs.clone()) {
Ok(r) => { Ok(r) => {
success = true; success = true;