use std::path::{Path, PathBuf}; use xshell::{cmd, Shell}; fn main() -> eyre::Result<()> { // create a new shell in this folder let sh = prepare_shell()?; // build the `dora` binary (you can skip this if you use `cargo install dora-cli`) let dora = prepare_dora_optimized(&sh)?; // build the dataflow using `dora build` cmd!(sh, "{dora} build dataflow.yml").run()?; // start up the dora daemon and coordinator cmd!(sh, "{dora} up").run()?; // start running the dataflow.yml cmd!(sh, "{dora} start dataflow.yml --attach").run()?; // stop the dora daemon and coordinator again cmd!(sh, "{dora} destroy").run()?; Ok(()) } /// Prepares a shell and set the working directory to the parent folder of this file. /// /// You can use your system shell instead (e.g. `bash`); fn prepare_shell() -> Result { let sh = Shell::new()?; let root = Path::new(env!("CARGO_MANIFEST_DIR")); sh.change_dir(root.join(file!()).parent().unwrap()); Ok(sh) } /// Build the `dora` command-line executable from this repo. /// /// You can skip this step and run `cargo install dora-cli --locked` instead. fn prepare_dora_optimized(sh: &Shell) -> eyre::Result { cmd!(sh, "cargo build --package dora-cli --release").run()?; let root = Path::new(env!("CARGO_MANIFEST_DIR")); let dora = root.join("target").join("release").join("dora"); Ok(dora) }