CI and release freeze
GitHub Action
Section titled “GitHub Action”Check out with full Git history (fetch-depth: 0) so witforge freeze can inspect the history of
wit/released, pin the Action to a release tag or commit SHA, and let the Action run check,
diff, freeze, and every configured generator with --check.
Passing workflow on examples/evolved
Section titled “Passing workflow on examples/evolved”examples/evolved adds defaultable fields in v0.2 (wire-compatible, source-breaking for Rust
struct literals). Setting diff-check: "wire" verifies wire compatibility while allowing the
additive minor evolution; this exact combination passes on examples/evolved:
- uses: actions/checkout@v4 with: fetch-depth: 0- uses: zeropier/witforge@v0.12.0 with: check: examples/evolved/wit/v0.2 against: examples/evolved/wit/v0.1/wire.lock diff-old: examples/evolved/wit/v0.1 diff-new: examples/evolved/wit/v0.2 diff-check: wire config: examples/evolved/witforge.toml generators: rust,proto,schema,glue freeze: "true" # Optional from v0.8.0 (defaults to github.token); pass explicitly on <= v0.7.x. github-token: ${{ github.token }}The Action validates every input before downloading anything, downloads a checksum-verified (and
from 0.7.0, build-provenance-verified) release archive, removes the downloaded archive/checksum
scratch files, leaves witforge on PATH (WITFORGE_BIN), and emits GitHub workflow annotations
(::error file=...,line=...,col=...::...) whenever a check fails.
Failing compatibility gate and SARIF upload
Section titled “Failing compatibility gate and SARIF upload”To fail a pull request on any source-, generated-API-, wire-, or protobuf binary decode break, set
diff-check: "true" (default: wire,source,api) or diff-check: "wire,decode". Set
format: sarif to write a combined SARIF 2.1.0 report and upload it in a separate step:
permissions: contents: read security-events: write
steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - id: witforge uses: zeropier/witforge@v0.12.0 with: check: wit/v0.2 against: wit/v0.1/wire.lock diff-old: wit/v0.1 diff-new: wit/v0.2 diff-check: wire,decode config: witforge.toml generators: rust,proto,schema,glue freeze: "true" format: sarif sarif-file: witforge.sarif # Optional from v0.8.0 (defaults to github.token); pass explicitly on <= v0.7.x. github-token: ${{ github.token }} - if: always() && steps.witforge.outputs.sarif-file != '' uses: github/codeql-action/upload-sarif@v3 with: sarif_file: ${{ steps.witforge.outputs.sarif-file }}Uploading SARIF requires security-events: write and is unavailable to pull requests from forks
with read-only tokens. Workflow annotations require no extra permissions and always appear on pull
request diffs regardless of format.
Version pinning and SHA pins
Section titled “Version pinning and SHA pins”- When
versionis empty and the Action ref is a release tag (@v0.12.0), the Action installs that exact release. - When
versionis empty and the Action ref is a commit SHA, branch, floating tag, or local./, the Action installs the workspace version recorded inCargo.tomlat that exact ref; it never silently falls back tolatest. If that version has no published release assets yet, the step fails and names theversioninput. - Pass
version: latestexplicitly only if you intentionally want floating latest releases. - Pass
binary: path/to/witforgeto skip download and run a locally built executable (cannot be combined withversion).
Action inputs
Section titled “Action inputs”| Input | Default | Description |
|---|---|---|
version |
empty | X.Y.Z, vX.Y.Z, or latest. Empty installs the release tag or the workspace version at the Action’s commit SHA/branch. Cannot be combined with binary. |
binary |
empty | Path to an existing local witforge binary to run instead of downloading a release. Cannot be combined with version. |
check |
empty | WIT version directories or WIT roots to pass to witforge check, one per line, or true (from v0.8.0) to check every project in config. |
against |
empty | Baseline wire.lock path(s) for witforge check --against: a single lockfile path when check lists one directory, or <check-dir>=<baseline-lockfile> lines when check lists multiple directories. Cannot be combined with check: true. |
diff-old |
empty | Old version directory or WIT root for witforge diff (must be paired with diff-new). |
diff-new |
empty | New version directory or WIT root for witforge diff (must be paired with diff-old). |
diff-check |
true |
true (--check, defaults to [project.<name>.policy].diff-check when configured, otherwise wire,source,api), false (report only), or comma-separated views from wire, source, api, decode (--check=<views>). |
config |
empty | Path to witforge.toml for check: true, freeze: true, and configured generators. |
project |
empty | Optional project name in witforge.toml. |
generators |
rust |
Comma- or whitespace-separated subset of built-in generators (rust, proto, schema, glue, doc (from v0.9.0), plus polyglot ts, ts-glue, py, py-glue, go, go-glue, java, java-glue, csharp, csharp-glue (from v0.10.0)) run with --config and --check (individual names, including default rust, require project when config defines multiple projects), or all (from v0.8.0) to run witforge generate --config ... --check across every configured built-in generator and project. Third-party plugins stay strictly opt-in (generators: plugins is refused, and generators: all never passes --allow-plugins). Empty skips generation (pass generators: "" when using config only for check: true or freeze: true). |
freeze |
empty | WIT roots to verify with witforge freeze (one per line), or true to verify every project in config. Requires fetch-depth: 0. |
format |
human |
Output format: human, json, or sarif. Failing checks emit GitHub workflow annotations in all formats. |
sarif-file |
empty | Output file path for the combined SARIF 2.1.0 report when format: sarif is set (defaults to witforge.sarif). |
github-token |
${{ github.token }} (from v0.8.0) |
Token sent only to GitHub API calls (version: latest lookup and gh attestation verify), defaulting to the workflow token from v0.8.0 (pass explicitly on <= v0.7.x) and never sent with asset downloads. |
Action outputs
Section titled “Action outputs”| Output | Description |
|---|---|
failed-command |
Empty on success; names the failing stage (validate, install, sarif, or witforge <subcommand>, such as witforge diff) on failure. |
sarif-file |
Path to the combined SARIF 2.1.0 file when format: sarif was requested. |
Release freeze and diff upgrade notes
Section titled “Release freeze and diff upgrade notes”witforge freeze refuses shallow clones with exit code 2 and names fetch-depth: 0; never skip
it with a shallow checkout. It protects committed WIT contract sources and wire.lock files under
every released directory. Generated per-version modules (such as v0_1.rs) are frozen by
committing the generated copies and verifying them with --check, not by witforge freeze.
Action releases up to and including v0.5.0 ignored diff-old, diff-new, diff-check, and
github-token because they read them under underscore environment names. Fixed in v0.6.0:
workflows already passing diff-old and diff-new begin running witforge diff --check when
moving to v0.6.0 or later; set diff-check: "false" or diff-check: "wire" if source-breaking
additions should not fail the job.
Direct commands
Section titled “Direct commands”witforge freeze --config witforge.tomlwitforge check witwitforge diff wit/v0.1 wit/v0.2 --checkwitforge generate --config witforge.toml --checkRecommended direct CI gates:
witforge freeze --config witforge.toml(withfetch-depth: 0) to verify released history and one-way retirement transitions;witforge check <wit-root>to check every version directory, predecessor lockfile continuity, and the pinned dependency graph;witforge diff --git-base origin/main --check(orwitforge diff old new --check), which uses[project.<name>.policy].diff-checkwhen configured inwitforge.toml(setforbid-unstable-in-release = truein the same policy table to block releasing@unstableitems);witforge deps sync --checkwhen vendoreddeps/are shared across unreleased minors;witforge generate --config witforge.toml --checkto verify every configured built-in generator (Rust, protobuf, JSON Schema, glue, Markdown docs, TypeScript, Python, Go, Java, and C#) has not drifted. Pass--only <gen[,gen...]>to gate a subset of generators, and pass--allow-pluginsexplicitly (or invokewitforge plugin <name> --check) only in workflows that intentionally opt in to running third-party plugins.
Consumer tests
Section titled “Consumer tests”Generated-file checks prove reproducibility, not application behavior. Also compile generated Rust
and polyglot types/glue, compile the emitted protobuf with the consumer’s normal toolchain,
round-trip representative values (including witforge conformance vectors for cross-language
boundaries), and exercise application adapters and defaults.
For a JSON protocol, commit full and minimal fixtures and run them through every language implementation.