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.
76 lines
3.5 KiB
Bash
Executable File
76 lines
3.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Generates .cargo/config.toml (local, ignored by jj) for joint development:
|
|
# - the definition of the private registry;
|
|
# - a [patch.<registry>] for each registry dependency that has a neighbouring folder
|
|
# (../<name>/Cargo.toml), so that the project builds against the neighbouring code without publishing.
|
|
# Only the dependencies actually declared by this project are patched: no unused patch
|
|
# (Cargo complains about it), whatever the number of crates coming out of a workspace.
|
|
#
|
|
# Run by crate.mk on every make invocation. The file is rewritten only if it changes.
|
|
# Reads the root Cargo.toml and those of the direct subfolders (workspace members), and, if MEMBERS_DIR is set,
|
|
# those of that folder (its Cargo.toml and its direct subfolders);
|
|
# only the dependencies on one line `name = { …, registry = "<registry>" }` are seen.
|
|
# A .cargo/config.toml that was not generated by this script is never overwritten (warning).
|
|
set -euo pipefail
|
|
. "$(dirname "$0")/common.sh"
|
|
|
|
[ -f "$CARGO_TOML" ] || exit 0
|
|
# Nothing to generate without a registry (no extension) nor for crates.io (cargo's default index and token).
|
|
[ -n "$REGISTRY" ] && [ "$REGISTRY" != crates-io ] || exit 0
|
|
|
|
marker="# Generated by .crate-kit/scripts/dev-patch.sh"
|
|
config=".cargo/config.toml"
|
|
|
|
if [ -f "$config" ] && ! grep -q "^$marker" "$config"; then
|
|
warn "⚠ $config was not generated by the kit: left as is. If it is tracked by the repository,"
|
|
warn " delete it and add /.cargo/config.toml to .gitignore (the CI uses an environment variable)."
|
|
exit 0
|
|
fi
|
|
|
|
self=$(crate_name)
|
|
manifests=("$CARGO_TOML")
|
|
# Root of a workspace whose member CARGO_TOML designates (workspace): this is where the shared
|
|
# dependencies ([workspace.dependencies]) are declared.
|
|
[ "$CARGO_TOML" != Cargo.toml ] && [ -f Cargo.toml ] && manifests+=(Cargo.toml)
|
|
# MEMBERS_DIR: folder holding the workspace (root Cargo.toml and members), when it is not the project root
|
|
# (application workspace with its crates under src/: MEMBERS_DIR := src).
|
|
for m in */Cargo.toml ${MEMBERS_DIR:+"$MEMBERS_DIR/Cargo.toml" "$MEMBERS_DIR"/*/Cargo.toml}; do
|
|
[ -f "$m" ] && [ "$m" != "$CARGO_TOML" ] && manifests+=("$m")
|
|
done
|
|
|
|
registry_deps() {
|
|
sed -nE "s/^([A-Za-z0-9_-]+)[[:space:]]*=[[:space:]]*\{[^}]*registry[[:space:]]*=[[:space:]]*\"$REGISTRY\".*/\1/p" "$@"
|
|
}
|
|
names=$(registry_deps "${manifests[@]}" | sort -u)
|
|
# Transitive closure through the neighbours: a dependency of a patched neighbour (a -> a-macros)
|
|
# must be patched too, otherwise the project builds the neighbour against the published version of its own
|
|
# dependency and not against the neighbouring code.
|
|
while :; do
|
|
more=$(for n in $names; do [ -f "../$n/Cargo.toml" ] && registry_deps "../$n/Cargo.toml"; done | sort -u)
|
|
merged=$(printf '%s\n%s\n' "$names" "$more" | sed '/^$/d' | sort -u)
|
|
[ "$merged" = "$names" ] && break
|
|
names=$merged
|
|
done
|
|
|
|
patches=""
|
|
for n in $names; do
|
|
[ "$n" = "$self" ] && continue
|
|
[ -f "../$n/Cargo.toml" ] && patches+="$n = { path = \"../$n\" }"$'\n'
|
|
done
|
|
|
|
new="$marker on every \`make\`: do not edit, do not commit (ignored by the repository).
|
|
# Private registry and, for joint development, dependencies resolved to the neighbouring folders.
|
|
[registries.$REGISTRY]
|
|
index = \"$REGISTRY_INDEX\"
|
|
"
|
|
[ -n "$patches" ] && new+="
|
|
[patch.$REGISTRY]
|
|
$patches"
|
|
|
|
if [ ! -f "$config" ] || [ "$(cat "$config")" != "${new%$'\n'}" ]; then
|
|
mkdir -p .cargo
|
|
printf '%s' "$new" >"$config"
|
|
list=$(printf '%s' "$patches" | sed 's/ = .*//' | paste -sd' ' -)
|
|
info " $config updated (local patches: ${list:-none})"
|
|
fi
|