Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Automation & Verification Pipelines

Kroki-rs uses a multi-tier pipeline designed for extreme speed and absolute reproducibility across both local and remote environments.

1. The 4-Tier Pipeline

TierWorkflowPurpose
Tier 1: Identitybase-image.ymlMasters the Docker fingerprints. Built on-demand when Dockerfile changes.
Tier 2: Verificationci-build.yml3-phase pipeline: Prep -> Build -> Verify (concurrent checks).
Tier 3: Distributionrelease.ymlMulti-arch native binaries and GitHub Releases on version tags.
Tier 4: Packagingpublish-packages.ymlProduction OCI image build, smoke testing, and GHCR publish.

Image Separation

ImageGHCR PackageVisibilityContents
CIkroki-rs-ciPrivateBase + Rust toolchain, sccache, nextest, MyST (mystmd)
Basekroki-rs-basePrivateSystem deps (Graphviz, D2, Ditaa, Chromium)
Productionkroki-rsPublicBase + compiled binary only (minimal runtime)

CI and Base images are internal infrastructure. Only the production kroki-rs image is published for end users.

2. Verification Flow (CI-Build)

We utilize a “Compile Once, Verify Concurrent” strategy to maximize GitHub Actions runner efficiency while maintaining fine-grained PR check visibility.

Workflow Sequence (3-Job Pipeline)

The Verify job runs all checks concurrently as background processes within a single container instance, using gh-check-wrapper.sh to report each as a separate PR commit status. This avoids the overhead of pulling the CI image multiple times while still providing fine-grained failure visibility.

PR Status Checks

Branch protection requires these four commit statuses (created by gh-check-wrapper.sh):

Status ContextCommand
fmtcargo fmt --all -- --check
clippycargo clippy --release --all-targets --features native-browser -- -D warnings
test./dflow ci-verify test-ci (nextest)
smoke-test./dflow ci-verify smoke-test && ./dflow ci-verify verify

3. Local Reproducibility (repro-ci.sh)

Developers can run the exact CI sequence locally using ./dflow ci-verify.

Absolute Remote Truth & Skip Logic

To maximize efficiency and maintain environment parity:

Disk-Based sccache

To avoid 400 errors from GHA proxies inside containers, we standardized on a Disk-Based Cache.

Build Job Pre-warming (build-ci Target)

The Build job runs the build-ci make target (cargo build --release --all-targets) inside the fingerprinted CI container. This compiles all targets (application, libraries, and test suites) without running clippy -- linting runs separately in the Verify job for clear PR status. The Verify job restores the warm cache read-only, typically resulting in <30s execution times for all checks combined.

The cache key cargo-<runner.os>-<Cargo.lock+rust-toolchain hash> enables cross-run reuse: unchanged dependencies and toolchain produce an exact cache hit, avoiding recompilation entirely.

Target Isolation (target/ci)

Containerized builds exclusively use target/ci to avoid binary clobbering with host-native target/ directories (e.g., macOS binaries on Linux containers).

4. Distribution Flow (Release + Publish)

Release Pipeline (release.yml)

Triggered on version tags (v*), this workflow:

  1. Fingerprint: Resolves the CI image for container-based Linux builds

  2. Build: Compiles native binaries for 3 platforms (macOS ARM64, Linux AMD64, Linux ARM64)

  3. Publish: Creates a GitHub Release with tarballs and SHA256 checksums

  4. Pages: Deploys Rustdoc + MyST documentation to GitHub Pages

Package Publishing (publish-packages.yml)

Triggered on successful completion of release.yml, this workflow:

  1. Build: Creates the production Docker image (Dockerfile final stage) for linux/amd64 and linux/arm64

  2. Smoke Test: Starts the container and verifies health + diagram rendering endpoints

  3. Push: Publishes to GHCR as ghcr.io/softmentor/kroki-rs:<version> and latest

Future enhancements (scaffolded as placeholders):

Image Traceability

Every published production image carries OCI labels linking it back to the source:

LabelValue
org.opencontainers.image.versionGit tag (e.g., 0.0.8)
org.opencontainers.image.revisionGit SHA
org.opencontainers.image.sourceRepository URL
org.opencontainers.image.createdBuild timestamp

5. Remote Cache Maintenance

To prevent GitHub Actions storage bloat and ensure fast restorations, we utilize a capacity-aware cache pruning strategy.

GitHub Run Pruning

To prevent GitHub Actions run history from becoming cluttered, we use src-scripts/gh-tasks/prune-gha-runs.sh.

Cache Key Strategy

Cache TypeKey PatternInvalidation Trigger
Cargocargo-<OS>-<hash(Cargo.lock, rust-toolchain.toml)>Dependency or toolchain change
Docker Image Tardocker-ci-<hash(Dockerfile)>Dockerfile change
BuildKit Layersbuildkit-blob-*Base image rebuild

6. Internal CI Actions

While developers primarily interact with dflow, the GitHub Actions infrastructure relies on internal composite actions to maintain environmental sanity across different runner types.

setup-kroki (Native Environment Bridge)

The .github/actions/setup-kroki action is the primary bridge for non-containerized jobs (macOS runners and Documentation deployments).

Role: Standardizes the installation of system dependencies (Cairo, Pango, Graphviz) and toolchains across different OS runners (Ubuntu vs. macOS).

Inputs

InputDescriptionDefault
rust-targetsAdditional Rust targets to install.""
node-versionVersion of Node.js to install.22
install-nodeWhether to install Node.js and run npm ci.false
install-nextestWhether to install cargo-nextest.true
use-cacheWhether to enable standard Rust caching.true

Hybrid Logic

7. Troubleshooting

Container Engine Failures

If ./dflow ci-verify fails with “Container engine is not responsive” or “connection refused”:

GHCR Pull Errors

If the CI image cannot be pulled:

Version / Toolchain Mismatches

If repro-ci.sh reports a “Toolchain Mismatch”:

8. Release Verification Reports

For every official release, a detailed verification report is generated to prove the integrity of the artifacts.