87 lines
5.1 KiB
YAML
87 lines
5.1 KiB
YAML
# Woodpecker CI pipeline for the Rust workspace.
|
|
# The strict security lane needs a disposable VM/self-hosted runner and is
|
|
# intentionally not part of this docker pipeline; see docs/security-vm.md.
|
|
when:
|
|
event: [push, pull_request]
|
|
|
|
steps:
|
|
test:
|
|
image: rust:1.100-bookworm
|
|
commands:
|
|
- rustup component add clippy rustfmt
|
|
- apt-get update
|
|
- apt-get install -y --no-install-recommends curl ca-certificates python3 python3-jsonschema build-essential gcc-mingw-w64-x86-64
|
|
- curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
|
|
- apt-get install -y --no-install-recommends nodejs
|
|
- 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
|
|
- 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"
|
|
- cargo test -p marqdo-cli --test stdlib_product
|
|
# Windows compile gate: runtime lanes are native on GitHub; this catches
|
|
# cfg/compile regressions on the Linux CI without a Windows runner.
|
|
- rustup target add x86_64-pc-windows-gnu
|
|
- cargo check --workspace --all-targets --target x86_64-pc-windows-gnu
|
|
|
|
minimum-rust:
|
|
image: rust:1.89-bookworm
|
|
commands:
|
|
- apt-get update
|
|
- apt-get install -y --no-install-recommends build-essential ca-certificates
|
|
- cargo check --locked --workspace --all-targets
|
|
|
|
build:
|
|
image: rust:1.100-bookworm
|
|
depends_on: [test, minimum-rust]
|
|
commands:
|
|
- apt-get update
|
|
- apt-get install -y --no-install-recommends ca-certificates git openssl python3 python3-jsonschema build-essential
|
|
# Release archives must ship both binaries: the provider worker is the
|
|
# only supported transport and resolution is a sibling-of-CLI lookup.
|
|
- cargo build --release --locked -p marqdo-cli -p marqdo-provider-worker
|
|
- test -x target/release/marqdo-provider-worker
|
|
# Build the deterministic archive from this exact commit and cold-install
|
|
# smoke-test it; the package script refuses a dirty tree or wrong SHA.
|
|
- |
|
|
set -eu
|
|
version="$(cargo metadata --no-deps --format-version 1 --offline \
|
|
| python3 -c 'import json,sys; print(next(p["version"] for p in json.load(sys.stdin)["packages"] if p["name"]=="marqdo-cli"))')"
|
|
python3 tools/release/package.py --source-sha "$CI_COMMIT_SHA" --version "$version"
|
|
python3 tools/release/smoke.py --archive dist/marqdo-*.tar.gz
|
|
tools/ci/run_frozen_extensions.sh dist/marqdo-*.tar.gz "$CI_COMMIT_SHA" dist/frozen-extension-evidence.json
|
|
cat dist/frozen-extension-evidence.json
|