Release / release (push) Successful in 1m12s
Introduce the `obipipeline` crate, providing typed, composable multi-threaded pipelines with memory-bounded throttling. The crate includes a scheduler for managing pipeline stages, a throttle mechanism for concurrency control, and comprehensive build and release tooling via `.crate-kit`. - Add `Cargo.toml`, `Cargo.lock`, and `Makefile` to define the `obipipeline` package (v0.1.1) with `crossbeam-channel` dependency and build targets. - Add `LICENSE` and `LICENSE.en` files containing the CeCILL free software license agreement under French law. - Add `.gitignore` to exclude `target` and `/.cargo/config.toml` from version control. - Add `.crate-kit/` directory with build configuration (`VERSION`, `crate.mk`, `org.mk`, `dev-patch.mk`, `jj.mk`) and 21 shell scripts for API tracking, dependency management, release workflows, and wiki generation. - Add `.gitea/workflows/release.yaml` to automate releases on tag pushes, including building, publishing, and updating the wiki. - Add `src/lib.rs` to expose `scheduler` and `throttle` modules, re-exporting core types like `Pipe`, `Pipeline`, `WorkerPool`, and `Throttle`. - Add `src/scheduler/` module with `error.rs` (`PipelineError`), `macros.rs` (`make_pipe!`, `make_pipeline!`), `pipe.rs` (`Pipe`, `PipeIter`), `pool.rs` (`Pipeline`, `WorkerPool`), `runner.rs` (thread runners), and `types.rs` (`Stage`, `WorkerTask`, function aliases). - Add `src/throttle.rs` implementing `Throttle`, `ThrottleGuard`, and `throttle` function for memory-bounded concurrency control using semaphores. - Add `api/` directory with public API snapshots (`0.1.0`, `0.1.1`) in JSON, text, and stamp formats for version tracking. - Add `examples/sandbox_pipeline.rs` demonstrating pipeline construction with `make_pipeline!` and `WorkerPool` using sample transformation steps. - Add `tests/pipe.rs` with tests for pipe composition, flat transforms, and empty input handling. - Add `tests/throttle.rs` with tests verifying throttle ordering, concurrency bounds, and guard blocking behavior. - Update `README.md` with documentation for `obipipeline`, including core concepts, API details, and installation instructions.
97 lines
3.6 KiB
Bash
Executable File
97 lines
3.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Compares the current public API to the last snapshot and prints on standard output:
|
|
# initial no snapshot: first tracked version
|
|
# unchanged no change in the public API
|
|
# additive additions only (nothing removed or modified)
|
|
# breaking break: element removed/modified, or break seen by cargo-semver-checks
|
|
# All the detail goes to standard error.
|
|
#
|
|
# Two combined checks: cargo-semver-checks is the reference for breaks, but it does not
|
|
# report plain additions; the text diff of cargo public-api acts as a safety net (any removed
|
|
# or modified line = break) and provides the count of additions.
|
|
set -euo pipefail
|
|
. "$(dirname "$0")/common.sh"
|
|
|
|
if [ "${API_TRACKED:-yes}" = no ]; then
|
|
echo unchanged # no tracked Rust API: the version advances by patch (or RELEASE=x.y.z)
|
|
exit 0
|
|
fi
|
|
|
|
require_cargo_tool public-api cargo-public-api
|
|
require_cargo_tool semver-checks cargo-semver-checks
|
|
|
|
# A proc-macro crate has no library target: cargo-semver-checks cannot analyse it.
|
|
# Its API (the exported macros) is still tracked by the text diff of cargo public-api; this diff does
|
|
# not see a change in the macro's behaviour (rejected inputs, generated code): to be judged by hand.
|
|
is_proc_macro() {
|
|
"$CARGO" metadata --format-version 1 --no-deps | grep -q '"kind":\["proc-macro"\]'
|
|
}
|
|
|
|
last=$(latest_snapshot)
|
|
if [ -z "$last" ]; then
|
|
info " No snapshot in $API_DIR/: first tracked version"
|
|
echo initial
|
|
exit 0
|
|
fi
|
|
|
|
# A snapshot written with other tools (rustc, cargo-public-api) than today's is no longer
|
|
# comparable: cargo-semver-checks crashes on another rustdoc format, and the text diff sees
|
|
# breaks where only the rendering changed. It is regenerated from the tag of its version (no stamp =
|
|
# written before stamps existed, hence unknown).
|
|
if [ "$(cat "$API_DIR/$last.stamp" 2>/dev/null || true)" != "$(toolchain_stamp)" ]; then
|
|
info " Snapshot $last written with other tools: regenerating from tag version-$last"
|
|
regenerate_snapshot "$last" || {
|
|
err "✗ cannot regenerate snapshot $last: the comparison would be wrong"
|
|
exit 1
|
|
}
|
|
fi
|
|
|
|
tmp=$(mktemp -d)
|
|
trap 'rm -r "$tmp"' EXIT
|
|
info " Reference: API published in version $last"
|
|
|
|
"$CARGO" public-api -s >"$tmp/current.txt" 2>/dev/null || {
|
|
err "✗ cargo public-api failed"
|
|
exit 1
|
|
}
|
|
# `filter_unstable` (common.sh) removes from the cargo public-api text whatever is not the crate's API.
|
|
diff_out=$(diff <(filter_unstable "$API_DIR/$last.txt") <(filter_unstable "$tmp/current.txt") || true)
|
|
removed=$(printf '%s\n' "$diff_out" | grep -c '^<' || true)
|
|
added=$(printf '%s\n' "$diff_out" | grep -c '^>' || true)
|
|
|
|
# Code 100 = break; 0 = nothing to report; other = tool failure.
|
|
set +e
|
|
if is_proc_macro; then
|
|
info " proc-macro crate: cargo-semver-checks not applicable, text diff only"
|
|
rc=0
|
|
else
|
|
gzip -d -c "$API_DIR/$last.json.gz" >"$tmp/baseline.json"
|
|
"$CARGO" semver-checks --baseline-rustdoc "$tmp/baseline.json" --release-type minor >"$tmp/semver.log" 2>&1
|
|
rc=$?
|
|
fi
|
|
set -e
|
|
|
|
level=unchanged
|
|
if [ "$rc" -eq 100 ]; then
|
|
level=breaking
|
|
warn " Break detected by cargo-semver-checks:"
|
|
grep -E '^ +[A-Za-z0-9_]+::|^--- failure' "$tmp/semver.log" >&2 || true
|
|
elif [ "$rc" -ne 0 ]; then
|
|
err "✗ cargo-semver-checks failed (code $rc):"
|
|
tail -n 15 "$tmp/semver.log" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [ "$removed" -gt 0 ]; then
|
|
level=breaking
|
|
warn " $removed API line(s) removed or modified compared to $last:"
|
|
printf '%s\n' "$diff_out" | grep '^<' >&2
|
|
fi
|
|
|
|
if [ "$level" = unchanged ] && [ "$added" -gt 0 ]; then
|
|
level=additive
|
|
fi
|
|
|
|
info " API: +$added / -$removed lines; verdict: $level"
|
|
echo "$level"
|