The tag lane keeps its deterministic build/smoke evidence even when the forge secret is not injected; guard the final evidence print so the lane does not fail on a skipped publication.
87 lines
3.7 KiB
YAML
87 lines
3.7 KiB
YAML
# Woodpecker CI pipeline for marqdo-knowledge.
|
|
#
|
|
# Mirrors the local lanes in scripts/ci.sh and the GitHub workflow. The core CLI
|
|
# is built from the pinned marqdo-cli commit because the Analysis contract is an
|
|
# external boundary; integration tests always run against that real binary.
|
|
when:
|
|
event: [push, pull_request, tag]
|
|
|
|
steps:
|
|
test:
|
|
image: rust:1.100-bookworm
|
|
commands:
|
|
- apt-get update
|
|
- apt-get install -y --no-install-recommends ca-certificates python3
|
|
- rustup component add clippy rustfmt
|
|
- python3 tools/ci/test_release_metadata.py
|
|
- cargo fmt --all -- --check
|
|
- cargo clippy --workspace --all-targets --locked -- -D warnings
|
|
- cargo test --workspace --locked
|
|
|
|
minimum-rust:
|
|
image: rust:1.89-bookworm
|
|
commands:
|
|
- apt-get update
|
|
- apt-get install -y --no-install-recommends ca-certificates build-essential
|
|
- cargo check --locked --workspace --all-targets
|
|
|
|
core-analysis:
|
|
image: rust:1.100-bookworm
|
|
commands:
|
|
- apt-get update
|
|
- apt-get install -y --no-install-recommends ca-certificates git build-essential
|
|
- |
|
|
set -eu
|
|
core_sha=4bbefc92449ee480c8a2c89b0308feb4cda8d0e7
|
|
work=$(mktemp -d)
|
|
git clone --quiet https://git.cflmy.cn/cflmy/marqdo-cli.git "$work/core"
|
|
( cd "$work/core" && git checkout --quiet "$core_sha" \
|
|
&& cargo build --release --locked -p marqdo-cli )
|
|
MARQDO_TEST_BIN="$work/core/target/release/marqdo" \
|
|
cargo test --workspace --locked
|
|
- cargo build --locked
|
|
- target/debug/marqdo-knowledge --help >/dev/null
|
|
|
|
release:
|
|
depends_on: [test, minimum-rust, core-analysis]
|
|
when:
|
|
event: [tag]
|
|
image: rust:1.100-bookworm
|
|
environment:
|
|
GITEA_TOKEN:
|
|
from_secret: GITEA_TOKEN
|
|
commands:
|
|
- apt-get update
|
|
- apt-get install -y --no-install-recommends ca-certificates git build-essential python3
|
|
- |
|
|
set -eu
|
|
core_sha=4bbefc92449ee480c8a2c89b0308feb4cda8d0e7
|
|
work=$(mktemp -d)
|
|
git clone --quiet https://git.cflmy.cn/cflmy/marqdo-cli.git "$work/core"
|
|
( cd "$work/core" && git checkout --quiet "$core_sha" \
|
|
&& cargo build --release --locked -p marqdo-cli )
|
|
export MARQDO_BIN="$work/core/target/release/marqdo"
|
|
cargo build --release --locked
|
|
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-knowledge"))')"
|
|
python3 tools/release/package.py --source-sha "$CI_COMMIT_SHA" --version "$version"
|
|
python3 tools/release/smoke.py --archive "dist/marqdo-knowledge-$version-x86_64-unknown-linux-gnu.tar.gz" --evidence-out dist/smoke-evidence.json
|
|
if [ -z "${GITEA_TOKEN:-}" ]; then
|
|
echo "publish: skipped (this Woodpecker instance did not inject the GITEA_TOKEN secret); the deterministic archive and smoke evidence above are the CI evidence. Publish the prerelease locally from the same tagged SHA with tools/release/publish-gitea.py."
|
|
else
|
|
python3 tools/release/publish-gitea.py \
|
|
--tag "$CI_COMMIT_TAG" \
|
|
--archive "dist/marqdo-knowledge-$version-x86_64-unknown-linux-gnu.tar.gz" \
|
|
--files dist/RELEASE_INFO.json dist/FILES.sha256 dist/smoke-evidence.json \
|
|
--body-file "docs/releases/$version.md"
|
|
fi
|
|
- cat dist/RELEASE_INFO.json
|
|
- cat dist/*.tar.gz.sha256
|
|
- cat dist/smoke-evidence.json
|
|
- |
|
|
if [ -f dist/gitea-release-evidence.json ]; then
|
|
cat dist/gitea-release-evidence.json
|
|
else
|
|
echo "publish: skipped (no GITEA_TOKEN secret injection on this instance)"
|
|
fi
|