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.

v0.1.0 CI/Container Redesign Proposal

Purpose

Define a reproducible, modular, and cache-efficient developer/CI model for the v0.1.0 refactor so local macOS development and GitHub Actions execute the same verification logic with the same container identity.

Executive Summary

Current-State Evaluation

This repository already has strong foundations:

Primary gaps to address for v0.1.0:

Target Design

1) Canonical Build Identity

2) Unified Cache Contract

Define one configurable cache root:

Local container mounts:

Guidance:

Environment nuance impact:

3) GitHub Actions Cache Layers

Use layered caching, ordered by ROI:

  1. CI image reuse from GHCR by fingerprint.

  2. Optional image tar cache (actions/cache) for fast same-runner restore.

  3. Cargo + sccache cache (registry, git, sccache, target-ci) keyed by:

    • runner.os

    • image fingerprint

    • hash(Cargo.lock, rust-toolchain.toml)

    • cargo feature mode (for example native-browser vs lean)

  4. BuildKit cache for image builds (cache-from/cache-to gha, optionally registry cache manifest).

4) Workflow Modularity and Check Visibility

Single CI workflow file (.github/workflows/ci.yml) for PR/push on main and develop.

Job topology:

All verify jobs:

5) Test Tiering Policy

PR minimal gate:

Push to main/develop full verification:

Implementation note:

6) Local/CI Command Parity

Entrypoints:

Rule:

7) Impact of Multi-Surface Refactor

If Kroki-rs adopts the multi-surface architecture (core/interface/transport/adapters), CI/container strategy should shift from a single-project pipeline to a contract-oriented workspace pipeline.

Changes to consider:

8) Generic Platform Model (Beyond This Repo)

This proposal can be generalized into a reusable CI/dev orchestration model with stack extensions.

Platform core (generic):

Stack extensions (examples):

Principle:

9) Generic CLI Tool Design (Installable via Homebrew)

Proposed tool concept: a standalone Rust CLI named devflow (alias dwf) that abstracts CI/container/caching complexity while preserving local developer UX.

Design goals:

Canonical command interface:

High-level architecture:

Configuration model (example):

[project]
name = "kroki-rs"
stack = ["rust"]

[container]
image = "ghcr.io/org/repo-ci"
fingerprint_inputs = ["Dockerfile", "Makefile", "src-scripts/**", "rust-toolchain.toml"]

[cache]
root = ".cache/devflow"
strategy = "layered"

[targets]
pr = ["fmt", "lint", "build", "test"]
main = ["fmt", "lint", "build", "test", "smoke", "security"]

[extensions.rust]
features = ["native-browser"]
test_runner = "nextest"

CLI capabilities:

Canonical command mapping by stack:

Canonical commandRust stackNode/TypeScript (pnpm)React/Lit frontendVS Code extensionTauri
dwf setuprustup show, toolchain sync, container/image resolvepnpm install --frozen-lockfilepnpm install --frozen-lockfilepnpm install --frozen-lockfileRust + pnpm install + platform deps check
dwf fmtcargo fmt --allpnpm prettier -w . (or repo formatter)pnpm prettier -w .pnpm prettier -w .cargo fmt --all + frontend formatter
dwf fmt-checkcargo fmt --all -- --checkpnpm prettier -c .pnpm prettier -c .pnpm prettier -c .cargo fmt --all -- --check + frontend fmt check
dwf lintcargo clippy --all-targets -- -D warningspnpm eslint . + pnpm tsc --noEmitpnpm eslint . + typecheckpnpm eslint . + extension typecheckRust clippy + frontend eslint/typecheck
dwf buildcargo build --releasepnpm buildpnpm buildpnpm package / extension bundlecargo build --release + frontend build
dwf testcargo nextest runpnpm test (vitest/jest)pnpm testextension host testscargo nextest run + frontend tests
dwf smokeapp health/CLI smoke scriptapp startup + HTTP smokepreview/build smokeinstall/package smokeapp startup/bundle smoke
dwf verifyfmt-check + lint + build + test + smokesame canonical sequence mapped to JS toolchainsame canonical sequencesame canonical sequencesame canonical sequence
dwf ci generategenerate Rust-oriented CI jobs/cache keysgenerate pnpm/node CI jobs/cache keysadd frontend/e2e job templatesadd extension packaging jobsadd OS matrix + bundling/signing jobs

Notes:

Rollout path for this project:

Required Repo Changes

  1. Standardize fingerprint algorithm docs + scripts to one input set.

  2. Introduce KROKI_CACHE_ROOT and replace hardcoded .cargo-cache/target/ci paths in scripts and make fragments.

  3. Add explicit CI-tier targets:

    • fmt-check

    • lint-clippy

    • test-pr

    • test-full

  4. Consolidate CI triggers into one workflow (main, develop) and keep release/package workflows separate.

  5. Add cache key normalization helper (script or make target) reused by both local diagnostics and GHA.

  6. Add CI observability summary:

    • fingerprint used

    • cache hit/miss stats

    • sccache hit ratio per run

  7. Add explicit note in workflow docs that build and all verify-* jobs execute in the fingerprinted CI container.

  8. Add extension points in docs/config for future multi-surface and multi-stack orchestration.

Suggested Implementation Plan (v0.1.0)

Phase 1: Cache Contract and Fingerprint Consistency

Phase 2: CI Job Contract Refactor

Phase 3: Test Tiering + Runtime Optimization

Risks and Mitigations

Decision Notes on Requested Strategies

Success Criteria