Skip to content
Edit this page

012: CI/CD and Tooling

  • Type: Operational
  • Status: Accepted
  • Date: 2026-12-02
  • Author(s) / Deciders: João V. Farias
  • Question: What formatting tools, static analysis gates, CI workflows, and release pipelines enforce repository standards?

Context

Consistent automated checks prevent formatting drift, compiler warnings, broken documentation links, and unverified release archives from merging into master. Rust code and Zensical documentation run the same checks locally and in GitHub Actions.

Static analysis and code formatting

Repository checks enforce uniform formatting and zero-warning compilation across every Rust target and documentation file:

  • rustfmt validates all Rust source files via cargo fmt --all -- --check with default project formatting rules.
  • Markdown documentation follows 003: Writing Style and builds cleanly via zensical build --clean inside documentation/.
  • clippy runs in strict mode across library, binary, and test crates via cargo clippy --all-targets -- -D warnings, paired with unsafe_code = "forbid" in Cargo.toml.

CI quality gate pipeline

GitHub Actions (.github/workflows/ci.yml) executes two jobs (validate-docs and validate-code) on pushes and pull requests targeting master or main:

flowchart LR
    Fmt["1. cargo fmt --check"] --> Clippy["2. cargo clippy -D warnings"]
    Clippy --> Test["3. cargo test --all-targets"]
    Test --> Build["4. cargo build --release"]
    Build --> Docs["5. zensical build --clean"]

The five verification stages run these checks:

  1. Format checking ensures all Rust files match rustfmt with no diffs.
  2. Static analysis rejects any rustc or clippy warning across library and test targets.
  3. Automated tests execute unit and integration suites (cargo test --all-targets).
  4. Release builds compile the optimized binary (cargo build --release).
  5. Documentation checks regenerate metrics snippets via .github/scripts/update_metrics.py and run zensical build --clean.

Release and deployment workflows

Three additional workflows under .github/workflows/ automate binary packaging, site publishing, and project metrics:

  1. Tagging a release (v*) triggers .github/workflows/release.yml, which compiles optimized binaries for x86_64-unknown-linux-gnu and static x86_64-unknown-linux-musl. It packages each binary with LICENSE, COPYING.EXCEPTION, and README.md into .tar.gz archives alongside .sha256 files and SHA256SUMS.txt on GitHub Releases.
  2. Pushing to master or main triggers .github/workflows/docs.yml, regenerating metrics snippets and deploying documentation/site to GitHub Pages.
  3. Pushing non-metrics changes to master or main (or manual dispatch) triggers .github/workflows/metrics.yml to commit updated Mermaid snippets under documentation/snippets/management/.

Local workflow parity

Developers and coding agents run identical checks locally via .vscode/tasks.json or direct shell commands (cargo fmt --all -- --check && cargo clippy --all-targets -- -D warnings && cargo test --all-targets and cd documentation && zensical build --clean). Every commit follows Conventional Commits on master.

Alternatives

Running CI checks without building distributable release tarballs would keep workflows simpler, yet forces Linux users without a Rust toolchain to compile winesmith from source. Adding crates.io or AUR auto-publishing upfront adds external credential overhead before the first v0.1.0 tag stabilizes, so those channels wait until after v1.

Decision

Enforce strict zero-warning Rust and Zensical checks in .github/workflows/ci.yml, deploy documentation via docs.yml, refresh repository charts via metrics.yml, and publish x86_64 gnu and static musl archives with SHA-256 checksums via .github/workflows/release.yml on v* tags.

Consequences

Positives

Every commit on master compiles formatted, lint-clean code alongside warning-free static documentation. Linux users can download verified static binaries directly from GitHub Releases without installing Cargo.

Negatives

Maintaining static x86_64-unknown-linux-musl builds constrains dependencies to pure-Rust TLS (rustls) and pure-Rust archive crates rather than dynamically linked C libraries.