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.
194 lines
8.0 KiB
Bash
Executable File
194 lines
8.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Freshness of the EXTERNAL dependencies (crates.io) declared by the project. `cargo outdated` compares the
|
|
# Cargo.lock version to the latest published one, but not the requirement written in Cargo.toml: a
|
|
# requirement `os_info = "3.8"` with a lock up to date at 3.15 goes unnoticed, and a consumer of the
|
|
# crate may end up with a version seven minor versions old.
|
|
#
|
|
# For each direct dependency `name = "x.y"` or `name = { version = "x.y", … }` (excluding `path`, `git`,
|
|
# `registry`, `workspace`), in [dependencies], [dev-dependencies], [build-dependencies], their
|
|
# `target.*` variants and [workspace.dependencies], it checks:
|
|
# 1. the requirement accepts the latest published version (for a 0.x, `0.5` does not accept 0.6);
|
|
# 2. for a version ≥ 1, the required minor version is not behind the latest
|
|
# (`tokio = "1.35"` while 1.52 exists). A 0.x is not checked at this level: its
|
|
# patch number does not count;
|
|
# 3. Cargo.lock is on the latest version that the requirement accepts.
|
|
# Requirements that are not written `x`, `x.y` or `x.y.z` (`=1.2.3`, `~1.2`, `>=1`, ranges) are
|
|
# explicit choices: ignored.
|
|
#
|
|
# deps-check-external.sh check (read-only, except for the network)
|
|
# deps-check-external.sh bump raises the outdated requirements then `cargo update -p`
|
|
#
|
|
# Variables: DEPS_CHECK_EXTERNAL=0 disables the check (workspace too large to be kept up
|
|
# to date all at once); DEPS_CHECK_EXTERNAL_IGNORE="crate1 crate2" sets crates aside (to be justified in
|
|
# the Makefile: for example a public dependency that must move up with the neighbouring crates); CRATES_IO_INDEX (default https://index.crates.io); DEPS_CHECK_OFFLINE=1 ignores
|
|
# the absence of network (warning).
|
|
# shellcheck disable=SC2154 # manifests comes from deps-lib.sh
|
|
set -euo pipefail
|
|
. "$(dirname "$0")/common.sh"
|
|
. "$(dirname "$0")/deps-lib.sh"
|
|
|
|
mode="${1:-check}"
|
|
case "$mode" in check | bump) ;; *)
|
|
err "usage: deps-check-external.sh [check|bump]"
|
|
exit 2
|
|
;;
|
|
esac
|
|
|
|
if [ "${DEPS_CHECK_EXTERNAL:-1}" = 0 ]; then
|
|
info " (external dependencies: check disabled by DEPS_CHECK_EXTERNAL=0)"
|
|
exit 0
|
|
fi
|
|
[ -f "$CARGO_TOML" ] || exit 0
|
|
|
|
crates_index="${CRATES_IO_INDEX:-https://index.crates.io}"
|
|
crates_index="${crates_index%/}"
|
|
|
|
fail=0
|
|
bad() {
|
|
err " ✗ $*"
|
|
fail=1
|
|
}
|
|
|
|
# External declarations of a manifest: "key<TAB>crate<TAB>requirement" (the crate differs from the key
|
|
# when the dependency is renamed by `package = "…"`).
|
|
declarations() {
|
|
awk '
|
|
/^\[/ { dep = ($0 ~ /^\[(workspace\.|target\..*\.)?(dev-|build-)?dependencies\]$/); next }
|
|
!dep { next }
|
|
/^[ \t]*#/ { next }
|
|
{
|
|
if (match($0, /^[A-Za-z0-9_-]+[ \t]*=/) == 0) next
|
|
key = $0; sub(/[ \t]*=.*/, "", key)
|
|
rest = $0; sub(/^[A-Za-z0-9_-]+[ \t]*=[ \t]*/, "", rest)
|
|
crate = key
|
|
if (rest ~ /^"/) {
|
|
req = rest; sub(/^"/, "", req); sub(/".*/, "", req)
|
|
} else if (rest ~ /^\{/) {
|
|
if (rest ~ /(path|git|registry|workspace)[ \t]*=/) next
|
|
if (match(rest, /version[ \t]*=[ \t]*"[^"]*"/) == 0) next
|
|
req = substr(rest, RSTART, RLENGTH)
|
|
sub(/^version[ \t]*=[ \t]*"/, "", req); sub(/"$/, "", req)
|
|
if (match(rest, /package[ \t]*=[ \t]*"[^"]*"/)) {
|
|
crate = substr(rest, RSTART, RLENGTH)
|
|
sub(/^package[ \t]*=[ \t]*"/, "", crate); sub(/"$/, "", crate)
|
|
}
|
|
} else next
|
|
print key "\t" crate "\t" req
|
|
}
|
|
' "$1"
|
|
}
|
|
|
|
# Replaces the requirement of the dependency `key` (in a dependencies section) of manifest $1 with $3.
|
|
rewrite_req() {
|
|
awk -v n="$2" -v r="$3" '
|
|
/^\[/ { dep = ($0 ~ /dependencies\]$/) }
|
|
dep && $0 ~ "^" n "[ \t]*=" {
|
|
if ($0 ~ /\{/) sub(/version[ \t]*=[ \t]*"[^"]*"/, "version = \"" r "\"")
|
|
else sub(/"[^"]*"/, "\"" r "\"")
|
|
}
|
|
{ print }
|
|
' "$1" >"$1.tmp" && mv "$1.tmp" "$1"
|
|
}
|
|
|
|
# Requirement to write for version $1: x.y (≥ 1) or 0.y.
|
|
floor_for() { echo "$1" | cut -d. -f1,2; }
|
|
|
|
tmp=$(mktemp -d)
|
|
trap 'rm -r "$tmp"' EXIT
|
|
|
|
info "→ Freshness of the external dependencies (crates.io)..."
|
|
count=0
|
|
offline=0
|
|
updates=""
|
|
for manifest in "${manifests[@]}"; do
|
|
while IFS=$'\t' read -r key crate req; do
|
|
[ -n "$crate" ] || continue
|
|
# Dependency deliberately set aside (DEPS_CHECK_EXTERNAL_IGNORE, with its reason in the Makefile).
|
|
case " ${DEPS_CHECK_EXTERNAL_IGNORE:-} " in *" $crate "*) continue ;; esac
|
|
# Explicit requirement (=, ~, >=, range): a choice, not checked (and no network request).
|
|
case "${req#^}" in '' | *[!0-9.]*) continue ;; esac
|
|
count=$((count + 1))
|
|
|
|
if [ ! -f "$tmp/$crate" ]; then
|
|
rc=0
|
|
found=$(latest_published "$crate" "$crates_index") || rc=$?
|
|
printf '%s %s\n' "$rc" "$found" >"$tmp/$crate"
|
|
fi
|
|
read -r rc latest <"$tmp/$crate"
|
|
if [ "$rc" -eq 2 ]; then
|
|
offline=1
|
|
continue
|
|
fi
|
|
if [ "$rc" -eq 1 ] || [ -z "$latest" ]; then
|
|
warn " ⚠ $crate ($manifest): not found on crates.io, not checked"
|
|
continue
|
|
fi
|
|
|
|
acc=0
|
|
req_accepts "$req" "$latest" || acc=$?
|
|
|
|
|
|
if [ "$acc" -eq 1 ]; then
|
|
# Newer than the latest published (pre-release, yank): nothing to raise.
|
|
[ "$(printf '%s\n%s\n' "$req" "$latest" | sort -V | tail -n 1)" = "$latest" ] || continue
|
|
if [ "$mode" = bump ]; then
|
|
new=$(floor_for "$latest")
|
|
rewrite_req "$manifest" "$key" "$new"
|
|
info " $crate ($manifest): \"$req\" → \"$new\" (latest version: $latest)"
|
|
updates+="$crate "
|
|
else
|
|
bad "$crate ($manifest): the requirement \"$req\" does not accept the latest version $latest → \"$(floor_for "$latest")\" (make deps-bump)"
|
|
fi
|
|
continue
|
|
fi
|
|
|
|
# The requirement accepts the latest version: is the required minor (≥ 1.0) behind?
|
|
IFS=. read -r rmaj rmin _ <<<"${req#^}"
|
|
IFS=. read -r _ lmin _ <<<"$latest"
|
|
if [ "$rmaj" != 0 ] && [ -n "$rmin" ] && [ "$rmin" -lt "$lmin" ]; then
|
|
if [ "$mode" = bump ]; then
|
|
new=$(floor_for "$latest")
|
|
rewrite_req "$manifest" "$key" "$new"
|
|
info " $crate ($manifest): \"$req\" → \"$new\" (latest version: $latest)"
|
|
updates+="$crate "
|
|
else
|
|
bad "$crate ($manifest): the requirement \"$req\" is behind the latest version $latest → \"$(floor_for "$latest")\" (make deps-bump)"
|
|
fi
|
|
fi
|
|
|
|
# Cargo.lock: on the latest version that the requirement accepts.
|
|
if [ -f Cargo.lock ]; then
|
|
locked=$(lock_entries | awk -v n="$crate" '$1 == n && index($3, "crates.io-index") { print $2 }' | sort -V | tail -n 1)
|
|
if [ -n "$locked" ] && [ "$locked" != "$latest" ] &&
|
|
[ "$(printf '%s\n%s\n' "$locked" "$latest" | sort -V | tail -n 1)" = "$latest" ]; then
|
|
if [ "$mode" = bump ]; then
|
|
updates+="$crate "
|
|
else
|
|
bad "$crate: Cargo.lock is on $locked, the latest version is $latest → cargo update -p $crate (make deps-bump)"
|
|
fi
|
|
fi
|
|
fi
|
|
done < <(declarations "$manifest")
|
|
done
|
|
|
|
if [ "$offline" -eq 1 ]; then
|
|
if [ "${DEPS_CHECK_OFFLINE:-}" = 1 ]; then
|
|
warn " ⚠ crates.io unreachable: freshness of the external dependencies not verified (DEPS_CHECK_OFFLINE=1)"
|
|
else
|
|
bad "crates.io unreachable ($crates_index): freshness cannot be verified (DEPS_CHECK_OFFLINE=1 to ignore)"
|
|
fi
|
|
fi
|
|
|
|
if [ "$mode" = bump ] && [ -n "$updates" ]; then
|
|
for n in $(printf '%s\n' $updates | sort -u); do
|
|
info " cargo update -p $n"
|
|
"$CARGO" update -p "$n" >/dev/null
|
|
done
|
|
fi
|
|
|
|
if [ "$fail" -ne 0 ]; then
|
|
err "✗ External dependencies out of date (see above)"
|
|
exit 1
|
|
fi
|
|
ok "✓ External dependencies up to date ($count checked)"
|