flowey_lib_hvlite/_jobs/
build_and_run_doc_tests.rs1use crate::run_cargo_build::common::CommonProfile;
10use flowey::node::prelude::*;
11
12flowey_request! {
13 pub struct Params {
14 pub target: target_lexicon::Triple,
16 pub profile: CommonProfile,
18 pub done: WriteVar<SideEffect>,
19 }
20}
21
22new_simple_flow_node!(struct Node);
23
24impl SimpleFlowNode for Node {
25 type Request = Params;
26
27 fn imports(ctx: &mut ImportCtx<'_>) {
28 ctx.import::<crate::git_checkout_openvmm_repo::Node>();
29 ctx.import::<crate::install_openvmm_rust_build_essential::Node>();
30 }
31
32 fn process_request(request: Self::Request, ctx: &mut NodeCtx<'_>) -> anyhow::Result<()> {
33 let Params {
34 target,
35 profile,
36 done,
37 } = request;
38
39 let rust_installed = ctx.reqv(crate::install_openvmm_rust_build_essential::Request);
40 let openvmm_repo_path = ctx.reqv(crate::git_checkout_openvmm_repo::req::GetRepoDir);
41
42 ctx.emit_rust_step(format!("run doctests for {target}"), |ctx| {
43 done.claim(ctx);
44 rust_installed.claim(ctx);
45 let openvmm_repo_path = openvmm_repo_path.claim(ctx);
46 move |rt| {
47 let target = target.to_string();
48 let profile = match profile {
49 CommonProfile::Release => "release",
50 CommonProfile::Debug => "dev",
51 };
52
53 let path = rt.read(openvmm_repo_path);
54 rt.sh.change_dir(path);
55 flowey::shell_cmd!(rt, "cargo test --locked --doc --workspace --no-fail-fast --target {target} --profile {profile}").run()?;
56
57 Ok(())
58 }
59 });
60
61 Ok(())
62 }
63}