A Rust DSL for Tangled workflows

Files
README.md

tangled-workflow #

A Rust eDSL for defining Tangled workflows.

Usage #

use tangled_workflow::{Constraint, Event, Microvm, Step, Workflow};

let workflow = Workflow::new(
    Microvm::new()
        .image("nixos")
        .dependencies(["cargo", "rustc", "clippy"]),
)
.when(Constraint::event([Event::Push, Event::PullRequest]).branch(["main"]))
.step(Step::run("Clippy", "cargo clippy --all-targets -- -D warnings"))
.step(Step::run("Test", "cargo test --all"));

println!("{}", workflow.to_yaml()?);

This emits YAML suitable for .tangled/workflows/:

when:
  - event:
      - push
      - pull_request
    branch:
      - main
engine: microvm
image: nixos
dependencies:
  - cargo
  - rustc
  - clippy
steps:
  - name: Clippy
    command: cargo clippy --all-targets -- -D warnings
  - name: Test
    command: cargo test --all