Skip to content

Commit

Permalink
Merge pull request #1068 from googlefonts/skip-duplicate-results
Browse files Browse the repository at this point in the history
[crater] Skip writing if results unchanged
  • Loading branch information
cmyr authored Oct 25, 2024
2 parents 96d887d + 617d133 commit 7bd833a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion fontc_crater/src/ci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,11 @@ fn run_crater_and_save_results(args: &CiArgs) -> Result<(), Error> {
.collect();
let finished = Utc::now();

super::try_write_json(&results, &out_path)?;
let summary = super::ttx_diff_runner::Summary::new(&results);
if Some(&summary) == prev_runs.last().map(|run| &run.stats) {
log::info!("output identical to last run, skipping");
return Ok(());
}
let input_file = args
.to_run
.file_name()
Expand All @@ -127,6 +130,7 @@ fn run_crater_and_save_results(args: &CiArgs) -> Result<(), Error> {

prev_runs.push(summary);

super::try_write_json(&results, &out_path)?;
super::try_write_json(&prev_runs, &summary_file)?;

// we write the map of target -> source repo to a separate file because
Expand Down
2 changes: 1 addition & 1 deletion fontc_crater/src/ttx_diff_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub(super) enum DiffOutput {
}

/// Summary of one ttx_diff run
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)]
pub(crate) struct Summary {
pub(crate) total_targets: u32,
pub(crate) identical: u32,
Expand Down

0 comments on commit 7bd833a

Please sign in to comment.