Skip to content

Commit

Permalink
Don't upload source files until the build succeeds or fails
Browse files Browse the repository at this point in the history
  • Loading branch information
jyn514 authored and Joshua Nelson committed Aug 7, 2020
1 parent 2809259 commit d23882c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/docbuilder/rustwide_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,6 @@ impl RustwideBuilder {
other_targets,
} = metadata.targets();

// Store the sources even if the build fails
debug!("adding sources into database");
let prefix = format!("sources/{}/{}", name, version);
let (files_list, mut algs) =
add_path_into_database(&self.storage, &prefix, build.host_source_dir())?;

// Perform an initial build
let res = self.execute_build(default_target, true, &build, &limits, &metadata)?;
if res.result.successful {
Expand All @@ -371,6 +365,7 @@ impl RustwideBuilder {
}
}

let mut algs = HashSet::new();
if has_docs {
debug!("adding documentation for the default target to the database");
self.copy_docs(&build.host_target_dir(), local_storage.path(), "", true)?;
Expand All @@ -394,6 +389,13 @@ impl RustwideBuilder {
algs.extend(new_algs);
};

// Store the sources even if the build fails
debug!("adding sources into database");
let prefix = format!("sources/{}/{}", name, version);
let (files_list, new_algs) =
add_path_into_database(&self.storage, &prefix, build.host_source_dir())?;
algs.extend(new_algs);

let has_examples = build.host_source_dir().join("examples").is_dir();
if res.result.successful {
crate::web::metrics::SUCCESSFUL_BUILDS.inc();
Expand Down

0 comments on commit d23882c

Please sign in to comment.