Introduce the `.crate-kit` infrastructure to standardize build, testing, and release workflows using Jujutsu and Cargo. Add CeCILL-2.1 license files and update all workspace crate manifests with license and repository metadata. - Add `.crate-kit/` directory with `VERSION`, `crate.mk`, `dev-patch.mk`, `jj.mk`, and `org.mk` to define build targets, Jujutsu helpers, and registry configuration for the workspace. - Add 21 shell scripts in `.crate-kit/scripts/` for API tracking, dependency checking, version bumping, publishing, tagging, and wiki generation, including `common.sh` with shared utility functions. - Add `scripts/jj-tag.sh` to support tagging commits with version strings derived from the current crate version. - Add `LICENSE` and `LICENSE.en` files containing the CeCILL-2.1 free software license agreement in French and English. - Update `Makefile` with new targets for building, testing, formatting, CI, and releasing, integrating with `.crate-kit` scripts and updating the wiki directory path to `obiskim`. - Update `.gitignore` to ignore `.cargo/config.toml` files generated by the development patch system. - Add `license = "CECILL-2.1"` and `repository = "https://forge.metabarcoding.org/obi/obiskim"` to all `Cargo.toml` files in the workspace, including `obicompactvec`, `obidebruinj`, `obifastwrite`, `obikalgorithm`, `obikdump`, `obikentropy`, `obikfilter`, `obikidxcache`, `obikindex`, `obikindexer`, `obikmer`, `obikmerge`, `obikphylo`, `obikquery`, `obikrebuild`, `obikrope`, `obikselect`, `obikseq`, `obiksession`, `obikstats`, `obipipeline`, `obiread`, `obiskbuilder`, `obiskio`, `obisys`, and `obitaxonomy`. - Update `src/obikrope/Cargo.toml` to use `criterion2` version 3 with the `cargo_bench_support` feature. - Update `src/obikseq/Cargo.toml` to replace the "OnceLock-based params" feature with a new feature description involving thread-local storage. - Update `src/Cargo.lock` to reflect the version bump of `obikmer` from 1.4.7 to 1.4.8.
68 lines
2.1 KiB
Bash
Executable File
68 lines
2.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Computes and applies the next version according to the public API (see api-level.sh):
|
|
# break -> x.y+1.0 while x = 0, otherwise x+1.0.0
|
|
# additions -> x.y+1.0 once x >= 1 (SemVer: new feature), x.y.z+1 while x = 0
|
|
# otherwise -> x.y.z+1
|
|
# RELEASE=x.y.z forces the version. Updates Cargo.toml, version.txt and the
|
|
# dependency line `<crate> = "x.y"` of README.md when they exist.
|
|
set -euo pipefail
|
|
. "$(dirname "$0")/common.sh"
|
|
|
|
warn "→ Computing the next version..."
|
|
current=$(current_version)
|
|
name=$(crate_name)
|
|
info " Current version: $current"
|
|
IFS=. read -r major minor patch <<<"$current"
|
|
|
|
if [ -n "${RELEASE:-}" ]; then
|
|
new_version="$RELEASE"
|
|
else
|
|
level=$("$(dirname "$0")/api-level.sh")
|
|
case "$level" in
|
|
breaking)
|
|
if [ "$major" = "0" ]; then
|
|
new_version="0.$((minor + 1)).0"
|
|
else
|
|
new_version="$((major + 1)).0.0"
|
|
fi
|
|
;;
|
|
additive)
|
|
if [ "$major" = "0" ]; then
|
|
new_version="0.$minor.$((patch + 1))"
|
|
else
|
|
new_version="$major.$((minor + 1)).0"
|
|
fi
|
|
;;
|
|
initial | unchanged)
|
|
new_version="$major.$minor.$((patch + 1))"
|
|
;;
|
|
*)
|
|
err "✗ unexpected API verdict: '$level'"
|
|
exit 1
|
|
;;
|
|
esac
|
|
fi
|
|
|
|
# No silent jump to another version: a break must never be downgraded.
|
|
rc=0
|
|
"$(dirname "$0")/tag-exists.sh" "$new_version" || rc=$?
|
|
case "$rc" in
|
|
0)
|
|
err "✗ The release version-$new_version already exists (locally or on the server)"
|
|
info " Use RELEASE=x.y.z to force another version"
|
|
exit 1
|
|
;;
|
|
1) ;;
|
|
*) warn " (remote tags not checked: no jj repository or origin unreachable)" ;;
|
|
esac
|
|
|
|
info " New version: $new_version"
|
|
sed -i.bak "s/^version = \"$current\"/version = \"$new_version\"/" "$CARGO_TOML"
|
|
rm "$CARGO_TOML.bak"
|
|
[ -f version.txt ] && echo "$new_version" >version.txt
|
|
if [ -f README.md ]; then
|
|
sed -i.bak "s/^$name = \"[0-9][0-9.]*\"/$name = \"$(echo "$new_version" | cut -d. -f1,2)\"/" README.md
|
|
rm README.md.bak
|
|
fi
|
|
ok "✓ Version $new_version written to $CARGO_TOML (and version.txt, README.md if they exist)"
|