facett-cicd/examples/cicd_panel.rs
//! **cicd_panel** — the [`facett_cicd`] CI/CD forge view mounted on the reusable
//! [`facett_wasm_demo`] host: the [`CicdPanel::demo`] forge (three pipelines — a
//! green `nornir-ci`, a live-running `facett-pages`, a red `skidbladnir-release`,
//! each with a run history, per-stage breakdown, and live-run log tail) rendered as
//! a **native window** and a **wasm / WebGL canvas** from the same source, ready for
//! a Codeberg-Pages site (the harness recipe in `facett-demo/README.md`). Click a
//! pipeline to open its runs; click a run to see its stages + log tail.
//!
//! - native: `cargo run -p facett-cicd --example cicd_panel`
//! - wasm: `cargo build -p facett-cicd --example cicd_panel --target wasm32-unknown-unknown`
//! then `wasm-bindgen … --target web` it and serve with the generated
//! `index.html` ([`facett_wasm_demo::IndexHtml`]).
use facett_cicd::CicdPanel;
use facett_wasm_demo::FacetApp;
/// The panel's fixture: the built-in demo forge.
fn panel() -> CicdPanel {
CicdPanel::demo()
}
// ── native host ──────────────────────────────────────────────────────────────
#[cfg(not(target_arch = "wasm32"))]
fn main() -> eframe::Result<()> {
facett_wasm_demo::NativeDemo::new("facett-cicd — CI/CD forge demo")
.run(move |_cc| FacetApp::boxed(Box::new(panel())))
}
// On wasm the entry point is `start` (below); `main` still has to exist to link.
#[cfg(target_arch = "wasm32")]
fn main() {}
// ── web host ─────────────────────────────────────────────────────────────────
#[cfg(target_arch = "wasm32")]
#[wasm_bindgen::prelude::wasm_bindgen(start)]
pub fn start() {
facett_wasm_demo::WebDemo::new("demo_canvas").mount(move |_cc, _hash| FacetApp::boxed(Box::new(panel())));
}
/// The browser-readable state hook: `window.__cicd_state()` returns the forge's live
/// `state_json` (roster/summary/selection/resolved-run), so a headless drive verifies
/// the shipped bundle without a human.
#[cfg(target_arch = "wasm32")]
#[wasm_bindgen::prelude::wasm_bindgen(js_name = __cicd_state)]
pub fn cicd_state() -> String {
facett_wasm_demo::latest_state()
}