https://github.com/panghu-huang/astro-run
A highly extensible runner that can execute any workflow.
https://github.com/panghu-huang/astro-run
astro-run automation ci docker grpc runner rust workflow
Last synced: 9 months ago
JSON representation
A highly extensible runner that can execute any workflow.
- Host: GitHub
- URL: https://github.com/panghu-huang/astro-run
- Owner: panghu-huang
- License: mit
- Created: 2023-08-03T11:15:36.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-07-20T01:33:56.000Z (almost 2 years ago)
- Last Synced: 2025-09-08T20:28:08.726Z (10 months ago)
- Topics: astro-run, automation, ci, docker, grpc, runner, rust, workflow
- Language: Rust
- Homepage:
- Size: 331 KB
- Stars: 18
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Astro run
Astro Run is a highly extensible runner that can execute any workflow.


[](https://codecov.io/gh/panghu-huang/astro-run)

## Features
- [Workflow runtime for Docker](https://github.com/panghu-huang/astro-run/blob/main/crates/runner)
- Support for [gRPC server](https://github.com/panghu-huang/astro-run/blob/main/crates/server) to coordinate multiple runner clients
- Support for [connecting to remote runners](https://github.com/panghu-huang/astro-run/blob/main/crates/remote-runner)
## Example
### Dependencies
Add the following to your `Cargo.toml` file:
```toml
[dependencies]
astro-run = "0.1"
```
### Code Example
```rust
use astro_run::{stream, AstroRun, RunResult, Workflow};
struct Runner;
impl Runner {
fn new() -> Self {
Runner
}
}
#[astro_run::async_trait]
impl astro_run::Runner for Runner {
async fn run(&self, ctx: astro_run::Context) -> astro_run::RunResponse {
let (tx, rx) = stream();
tokio::task::spawn(async move {
// Send running log
tx.log(ctx.command.run);
// Send success log
tx.end(RunResult::Succeeded);
});
Ok(rx)
}
}
#[tokio::main]
async fn main() {
// Create astro run
let astro_run = AstroRun::builder().runner(Runner::new()).build();
// Workflow
let workflow = r#"
jobs:
job:
name: Job
steps:
- run: Hello World
"#;
// Create workflow
let workflow = Workflow::builder()
.config(workflow)
.build(&astro_run)
.await
.unwrap();
// Create a new execution context
let ctx = astro_run.execution_context().build();
// Run 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](https://github.com/panghu-huang/astro-run/tree/main/crates/runner).
## More Examples
- [Workflow runtime for Docker](https://github.com/panghu-huang/astro-run/blob/main/crates/runner/examples/basic.rs)
- [Astro Run Plugins](https://github.com/panghu-huang/astro-run/blob/main/crates/astro-run/examples/plugins.rs)
- [Astro run gRPC Server](https://github.com/panghu-huang/astro-run/blob/main/crates/server/examples/server.rs)
- [gRPC Runner Client](https://github.com/panghu-huang/astro-run/blob/main/crates/server/examples/client.rs)
- [Remote Runner](https://github.com/panghu-huang/astro-run/blob/main/crates/remote-runner/examples/runner-server.rs)
## 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.