Skip to main content

CiWorkflow

Struct CiWorkflow 

Source
pub struct CiWorkflow { /* private fields */ }
Expand description

A workflow under construction. See the module docs for the shape.

Implementations§

Source§

impl CiWorkflow

Source

pub fn engine(self, engine: impl Into<String>) -> Self

Override the engine (nixery by default).

Source

pub fn on_push<I, S>(self, branches: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Add a push trigger for the given branches.

Source

pub fn on_pull_request<I, S>(self, branches: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Add a pull_request trigger targeting the given branches.

Source

pub fn deps<I, S>(self, packages: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Add nixpkgs dependencies — the toolchain the steps run against.

Source

pub fn deps_from<I, S>(self, registry: impl Into<String>, packages: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Add dependencies from a custom registry (a flake reference).

Source

pub fn env(self, key: impl Into<String>, value: impl Into<String>) -> Self

Set a workflow-level environment variable.

Source

pub fn step(self, name: impl Into<String>, command: impl Into<String>) -> Self

Append a step. Steps run serially, in one VM, from the workspace root.

Source

pub fn step_env( self, name: impl Into<String>, command: impl Into<String>, env: impl IntoIterator<Item = (String, String)>, ) -> Self

Append a step with step-scoped environment variables.

Source

pub fn clone_depth(self, depth: u32) -> Self

Set the clone depth (default 1).

Source

pub fn skip_clone(self) -> Self

Skip the checkout entirely.

Source

pub fn file_name(&self) -> String

The file name CiWorkflow::save writes: <name>.yml.

Source

pub fn yaml(&self) -> String

Render the workflow file.

Scalars are emitted as JSON strings — valid YAML by construction — and commands as literal blocks when safe, so the SDK needs no YAML dependency.

Source

pub fn save(&self, repo: impl AsRef<Path>) -> Result<PathBuf>

Write the workflow into <repo>/.tangled/workflows/, where spindle and bsdkrun ci both discover it. Returns the path.

Source

pub fn run(&self) -> Result<()>

Execute the workflow in a microVM against the current directory, streaming output. The YAML never touches the repository — it goes to a temp file and bsdkrun ci run -f.

Source

pub fn run_in<P: AsRef<Path>>(&self, dir: Option<P>) -> Result<()>

CiWorkflow::run against an explicit repository directory.

Trait Implementations§

Source§

impl Clone for CiWorkflow

Source§

fn clone(&self) -> CiWorkflow

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CiWorkflow

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V