Sykli Rust SDK
CI pipelines defined in Rust instead of YAML.
use Pipeline;
Installation
Add to your Cargo.toml:
[]
= "0.2"
[[]]
= "sykli"
= "src/bin/sykli.rs"
For optional dependency (recommended for libraries):
[]
= ["dep:sykli"]
[]
= { = "0.2", = true }
[[]]
= "sykli"
= "src/bin/sykli.rs"
= ["sykli"]
Quick Start
Create src/bin/sykli.rs:
use Pipeline;
Create an empty sykli.rs in your project root:
Run:
Core Concepts
Tasks
Tasks are the basic unit of work:
p.task.run;
Dependencies
Define execution order with .after():
p.task
.run
.after; // Runs after both complete
Independent tasks run in parallel automatically.
Input-Based Caching
Skip unchanged tasks with .inputs():
p.task
.run
.inputs;
Outputs
Declare task outputs for artifact passing:
p.task
.run
.output;
Conditional Execution
Run tasks based on branch, tag, or event:
// String-based conditions
p.task
.run
.when;
// Type-safe conditions (compile-time checked)
use ;
p.task
.run
.when_cond;
Templates
Templates eliminate repetition:
let src = p.dir;
let cache = p.cache;
// Define template
let rust = p.template
.container
.mount
.mount_cache
.workdir;
// Tasks inherit from template
p.task.from.run;
p.task.from.run;
p.task.from.run;
Containers
Run tasks in isolated containers:
let src = p.dir;
let registry_cache = p.cache;
let target_cache = p.cache;
p.task
.container
.mount
.mount_cache
.mount_cache
.workdir
.run;
Convenience Methods
// Mount current dir to /work
p.task
.container
.mount_cwd
.run;
// Mount to custom path
p.task
.container
.mount_cwd_at
.run;
Composition
Parallel Groups
let checks = p.parallel;
// Build depends on all checks
p.task
.run
.after_group;
Chains
let test = p.task.run;
let build = p.task.run;
let deploy = p.task.run;
// test -> build -> deploy
p.chain;
Artifact Passing
p.task
.run
.output;
// Automatically depends on "build"
p.task
.run
.input_from;
Matrix Builds
// Test across Rust versions
p.matrix;
// Deploy to environments
p.matrix_map;
Service Containers
p.task
.container
.mount_cwd
.service
.service
.env
.env
.run
.timeout;
Secrets
// Simple secret
p.task
.secret
.run;
// Typed secrets with explicit source
use ;
p.task
.secret_from
.secret_from
.secret_from
.run;
Retry & Timeout
p.task
.run
.retry // Retry up to 3 times
.timeout; // 5 minute timeout
Kubernetes Execution
use ;
// Pipeline-level defaults
let mut p = new_with_k8s_defaults;
// Task-specific K8s settings
p.task
.container
.run
.k8s;
// Hybrid: local + k8s
p.task.run.target;
p.task.run.target;
Language Presets
let mut p = new;
// Rust preset
p.rust.test; // cargo test
p.rust.lint; // cargo clippy
p.rust.build.after;
p.emit;
Dry Run / Explain
use ExplainContext;
p.explain;
// Output shows execution order and skipped tasks
Examples
See the examples directory for complete working examples:
01-basic/- Tasks, dependencies, parallel execution02-caching/- Input-based caching and conditions03-containers/- Container execution with mounts04-templates/- DRY configuration with templates05-composition/- Parallel groups, chains, artifacts06-matrix/- Matrix builds, services, secrets
API Reference
See REFERENCE.md for the complete API documentation.
License
MIT