microsoft/openvmm
Publicmirrored fromhttps://github.com/microsoft/openvmmAvailable
flowey/flowey_hvlite/src/pipelines/mod.rs
66lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. |
| 2 | // Licensed under the MIT License. |
| 3 | |
| 4 | use flowey::pipeline::prelude::*; |
| 5 | use restore_packages::RestorePackagesCli; |
| 6 | use vmm_tests::VmmTestsCli; |
| 7 | |
| 8 | pub mod build_docs; |
| 9 | pub mod build_igvm; |
| 10 | pub mod checkin_gates; |
| 11 | pub mod custom_vmfirmwareigvm_dll; |
| 12 | pub mod restore_packages; |
| 13 | pub mod vmm_tests; |
| 14 | |
| 15 | #[derive(clap::Subcommand)] |
| 16 | #[cfg_attr(windows, expect(clippy::large_enum_variant))] |
| 17 | pub enum OpenvmmPipelines { |
| 18 | /// Alias for root-level `regen` command. |
| 19 | // DEVNOTE: this enables the useful `cargo xflowey regen` alias |
| 20 | Regen { |
| 21 | #[arg(trailing_var_arg = true, allow_hyphen_values = true, hide = true)] |
| 22 | args: Vec<String>, |
| 23 | }, |
| 24 | |
| 25 | BuildIgvm(build_igvm::BuildIgvmCli), |
| 26 | CustomVmfirmwareigvmDll(custom_vmfirmwareigvm_dll::CustomVmfirmwareigvmDllCli), |
| 27 | |
| 28 | /// Flowey pipelines primarily designed to run in CI. |
| 29 | #[clap(subcommand)] |
| 30 | Ci(OpenvmmPipelinesCi), |
| 31 | |
| 32 | /// Install tools needed to build OpenVMM |
| 33 | RestorePackages(RestorePackagesCli), |
| 34 | |
| 35 | /// Build and run VMM tests |
| 36 | VmmTests(VmmTestsCli), |
| 37 | } |
| 38 | |
| 39 | #[derive(clap::Subcommand)] |
| 40 | pub enum OpenvmmPipelinesCi { |
| 41 | CheckinGates(checkin_gates::CheckinGatesCli), |
| 42 | BuildDocs(build_docs::BuildDocsCli), |
| 43 | } |
| 44 | |
| 45 | impl IntoPipeline for OpenvmmPipelines { |
| 46 | fn into_pipeline(self, pipeline_hint: PipelineBackendHint) -> anyhow::Result<Pipeline> { |
| 47 | match self { |
| 48 | OpenvmmPipelines::Regen { args } => { |
| 49 | let status = std::process::Command::new("cargo") |
| 50 | .args(["run", "-p", "flowey_hvlite", "--", "regen"]) |
| 51 | .args(args) |
| 52 | .spawn()? |
| 53 | .wait()?; |
| 54 | std::process::exit(status.code().unwrap_or(-1)); |
| 55 | } |
| 56 | OpenvmmPipelines::BuildIgvm(cmd) => cmd.into_pipeline(pipeline_hint), |
| 57 | OpenvmmPipelines::CustomVmfirmwareigvmDll(cmd) => cmd.into_pipeline(pipeline_hint), |
| 58 | OpenvmmPipelines::Ci(cmd) => match cmd { |
| 59 | OpenvmmPipelinesCi::CheckinGates(cmd) => cmd.into_pipeline(pipeline_hint), |
| 60 | OpenvmmPipelinesCi::BuildDocs(cmd) => cmd.into_pipeline(pipeline_hint), |
| 61 | }, |
| 62 | OpenvmmPipelines::RestorePackages(cmd) => cmd.into_pipeline(pipeline_hint), |
| 63 | OpenvmmPipelines::VmmTests(cmd) => cmd.into_pipeline(pipeline_hint), |
| 64 | } |
| 65 | } |
| 66 | } |
| 67 | |