ci: add CI/CD pipelines and deterministic release tooling
Modeled on cflmy/marqdo-cli: - Woodpecker pipeline with fmt/clippy/tests, MSRV 1.89 lane, a lane that builds the pinned core CLI and runs the real Analysis integration tests, and a tag-only release lane - GitHub Actions mirror with the same gates plus artifact upload and prerelease publication - scripts/ci.sh local lanes (test/minimum/core/release/all) - package-release.sh now refuses a dirty tree or SOURCE_SHA mismatch, runs a locked release build and records SOURCE_SHA, RELEASE_INFO.json and SHA-256 - verify-release.sh cold-installs the archive into an isolated MARQDO_TOOL_HOME and runs the documented install/help/compile/query/check/remove smoke path - docs/ci.md and docs/releasing.md document gates, explicit non-gates and the beta freeze/tag procedure
This commit is contained in:
1 parent
66be3e4464
commit
d8d439e6d7
7 files changed
+467
-40
No files matched your search
+41
-21
@@ -1,31 +1,51 @@
|
||||
#!/bin/sh
|
||||
# Reproducible local release verification. Requires a real marqdo CLI path.
|
||||
# Cold-install the packaged release archive through a real core CLI and run the
|
||||
# documented smoke path: install -> help -> compile -> query -> check -> remove.
|
||||
set -eu
|
||||
ROOT=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
||||
MARQDO=${MARQDO_BIN:?set MARQDO_BIN to the core marqdo binary}
|
||||
VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' "$ROOT/Cargo.toml" | head -1)
|
||||
TARGET=${TARGET:-x86_64-unknown-linux-gnu}
|
||||
ARCHIVE="$ROOT/dist/marqdo-knowledge-$VERSION-$TARGET.tar.gz"
|
||||
|
||||
cd "$ROOT"
|
||||
scripts/cargo.sh fmt --all -- --check
|
||||
scripts/cargo.sh clippy --all-targets -- -D warnings
|
||||
scripts/cargo.sh test --workspace --locked
|
||||
scripts/cargo.sh build --release --locked
|
||||
|
||||
# Cold tool install in an isolated tool home.
|
||||
test -f "$ARCHIVE"
|
||||
( cd "$ROOT/dist" && sha256sum -c "$(basename "$ARCHIVE").sha256" )
|
||||
WORK=$(mktemp -d)
|
||||
TOOL_HOME=$(mktemp -d)
|
||||
trap 'rm -rf "$WORK" "$TOOL_HOME"' EXIT
|
||||
tar -xzf "$ARCHIVE" -C "$WORK"
|
||||
PKG="$WORK/marqdo-knowledge-$VERSION-$TARGET"
|
||||
export MARQDO_TOOL_HOME="$TOOL_HOME"
|
||||
trap 'rm -rf "$TOOL_HOME"' EXIT
|
||||
"$MARQDO" tool install "$ROOT/packaging" >/dev/null 2>&1 || {
|
||||
# packaging/tool.json expects bin/marqdo-knowledge; stage it.
|
||||
STAGE=$(mktemp -d)
|
||||
mkdir -p "$STAGE/bin"
|
||||
cp "$ROOT/packaging/tool.json" "$STAGE/tool.json"
|
||||
cp "$ROOT/target/release/marqdo-knowledge" "$STAGE/bin/marqdo-knowledge"
|
||||
"$MARQDO" tool install "$STAGE"
|
||||
}
|
||||
|
||||
"$MARQDO" tool install "$PKG"
|
||||
"$MARQDO" tool list | grep -q knowledge
|
||||
"$MARQDO" knowledge --help >/dev/null
|
||||
"$MARQDO" knowledge compile "$ROOT/examples/mixed" --json >/tmp/knowledge-compile.json
|
||||
"$MARQDO" knowledge query '量子归一话' --root "$ROOT/examples/mixed" --format json >/tmp/knowledge-query.json
|
||||
"$MARQDO" knowledge check "$ROOT/examples/mixed" --json >/tmp/knowledge-check.json
|
||||
"$MARQDO" knowledge compile "$ROOT/examples/mixed" --json > "$WORK/compile.json"
|
||||
"$MARQDO" knowledge query '归一化' --root "$ROOT/examples/mixed" --format json > "$WORK/query.json"
|
||||
"$MARQDO" knowledge check "$ROOT/examples/mixed" --json > "$WORK/check.json"
|
||||
python3 - "$WORK" <<'PY'
|
||||
import json, sys
|
||||
work = sys.argv[1]
|
||||
compile_report = json.load(open(f"{work}/compile.json"))
|
||||
query_report = json.load(open(f"{work}/query.json"))
|
||||
check_report = json.load(open(f"{work}/check.json"))
|
||||
assert compile_report["success"] and compile_report["payload"]["documents"] > 0
|
||||
assert query_report["success"] and len(query_report["hits"]) > 0
|
||||
assert check_report["success"] and check_report["payload"]["errors"] == 0
|
||||
assert check_report["payload"]["database"] == "current"
|
||||
print(
|
||||
"smoke: compile documents=%s query_hits=%s database=%s"
|
||||
% (
|
||||
compile_report["payload"]["documents"],
|
||||
len(query_report["hits"]),
|
||||
check_report["payload"]["database"],
|
||||
)
|
||||
)
|
||||
PY
|
||||
"$MARQDO" tool remove knowledge
|
||||
printf 'verify-release: ok (v%s, core %s)\n' "$VERSION" "$("$MARQDO" --version)"
|
||||
if "$MARQDO" tool list | grep -q knowledge; then
|
||||
echo "verify-release: tool was not removed" >&2
|
||||
exit 1
|
||||
fi
|
||||
printf 'verify-release: ok (v%s, core %s, sha %s)\n' \
|
||||
"$VERSION" "$("$MARQDO" --version)" "$(cat "$PKG/SOURCE_SHA")"
|
||||
Reference in new issue
Block a user