Skip to content

mostlymaxi/cargo-athena

Repository files navigation

cargo-athena

clippy test e2e crates.io docs.rs

Compile regular Rust into Argo Workflow YAML.

use cargo_athena::{workflow, container};

#[workflow]
fn pipeline() {
    let raw = fetch("https://example.com/data".to_string());
    let clean = transform(raw, 3);
    publish(clean);
}

#[container(image = "ghcr.io/acme/app:latest")]
fn transform(data: String, factor: i64) -> String {
    format!("{data} x{factor}")          // this runs in the pod
}

fn main() { cargo_athena::entrypoint!(pipeline); }

That #[workflow] becomes one Argo WorkflowTemplate per function, wired by data dependencies. cargo athena publish cross-compiles your crate as a static-musl binary and uploads it to S3; an injected bootstrap fetches the right arch in-pod and runs the matching function. Workflows compose across modules and crates; you never write or generate YAML.

Install

cargo add cargo-athena --no-default-features   # the library
cargo install cargo-athena                     # the `cargo athena` CLI

# …or via Nix:
nix profile install github:mostlymaxi/cargo-athena
nix run github:mostlymaxi/cargo-athena -- athena …

Important

Library users: keep default-features = false. A workflow crate needs only the proc macros + runtime; the default cli feature pulls a heavy CLI tree (kube, reqwest, tokio, …) it doesn't use.

Docs

📖 Full documentation covers getting started, core concepts, the cookbook, and troubleshooting.

The complete macro reference lives on docs.rs and in this repo as WORKFLOW.md and CONTAINER.md.

Supported Argo Workflows

Every push to main submits the examples/e2e workflow to a real Argo + MinIO per version and asserts it Succeeded. These badges are that live result:

Argo Support e2e
v4.0.5 maintained (latest minor)
v3.7.14 maintained (n‑1 minor)
v3.6.19 minimum supported (EOL)

Argo ≤ 3.5 is unsupported (cross-templateRef output resolution was fixed in 3.6); older versions may still work for trivial cases, use at your own risk.

Contributing

nix develop            # toolchain + zig/cargo-zigbuild + kubectl/argo/mc
cargo test --workspace # unit + golden + trybuild compile-fail
nix build              # -> ./result/bin/cargo-athena

# full e2e on real kind + Argo + MinIO (needs a Docker/Podman daemon):
scripts/deploy.sh && scripts/e2e-test.sh && scripts/teardown.sh

The dev shell pulls a prebuilt Rust toolchain from nix-community.cachix.org (fenix). Trusted Nix users get this automatically; otherwise pass --accept-flake-config.

License

Licensed under either of Apache License 2.0 or MIT, at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above without any additional terms or conditions.

Packages

 
 
 

Contributors