Files
marqdo-cli/docs/ci.md
T
cflmy 72f57beee0
ci/woodpecker/push/main Pipeline failed
ci/woodpecker/pr/main Pipeline failed
refactor: accept the ecosystem stdlib Bundle and remove the in-repo sources
Phase B of ADR-0070 (issue #11): the CLI no longer owns standard-library
sources. The pin names the accepted ecosystem Bundle (marqdo-stdlib@0.2.0,
root commit + tree/alias digests); tools/ci/fetch_ecosystem_bundle.py
materializes it from the pinned root commit and stdlib gitlinks and verifies
the digests. bundle.py and the test harness require an explicit verified Bundle
for the accepted identity, and runtime discovery has no compile-time source
fallback in any profile.

Delete stdlib/ (modules, self-tests, aliases manifest). Module and domain tests
stay with their component owners; the CLI product lane now verifies the
external Bundle's public surface, std: resolution and official print/打印 alias
routing (tests/product-stdlib). Composition assertions whose owner is the
ecosystem (Table split, print-format equivalence) moved to the root Bundle
acceptance; the generic TCP round-trip stays a CLI test. Spawned-CLI tests name
the verified Bundle explicitly.

CI (Woodpecker + GitHub) materializes the pinned Bundle before product tests,
packaging and performance lanes; packaging and release take --stdlib-dir from
that artifact. Docs, STATUS, ADR-0070 and a Phase B evidence record updated.

Refs cflmy/marqdo#9, cflmy/marqdo-cli#11
2026-11-27 01:04:01 +08:00

186 lines
9.1 KiB
Markdown

# CI/CD
## Current setup
- Git remote: `https://git.cflmy.cn/cflmy/marqdo-cli.git`
- Woodpecker: `https://ci.cflmy.cn`
- Pipeline definition: [`.woodpecker/main.yml`](../.woodpecker/main.yml)
- Current hardening plan/RFC:
[`MARQDO_CI_SECURITY_PLATFORM_PERFORMANCE_RFC_20261121.md`](MARQDO_CI_SECURITY_PLATFORM_PERFORMANCE_RFC_20261121.md)
- Credentials are local-only and ignored; see
[development-credentials.md](development-credentials.md). Do not put tokens in
pipeline files or commit messages.
The default Docker pipeline runs on push and pull request. A fast `contract`
lane exercises the public Analysis/Observation contracts through the real CLI
and the independent Python consumers; the full `test` lane runs the Rust gates
and the Windows cross-target compile check; `independent-build` exports the
commit without `stdlib/` and proves both shipped binaries still build and run a
language-only program; `build` packages the archive from the pinned stdlib
Bundle, runs the from-archive smoke and the frozen external conformance suite.
```text
contract (rust:1.100-bookworm, python3-jsonschema, both shipped binaries):
cargo build --locked -p marqdo-cli -p marqdo-provider-worker
real CLI check/run over the Observation fixtures
analysis_consumer / observation_consumer / validate_protocols
stream==snapshot assertion (tools/ci/verify_observation_stream.py)
stale-Analysis rejection
dependency-direction gate (tools/ci/check_dependency_boundaries.py)
test (rust:1.100-bookworm, clippy/rustfmt, Node.js 22, MinGW, both binaries):
python3 tools/ci/fetch_ecosystem_bundle.py (materialize the pinned ecosystem Bundle)
python3 tools/stdlib/bundle.py --stdlib-dir target/ecosystem-stdlib
cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
cargo build --locked -p marqdo-provider-worker
cargo test --workspace --locked
docs_consistency / architecture_boundaries / stdlib_product
stdlib_product again with MARQDO_TEST_STDLIB_BUNDLE + MARQDO_TEST_BUNDLE_PIN
check_dependency_boundaries.py (Cargo-metadata responsibility graph)
check_engine_boundary.py (independent consumer build/run + CLI differential)
check_plugin_sdk.py (real third-party SDK plugin via the real CLI)
python3 -m unittest discover -s tools/ci -p "test_*.py"
rustup target add x86_64-pc-windows-gnu
cargo check --workspace --all-targets --target x86_64-pc-windows-gnu
independent-build (rust:1.100-bookworm, git, python3):
git archive HEAD, no stdlib source tree exists, no ecosystem checkout
cargo build --locked -p marqdo-cli -p marqdo-provider-worker
language-only check/call through the built CLI
stdlib-dependent run must fail closed; no stdlib/ next to the binary
minimum-rust (rust:1.89-bookworm):
cargo check --locked --workspace --all-targets
build (depends on test, minimum-rust, contract):
cargo build --release --locked -p marqdo-cli -p marqdo-provider-worker
materialize the pinned Bundle; package --stdlib-dir target/ecosystem-stdlib --bundle-pin ...
from-archive smoke (tools/release/smoke.py)
frozen external conformance (tools/ci/run_frozen_extensions.sh, 7/7)
```
A separate manual workflow, [`.woodpecker/performance.yml`](../.woodpecker/performance.yml),
builds the beta baseline and the candidate archive on the shared Woodpecker
agent and records the nine G4 comparisons. Its reports stay `SMOKE`; only the
maintainer-approved RC `WARN` exception can use them (see
[`releasing.md`](releasing.md) and [`performance.md`](performance.md)).
The pipeline is a protocol consumer itself: it must exercise only the current
Analysis and Observation contracts. `docs_consistency::ci_configuration_uses_only_current_protocols`
fails if a retired option or consumer name returns, and
`current_contract_documents_do_not_reference_retired_interfaces` extends the
same rule to `spec/` and the current developer guides.
Node.js 22 is required because the optional foreign-kernel tests use ES-module
syntax; Debian bookworm's Node 18 fails those tests.
> **Language contract note.** `cargo test --workspace` includes conformance
> fixtures that execute `.mq.md` source under
> [RFC-LANG-0002](architecture/RFC-LANG-0002-unified-semantics.md). A red
> executable-source suite is a real regression, not an expected migration
> state. Do not "fix" it by restoring the old mapper or regenerating goldens;
> see [`STATUS.md`](STATUS.md). The lanes above are the current definition; it
> changes only with this document.
## What this pipeline does not cover
- **Strict security lane**: needs a disposable VM/self-hosted runner with
Bubblewrap/AppArmor namespace support. See [security-vm.md](security-vm.md)
and [security-gate.md](security-gate.md). The Docker pipeline is not an
OS-isolation proof.
- **Windows/macOS native lanes**: the GitHub-hosted
`.github/workflows/ci.yml` matrix **does exist and does run** on
`windows-latest` and `macos-latest`. The Woodpecker instance itself has no
Windows/macOS agent, so a Woodpecker-only green pipeline cannot substitute
for those native jobs. A remote Windows/macOS PASS requires the GitHub
matrix (or an equivalent real native runner) on the same SHA.
- **Performance baseline (G4)**: needs a fixed Linux node; see
[performance.md](performance.md). Development-container or TCG/QEMU timings
are `SMOKE`, never release evidence.
- **Release publication/signing**: no publication job is defined. The
`release-evidence` job produces a SHA-bound manifest artifact; it does not
tag or upload a release.
## RFC-EXT-0001 CI/CD additions
* The Woodpecker **test** lane builds `marqdo-provider-worker` before the
workspace tests so the provider CLI tests use the real helper, and adds a
`cargo check --workspace --all-targets --target x86_64-pc-windows-gnu`
compile gate (native Windows/macOS runtime lanes stay on the GitHub matrix).
* **ADR-0070 explicit Bundle:** the `test` lane verifies
`tools/stdlib/bundle-pin.json`, materializes the pinned ecosystem Bundle and
runs the product suite with an explicit `MARQDO_TEST_STDLIB_BUNDLE`; the
`independent-build` lane builds both binaries with no Bundle checkout and requires the stdlib-dependent
program to fail closed.
* The Woodpecker **build** lane and the GitHub **release-candidate** lane build
`marqdo` **and** `marqdo-provider-worker` and package both as siblings; the
provider transport resolves only that sibling (no PATH fallback), so an
archive without it would silently lose provider support.
* `tools/ci/test_verify_extension_contracts.py` covers the external-extension
evidence validator in the existing `python3 -m unittest discover -s tools/ci`
step.
* The release-evidence job validates
`docs/evidence/extension/<SHA>/manifest.json` when it is committed for the
target SHA and prints `UNVERIFIED` otherwise; generating it is the mandatory
release action described in `docs/releasing.md` §7, not a substitute for
G3/G4/native lanes.
## Local reproduction
```bash
export PATH="$HOME/.cargo/bin:$PATH"
cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace --locked
cargo build --release --locked -p marqdo-cli
```
## Local API/trigger
The ignored `.secrets/dev.env` may contain a Woodpecker API token for local
queries/triggers. The token is not needed by the pipeline itself and must never
be committed.
## External extension evidence (RFC-EXT-0001 PR-07/PR-08)
A release candidate must also prove that a **frozen** CLI binary can use
extensions from physically separate repositories without modifying or
rebuilding this workspace. This is a new necessary condition; it does **not**
replace the security/platform/performance gates above.
Required inputs:
* a release build of this commit: `cargo build --release --locked -p marqdo-cli`;
* the provider helper shipped next to it for the same target:
`marqdo-provider-worker` (the provider transport resolves only that sibling;
no `PATH` fallback);
* a clean checkout of the external fixture repository
`https://git.cflmy.cn/cflmy/marqdo-extension-conformance`.
Generation and validation:
```bash
CLI="$(realpath target/release/marqdo)"
python3 tools/ci/verify_extension_contracts.py \
--cli "$CLI" \
--fixtures /path/to/marqdo-extension-conformance
python3 tools/ci/verify_extension_contracts.py \
--validate docs/evidence/extension/<40-hex-source-SHA>/manifest.json
```
The generator hashes the CLI before and after the external suite, records the
source SHA and fixture repo SHA, and refuses to write evidence for a changed
binary, a dirty fixture checkout, a `FAIL`, or an unexplained
`UNSUPPORTED`/`SKIPPED` result. The external suite itself
(`tests/run_all.py` in that repository) uses only `$MARQDO_BIN` (absolute),
never Cargo, and covers: pinned-Git `.mq.md` package, worker ABI plugin,
unknown foreign kernel, provider v2 worker, and an independent Analysis/Trace
consumer.
The schema is [`evidence/extension/schema.json`](evidence/extension/schema.json);
the generator is `tools/ci/verify_extension_contracts.py`. A manifest whose
`tested_sha` is not the release SHA is invalid. Platform-specific results must
be reported as `UNSUPPORTED` (for example provider worker on non-linux/x86_64);
a Linux PASS never substitutes for a macOS/Windows lane.