The registry generator: a tested mechanism for minting instances #381
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # GitHub Actions CI workflow for the Product CLI | |
| # Gates PRs on: build, tests, clippy, conventions, supply-chain, benchmarks | |
| # | |
| # This is a Cargo workspace (product-core / product-mcp / product-cli / xtask); | |
| # the binary is named `product` but lives in the `product-cli` package. | |
| name: Product CI | |
| on: | |
| pull_request: | |
| paths: | |
| - 'product-core/**' | |
| - 'product-mcp/**' | |
| - 'product-cli/**' | |
| - 'ddd-core/**' | |
| - 'ddd-lsp/**' | |
| - 'ddd-mcp/**' | |
| - 'ddd-cli/**' | |
| - 'ledger-core/**' | |
| - 'ledger-cli/**' | |
| - '.decisions/**' | |
| - '.ddd/**' | |
| - 'xtask/**' | |
| - 'docs/**' | |
| - 'conventions/**' | |
| - 'Cargo.toml' | |
| - 'Cargo.lock' | |
| - 'deny.toml' | |
| - 'rust-toolchain.toml' | |
| - '.github/workflows/product-ci.yml' | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'product-core/**' | |
| - 'product-mcp/**' | |
| - 'product-cli/**' | |
| - 'ddd-core/**' | |
| - 'ddd-lsp/**' | |
| - 'ddd-mcp/**' | |
| - 'ddd-cli/**' | |
| - 'ledger-core/**' | |
| - 'ledger-cli/**' | |
| - '.decisions/**' | |
| - '.ddd/**' | |
| - 'xtask/**' | |
| - 'docs/**' | |
| - 'conventions/**' | |
| - 'Cargo.toml' | |
| - 'Cargo.lock' | |
| - 'deny.toml' | |
| - 'rust-toolchain.toml' | |
| - '.github/workflows/product-ci.yml' | |
| jobs: | |
| check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| # The contract-surface gate diffs against the PR base, which a | |
| # depth-1 clone does not carry. | |
| fetch-depth: 0 | |
| # Single source of truth for the Rust version is rust-toolchain.toml. | |
| # Parse its channel field and pass it to the action so local builds and | |
| # CI stay in lockstep — bump rust-toolchain.toml and nothing else to | |
| # upgrade the compiler. | |
| - name: Parse toolchain version | |
| id: rust | |
| run: | | |
| version=$(grep '^channel' rust-toolchain.toml | sed 's/.*"\(.*\)".*/\1/') | |
| echo "version=$version" >> "$GITHUB_OUTPUT" | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ steps.rust.outputs.version }} | |
| # rust-analyzer is the ddd Rust adapter's language host; its | |
| # acceptance tests run against the real server rather than a mock | |
| # (dec/ddd/rust-host-is-real). Kept in step with the components | |
| # list in rust-toolchain.toml. | |
| components: rust-analyzer | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Build | |
| run: cargo build --workspace | |
| - name: Tests (all binaries) | |
| # --no-fail-fast runs every test binary (lib, integration, framework, | |
| # property, code_quality) and reports the full result set rather than | |
| # stopping at the first failing binary. Matches the `cargo t` alias | |
| # defined in .cargo/config.toml. | |
| run: cargo test --workspace --no-fail-fast | |
| - name: Clippy | |
| # Zero-unwrap policy (#![deny(clippy::unwrap_used)] across the workspace). | |
| run: cargo clippy --workspace -- -D warnings -D clippy::unwrap_used | |
| - name: Ledger gate | |
| # L0 of docs/decision-ledger-prd.md: the decision record must be | |
| # readable, unallocated decisions and stale acceptances must not | |
| # reach main. Exit 1 = findings, exit 2 = the gate could not run. | |
| run: cargo run -q -p ledger-cli --bin ledger -- verify | |
| - name: DDD governance gate | |
| # Schema + ontology validation of the .ddd graph (M8: runs in CI | |
| # alongside the ledger gate — both stores are contract surfaces). | |
| run: cargo run -q -p ddd-cli --bin ddd -- validate | |
| - name: Contract-surface gate (repo diff) | |
| # M8, spec invariant 5: every contract-surface change in the PR | |
| # range must be discharged by a declaration signing that exact | |
| # change — regardless of how the edit was made. Uses the same | |
| # classifier as the interceptor (invariant 4); rust-analyzer is | |
| # the Rust host, installed as a toolchain component above. | |
| if: github.event_name == 'pull_request' | |
| run: cargo run -q -p ddd-cli --bin ddd -- diff-contracts "${{ github.event.pull_request.base.sha }}..HEAD" --wait 600 | |
| - name: Convention check (xtask) | |
| # Enforces every CTX rule registered under xtask/src/checks/. | |
| # See conventions/README.md for the rule catalogue. | |
| run: cargo xtask check | |
| - name: Convention drift self-test | |
| # Verifies every registered Check has a matching conventions/docs/<id>.md | |
| # whose frontmatter id/title/adrs match the implementation. | |
| run: cargo xtask check --self-test | |
| - name: Supply-chain check (cargo-deny) | |
| # Enforces deny.toml — license allow-list, advisory database, banned | |
| # crates, and source restrictions. | |
| uses: EmbarkStudios/cargo-deny-action@v2 | |
| with: | |
| command: check | |
| arguments: --workspace | |
| - name: Benchmarks | |
| # Compile-and-run the framework-graph bench (lives in product-core). | |
| run: cargo bench -p product-core --bench graph_bench |