ci: split a fast contract lane from the full Rust lane
ci/woodpecker/push/main Pipeline was canceled

This commit is contained in:
cflmy committed 2026-11-24 18:18:35 +08:00
1 parent 33b73f41e3
commit 6b509d344e
1 file changed
+45 -32
+45 -32
View File
@@ -5,6 +5,48 @@ when:
event: [push, pull_request]
steps:
# Fast contract lane: build the two shipped binaries and exercise the public
# Analysis/Observation contracts through the real CLI plus independent Python
# consumers. Kept separate from the Rust lane so a protocol break surfaces in
# minutes instead of waiting for the cross-target toolchain packages.
contract:
image: rust:1.100-bookworm
commands:
- apt-get update
- apt-get install -y --no-install-recommends ca-certificates python3 python3-jsonschema
- cargo build --locked -p marqdo-cli -p marqdo-provider-worker
- |
set -euxo pipefail
./target/debug/marqdo check tests/consumers/fixtures/observation/basic.mq.md --emit /tmp/analysis.json
./target/debug/marqdo run tests/consumers/fixtures/observation/basic.mq.md --output jsonl --observation-file /tmp/observation.json > /tmp/observation.jsonl
python3 tests/consumers/analysis_consumer.py /tmp/analysis.json
python3 tests/consumers/observation_consumer.py --validate-schema /tmp/observation.jsonl
python3 tests/consumers/observation_consumer.py --snapshot --analysis /tmp/analysis.json /tmp/observation.json
./target/debug/marqdo check tests/conformance/semantics/85-nested-loop-control.mq.md --emit /tmp/control-analysis.json
./target/debug/marqdo run tests/conformance/semantics/85-nested-loop-control.mq.md --output jsonl --observation-file /tmp/control-observation.json > /tmp/control-events.jsonl
python3 tests/consumers/validate_protocols.py /tmp/control-analysis.json /tmp/control-observation.json examples/tool-unknown-name/tool.json
python3 tests/consumers/analysis_consumer.py /tmp/control-analysis.json --require-transfers
python3 tests/consumers/observation_consumer.py --snapshot --analysis /tmp/control-analysis.json /tmp/control-observation.json
python3 tests/consumers/observation_consumer.py --validate-schema --analysis /tmp/control-analysis.json /tmp/control-events.jsonl
- |
set -eu
python3 - <<'PY'
import json, pathlib
events = [json.loads(line) for line in pathlib.Path("/tmp/control-events.jsonl").read_bytes().splitlines()]
snapshot = json.loads(pathlib.Path("/tmp/control-observation.json").read_text())
assert snapshot["events"] == events, "stream and snapshot must be one event sequence"
print("stream and snapshot share one event sequence")
PY
- |
set -eu
cp /tmp/control-analysis.json /tmp/analysis-stale.json
printf ' ' >> /tmp/analysis-stale.json
if python3 tests/consumers/observation_consumer.py --analysis /tmp/analysis-stale.json /tmp/control-events.jsonl; then
echo "stale Analysis was accepted" >&2
exit 1
fi
echo "stale Analysis rejected"
test:
image: rust:1.100-bookworm
commands:
@@ -16,38 +58,9 @@ steps:
- cargo fmt --all -- --check
- cargo clippy --workspace --all-targets -- -D warnings
# Provider CLI tests resolve a real provider worker next to the CLI
# binary; both binaries are also used by the black-box gates below.
- cargo build --locked -p marqdo-cli -p marqdo-provider-worker
# binary. Build it once so the test harness does not need a nested build.
- cargo build --locked -p marqdo-provider-worker
- cargo test --workspace --locked
# Observation black-box contract: one real execution feeds the JSONL
# stream and the JSON snapshot, and an independent consumer validates both.
- ./target/debug/marqdo check tests/consumers/fixtures/observation/basic.mq.md --emit /tmp/analysis.json
- ./target/debug/marqdo run tests/consumers/fixtures/observation/basic.mq.md --output jsonl --observation-file /tmp/observation.json > /tmp/observation.jsonl
- python3 tests/consumers/analysis_consumer.py /tmp/analysis.json
- python3 tests/consumers/observation_consumer.py /tmp/observation.jsonl --validate-schema
- python3 tests/consumers/observation_consumer.py --snapshot /tmp/observation.json --analysis /tmp/analysis.json
- ./target/debug/marqdo check tests/conformance/semantics/85-nested-loop-control.mq.md --emit /tmp/control-analysis.json
- ./target/debug/marqdo run tests/conformance/semantics/85-nested-loop-control.mq.md --output jsonl --observation-file /tmp/control-observation.json > /tmp/control-events.jsonl
- python3 tests/consumers/validate_protocols.py /tmp/control-analysis.json /tmp/control-observation.json examples/tool-unknown-name/tool.json
- python3 tests/consumers/analysis_consumer.py /tmp/control-analysis.json --require-transfers
- python3 tests/consumers/observation_consumer.py --snapshot /tmp/control-observation.json --analysis /tmp/control-analysis.json
- python3 tests/consumers/observation_consumer.py /tmp/control-events.jsonl --analysis /tmp/control-analysis.json --validate-schema
- |
set -eu
python3 - <<'PY'
import json, pathlib
events = [json.loads(line) for line in pathlib.Path("/tmp/control-events.jsonl").read_bytes().splitlines()]
snapshot = json.loads(pathlib.Path("/tmp/control-observation.json").read_text())
assert snapshot["events"] == events, "stream and snapshot must be one event sequence"
PY
- |
set -eu
cp /tmp/control-analysis.json /tmp/analysis-stale.json
printf ' ' >> /tmp/analysis-stale.json
if python3 tests/consumers/observation_consumer.py /tmp/control-events.jsonl --analysis /tmp/analysis-stale.json; then
echo "stale Analysis was accepted" >&2
exit 1
fi
- cargo test -p marqdo-cli --test docs_consistency
- cargo test -p marqdo-cli --test architecture_boundaries
- python3 -m unittest discover -s tools/ci -p "test_*.py"
@@ -66,7 +79,7 @@ steps:
build:
image: rust:1.100-bookworm
depends_on: [test, minimum-rust]
depends_on: [test, minimum-rust, contract]
commands:
- apt-get update
- apt-get install -y --no-install-recommends ca-certificates git openssl python3 python3-jsonschema build-essential