Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

//! Build the test-results website using npm.
use flowey::node::prelude::*;

flowey_request! {
pub struct Params {
pub done: WriteVar<SideEffect>,
}
}

new_simple_flow_node!(struct Node);

impl SimpleFlowNode for Node {
type Request = Params;

fn imports(ctx: &mut ImportCtx<'_>) {
ctx.import::<crate::git_checkout_openvmm_repo::Node>();
ctx.import::<crate::install_openvmm_rust_build_essential::Node>();
ctx.import::<flowey_lib_common::install_nodejs::Node>();
}

fn process_request(request: Self::Request, ctx: &mut NodeCtx<'_>) -> anyhow::Result<()> {
let Params { done } = request;

// Make sure that npm is installed
let npm_installed = ctx.reqv(flowey_lib_common::install_nodejs::Request::EnsureInstalled);
let openvmm_repo_path = ctx.reqv(crate::git_checkout_openvmm_repo::req::GetRepoDir);

ctx.emit_rust_step(format!("build test-results website"), |ctx| {
npm_installed.claim(ctx);
done.claim(ctx);
let openvmm_repo_path = openvmm_repo_path.claim(ctx);
move |rt| {
let sh = xshell::Shell::new()?;
let mut path = rt.read(openvmm_repo_path);

// Navigate to the petri/logview_new directory within the
// OpenVMM repo
path.push("petri");
path.push("logview_new");

sh.change_dir(&path);

// Because the project is using vite, the output will go
// directly to the 'dist' folder
xshell::cmd!(sh, "npm install").run()?;
xshell::cmd!(sh, "npm run build").run()?;

Ok(())
}
});

Ok(())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,17 @@ impl SimpleFlowNode for Node {

// New logviewer.
flowey_lib_common::_util::copy_dir_all(
repo.join("petri/logview_new/dist"),
repo.join("petri/logview_new/dist_manual"),
consolidated_html.join("test-results"),
)?;

// Testing CI changes to minimize disruptions to petri site
// availability. Will remove this once CI build changes are in.
flowey_lib_common::_util::copy_dir_all(
repo.join("petri/logview_new/dist"),
consolidated_html.join("test-results-ci"),
)?;

// as we do not currently have any form of "landing page",
// redirect `openvmm.dev` to `openvmm.dev/guide`
fs_err::write(consolidated_html.join("index.html"), REDIRECT)?;
Expand Down
1 change: 1 addition & 0 deletions flowey/flowey_lib_hvlite/src/_jobs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub mod build_and_publish_openhcl_igvm_from_recipe;
pub mod build_and_publish_openvmm_hcl_baseline;
pub mod build_and_run_doc_tests;
pub mod build_and_run_nextest_unit_tests;
pub mod build_test_results_website;
pub mod cfg_common;
pub mod cfg_gh_azure_login;
pub mod cfg_hvlite_reposource;
Expand Down