Skip to content

Commit

Permalink
Fix execution in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ggiraldez committed Jul 11, 2024
1 parent fd8e095 commit 0eaa7d0
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions crates/solidity/outputs/cargo/tests/src/bindings_output/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use anyhow::Result;
use ariadne::{Color, Config, Label, Report, ReportBuilder, ReportKind, Source};
use infra_utils::cargo::CargoWorkspace;
use infra_utils::codegen::CodegenFileSystem;
use infra_utils::github::GitHub;
use infra_utils::paths::PathExtensions;
use metaslang_bindings::builder;
use metaslang_graph_builder::ast::File;
Expand Down Expand Up @@ -39,16 +40,21 @@ pub fn run(group_name: &str, test_name: &str) -> Result<()> {

let parse_output = language.parse(Language::ROOT_KIND, &source);

let graph_output = output_graph(version, &parse_output)?;
match last_graph_output {
Some(ref last) if last == &graph_output => (),
_ => {
let snapshot_path = test_dir.join("generated").join(format!("{version}.mmd"));

fs.write_file(snapshot_path, &graph_output)?;
last_graph_output = Some(graph_output);
}
};
if !GitHub::is_running_in_ci() {
// Don't run this in CI, since the graph outputs are not committed
// to the repository and hence we cannot verify their contents,
// which is what `fs.write_file` does in CI.
let graph_output = output_graph(version, &parse_output)?;
match last_graph_output {
Some(ref last) if last == &graph_output => (),
_ => {
let snapshot_path = test_dir.join("generated").join(format!("{version}.mmd"));

fs.write_file(snapshot_path, &graph_output)?;
last_graph_output = Some(graph_output);
}
};
}

let bindings_output = output_bindings(version, &parse_output, &source, &input_path)?;
match last_bindings_output {
Expand Down

0 comments on commit 0eaa7d0

Please sign in to comment.