CI workflows defined in code instead of YAML.
The workflow is plain data — a map built up threading-style — and the YAML
emitted from it is exactly the file bsdkrun ci (and tangled's spindle)
consumes: yaml renders it, save! commits it to .tangled/workflows/,
and run! executes it in a microVM without a file ever touching the
repository.
(-> (ci/workflow "test")
(ci/on-push "main")
(ci/deps "clojure" "jdk21")
(ci/env "CI_FROM" "sdk")
(ci/step "deps" "clojure -P")
(ci/step "test" "clojure -X:test")
(ci/run!))
Code is the source of truth and YAML the wire format, in that order — which
is why save! writes a generated-file header: a hand-edit there will be
overwritten by the next save.
CI workflows defined in code instead of YAML.
The workflow is plain data — a map built up threading-style — and the YAML
emitted from it is exactly the file `bsdkrun ci` (and tangled's spindle)
consumes: `yaml` renders it, `save!` commits it to `.tangled/workflows/`,
and `run!` executes it in a microVM without a file ever touching the
repository.
(-> (ci/workflow "test")
(ci/on-push "main")
(ci/deps "clojure" "jdk21")
(ci/env "CI_FROM" "sdk")
(ci/step "deps" "clojure -P")
(ci/step "test" "clojure -X:test")
(ci/run!))
Code is the source of truth and YAML the wire format, in that order — which
is why `save!` writes a generated-file header: a hand-edit there will be
overwritten by the next save.(clone-depth wf depth)Set the clone depth (default 1).
Set the clone depth (default 1).
(deps wf & packages)Add nixpkgs dependencies — the toolchain the steps run against.
Add nixpkgs dependencies — the toolchain the steps run against.
(deps-from wf registry & packages)Add dependencies from a custom registry (a flake reference).
Add dependencies from a custom registry (a flake reference).
(engine wf engine)Override the engine (nixery by default).
Override the engine (`nixery` by default).
(env wf k v)Set a workflow-level environment variable.
Set a workflow-level environment variable.
(file-name {:keys [name]})The workflow file name save! writes: <name>.yml.
The workflow file name `save!` writes: `<name>.yml`.
(on-pull-request wf & branches)Add a pull_request trigger targeting the given branches.
Add a pull_request trigger targeting the given branches.
(on-push wf & branches)Add a push trigger for the given branches.
Add a push trigger for the given branches.
(run! wf)(run! wf {:keys [dir]})Execute the workflow in a microVM, streaming output. The YAML never
touches the repository — it goes to a temp file and bsdkrun ci run -f.
Returns true when every step passed; throws when the run fails.
Options: :dir — the repository to run against (default: cwd).
Execute the workflow in a microVM, streaming output. The YAML never touches the repository — it goes to a temp file and `bsdkrun ci run -f`. Returns true when every step passed; throws when the run fails. Options: `:dir` — the repository to run against (default: cwd).
(save! wf repo)Write into <repo>/.tangled/workflows/ and return the path.
Write into `<repo>/.tangled/workflows/` and return the path.
(skip-clone wf)Skip the checkout entirely.
Skip the checkout entirely.
(step wf name command)(step wf name command step-env)Append a step; steps run serially in one VM, from the workspace root. An optional trailing map sets step-scoped environment variables.
Append a step; steps run serially in one VM, from the workspace root. An optional trailing map sets step-scoped environment variables.
(workflow name)Start a CI workflow definition.
Start a CI workflow definition.
(yaml wf)Render the workflow file. Scalars are emitted as JSON strings — valid YAML by construction — and commands as literal blocks when safe.
Render the workflow file. Scalars are emitted as JSON strings — valid YAML by construction — and commands as literal blocks when safe.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |