Sverka
Compiling

GitLab CI compiler

The `gitlab` target compiles a Sverka **Definition Graph** (from `@sverka/workflow`) into a GitLab CI pipeline — executable steps become jobs, `needs:` edges

The gitlab target compiles a Sverka Definition Graph (from @sverka/workflow) into a GitLab CI pipeline — executable steps become jobs, needs: edges come from declared dependencies, and stages are derived from topological order. Special step kinds lower differently: component steps become include: entries, pipeline-call steps are inlined as namespaced jobs, and child-pipeline steps become trigger jobs.

Only the first root pipeline is emitted — a single .gitlab-ci.yml cannot express multiple pipelines, so additional roots are dropped.

CLI usage

# Print YAML to stdout
sverka compile --target gitlab

# Write pipeline files into a directory
sverka compile --target gitlab --output-dir out/

Generated pipeline shape

Each ShellStep becomes a job with its command in script:; dependency wiring lands in needs:. Stages are computed by topological level — the first level is build, each later level is stage-N:

stages: [build, stage-1]
build:
  stage: build
  script:
    - bun run build
typecheck:
  stage: stage-1
  needs: [build]
  script:
    - bun run typecheck

Triggers come from the pipeline's Entry definitions; step rules map to GitLab rules: (if/when). Declared step secrets map to CI/CD variables.

Public API

import { GitlabTarget, compileGitlab } from "@sverka/compiler";

const result = compileGitlab(graph);
// result.artifacts    — GeneratedArtifact[] (.gitlab-ci.yml)
// result.diagnostics  — capability findings

GitlabTarget implements the Target contract: analyze, lower, emit, compile.

Support levels

LevelMeaning
nativeTarget has a direct 1:1 mapping for this feature
loweredFeature is translated to an equivalent target construct
emulatedFeature is approximated via a combination of target constructs
partialOnly some aspects of the feature are supported
connectorFeature requires a plugin connector to provide
unsupportedTarget cannot express this feature; produces a diagnostic

GitLab capability manifest

CapabilitySupport
trigger.pushnative
trigger.changeRequestnative
trigger.manualnative
runtime.hostnative
runtime.containernative
operation.shellnative
operation.importlowered
output.scalarlowered
output.artifactnative
graph.dependenciesnative
graph.matrixnative
matrix.includelowered
matrix.excludeemulated
matrix.failFastunsupported
matrix.maxParallelunsupported
trigger.schedulenative
step.beforeScriptnative
step.afterScriptnative
step.continueOnErrornative
policy.retrynative
execution.workdiremulated
execution.shellunsupported
environment.variablesnative
secrets.runtimenative
secrets.pipeline-inputnative
concurrency.interruptiblenative
environment.permissionsunsupported
runner.selectionnative
runner.groupunsupported
secrets.oidcnative
secrets.oidc.multiAudiencenative
workflow.rulesnative
workflow.rules.changesnative
workflow.rules.existsnative
workflow.defaultsnative
workflow.defaults.shellunsupported
workflow.defaults.workdirunsupported
workflow.defaults.envunsupported
workflow.defaults.beforeScriptnative
workflow.defaults.afterScriptnative
workflow.defaults.timeoutnative
workflow.defaults.retrynative
workflow.defaults.interruptiblenative
workflow.inputsnative
workflow.inputs.choicenative
workflow.inputs.arraynative
workflow.inputs.patternnative
environment.servicesnative
environment.services.portsunsupported
deployment.environmentnative
deployment.environment.actionnative
deployment.environment.tiernative
artifact.retentionnative
artifact.accessnative
cachenative
cache.policynative
cache.fallbackKeysnative
concurrency.groupnative
concurrency.cancelInProgressunsupported
reusable.pipelinelowered
reusable.pipeline.inputsnative
reusable.pipeline.outputsnative
reusable.componentnative
reusable.component.versioningnative
reusable.childPipelinenative
reusable.downstreamnative
deployment.releasenative
deployment.pagesnative
import.gitlabnative
import.includenative
scheduling.delaynative
execution.backgroundemulated

On this page