astro-run 0.1.0

A highly customizable workflow orchestrator
Documentation

Astro run

Astro Run is a highly extensible runner that can execute any workflow.

astro-run codecov MIT

Features

Example

Dependencies

Add the following to your Cargo.toml file:

[dependencies]
astro-run = "0.1"

Code Example

use astro_run::{stream, AstroRun, Context, RunResult, Workflow};

// Custom Runner
struct Runner {}

impl Runner {
    fn new() -> Self {
        Runner {}
    }
}

impl astro_run::Runner for Runner {
    fn run(&self, ctx: Context) -> astro_run::RunResponse {
        let (tx, rx) = stream();

        // Send runtime logs
        tx.log(ctx.command.run);

        // Send run result
        tx.end(RunResult::Succeeded);

        Ok(rx)
    }
}

#[tokio::main]
async fn main() {
    // Create Astro Run
    let astro_run = AstroRun::builder().runner(Runner::new()).build();

    // Workflow Configuration
    let workflow = r#"
jobs:
  job:
    name: Job
    steps:
      - run: Hello World
  "#;

    // Create Workflow
    let workflow = Workflow::builder()
        .event(astro_run::WorkflowEvent::default())
        .config(workflow)
        .build(&astro_run)
        .unwrap();

    // Create a new execution context
    let ctx = astro_run.execution_context();

    // Run the workflow
    let _res = workflow.run(ctx).await;
}

Astro Run only defines the interface for Runners. Users can implement their own desired Runners, e.g., Docker runner.

More Examples

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests to improve the project.

License

This project is licensed under the MIT License.