chore: add crate-kit build system and CeCILL license
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.
This commit is contained in:
1 parent
58e57ceae5
commit
8159137f8b
59 files changed
+3102
-17
No files matched your search
@@ -29,16 +29,66 @@ $(MKDOCS): $(VENV)/bin/activate
|
||||
mkdocs-bibtex
|
||||
$(PIP) install --quiet --upgrade InSilicoSeq
|
||||
|
||||
# ── standard targets (names and behaviour follow crate-kit's crate.mk) ───────────
|
||||
# obiskim is an application workspace: cargo runs on $(CARGO_DIR)/Cargo.toml, default features.
|
||||
|
||||
CARGO ?= cargo
|
||||
CARGO_MANIFEST := $(CARGO_DIR)/Cargo.toml
|
||||
GREEN ?= \033[0;32m
|
||||
YELLOW ?= \033[1;33m
|
||||
BLUE ?= \033[1;34m
|
||||
NC ?= \033[0m
|
||||
|
||||
.DEFAULT_GOAL := build
|
||||
|
||||
.PHONY: help build release test check fmt fmt-check clippy ci
|
||||
## help: Lists the documented targets (this Makefile and the kit's)
|
||||
help:
|
||||
@echo "$(GREEN)Available commands:$(NC)"
|
||||
@sed -n "s/^## *\([^:]*\): */\1$$(printf '\t')/p" $(MAKEFILE_LIST) | column -t -s "$$(printf '\t')" | sed -e 's/^/ /'
|
||||
|
||||
## build: Release build of the obikmer binary (alias of release)
|
||||
build: release
|
||||
|
||||
## release: Release build of the obikmer binary
|
||||
release: obikmer
|
||||
|
||||
## test: Workspace tests
|
||||
test:
|
||||
$(CARGO) test --workspace --manifest-path $(CARGO_MANIFEST)
|
||||
|
||||
## check: Code check (all targets of the workspace)
|
||||
check:
|
||||
$(CARGO) check --workspace --all-targets --manifest-path $(CARGO_MANIFEST)
|
||||
|
||||
## fmt: Code formatting
|
||||
fmt:
|
||||
$(CARGO) fmt --all --manifest-path $(CARGO_MANIFEST)
|
||||
|
||||
## fmt-check: Formatting check
|
||||
fmt-check:
|
||||
$(CARGO) fmt --all --manifest-path $(CARGO_MANIFEST) -- --check
|
||||
|
||||
## clippy: Static analysis (warnings = errors)
|
||||
clippy:
|
||||
$(CARGO) clippy --workspace --all-targets --manifest-path $(CARGO_MANIFEST) -- -D warnings
|
||||
|
||||
## ci: Verification pipeline (deps-check fmt-check clippy test)
|
||||
ci: deps-check fmt-check clippy test
|
||||
@echo "$(GREEN)✓ All CI checks passed$(NC)"
|
||||
|
||||
# ── obikmer binary ───────────────────────────────────────────────────────────
|
||||
|
||||
PROFILE_FILE := profile.pb
|
||||
PPROF_PORT := 8081
|
||||
|
||||
.PHONY: obikmer
|
||||
## obikmer: Release build of the obikmer binary
|
||||
obikmer:
|
||||
cargo build --release --manifest-path $(CARGO_DIR)/Cargo.toml --bin obikmer
|
||||
|
||||
.PHONY: debug
|
||||
## debug: Debug build of the obikmer binary
|
||||
debug:
|
||||
cargo build --manifest-path $(CARGO_DIR)/Cargo.toml --bin obikmer
|
||||
|
||||
@@ -53,6 +103,7 @@ profile-view:
|
||||
# ── documentation ─────────────────────────────────────────────────────────────
|
||||
|
||||
.PHONY: doc
|
||||
## doc: Builds the developer documentation (DevDoc/)
|
||||
doc: $(MKDOCS)
|
||||
$(MKDOCS) build -f $(DOC_FILE)
|
||||
|
||||
@@ -66,6 +117,7 @@ clean-doc:
|
||||
rm -rf $(DOC_SITE)/
|
||||
|
||||
.PHONY: doc-user
|
||||
## doc-user: Builds the user documentation (doc/)
|
||||
doc-user: $(MKDOCS)
|
||||
$(MKDOCS) build -f $(DOC_USER_FILE)
|
||||
|
||||
@@ -82,9 +134,10 @@ clean-doc-user:
|
||||
# Regenerates the Gitea/Forgejo wiki (a separate repository, checked out next
|
||||
# to this one) from the user documentation. Only rewrites its working tree:
|
||||
# committing and pushing it stays a manual step. Not part of `clean`.
|
||||
DOC_WIKI_DIR := ../obikmer.wiki
|
||||
DOC_WIKI_DIR := ../obiskim.wiki
|
||||
|
||||
.PHONY: wiki
|
||||
## wiki: Regenerates the wiki working tree (../obiskim.wiki); commit and push stay manual
|
||||
wiki:
|
||||
@command -v pmotransdoc >/dev/null || { echo "pmotransdoc not found in PATH" >&2; exit 1; }
|
||||
@test -d $(DOC_WIKI_DIR)/.git || { echo "$(DOC_WIKI_DIR) is not a git checkout of the wiki" >&2; exit 1; }
|
||||
@@ -94,12 +147,27 @@ wiki:
|
||||
clean: clean-doc clean-doc-user
|
||||
rm -rf $(VENV)
|
||||
|
||||
# ── release ───────────────────────────────────────────────────────────────────
|
||||
# ── release (jj only; the kit's norms for a repository that is not a crate) ───────
|
||||
# Version: patch bump of the obikmer crate (RELEASE=x.y.z forces it). Tag: v<version> (what release.yml
|
||||
# triggers on), created and pushed with jj, lightweight: the CI release body is the tagged commit's
|
||||
# message. Release notes: ReleaseNotes/version-<version>.md (jj release-notes), committed with the release.
|
||||
# No git command is run. The user runs `make jjrelease`; it never runs by itself.
|
||||
|
||||
CARGO_TOML := $(CARGO_DIR)/obikmer/Cargo.toml
|
||||
RELEASE_NOTES_DIR := ReleaseNotes
|
||||
API_DIR := api
|
||||
RELEASE_PROJECT_DESC := obiskim (Rust k-mer genomics tool)
|
||||
TAG_PREFIX := v
|
||||
# Backlog of outdated external dependencies: not enforced until TASK-24 of the obi backlog is done.
|
||||
# The private-registry check (neighbours, lock, duplicates) stays active.
|
||||
export DEPS_CHECK_EXTERNAL ?= 0
|
||||
export RELEASE_NOTES_DIR API_DIR RELEASE_PROJECT_DESC TAG_PREFIX
|
||||
|
||||
.PHONY: bump-version
|
||||
.PHONY: bump-version jjpush jjrelease bookmark-check print-%
|
||||
|
||||
## bump-version: Next patch version of the obikmer crate, or fixed RELEASE=x.y.z (refused if the tag exists)
|
||||
bump-version:
|
||||
@jj git fetch
|
||||
@current=$$(grep '^version = ' $(CARGO_TOML) | head -n 1 | sed 's/version = "\(.*\)"/\1/'); \
|
||||
if [ -n "$(RELEASE)" ]; then \
|
||||
new_version="$(RELEASE)"; \
|
||||
@@ -107,22 +175,59 @@ bump-version:
|
||||
major=$$(echo $$current | cut -d. -f1); \
|
||||
minor=$$(echo $$current | cut -d. -f2); \
|
||||
patch=$$(echo $$current | cut -d. -f3); \
|
||||
new_patch=$$((patch + 1)); \
|
||||
new_version="$$major.$$minor.$$new_patch"; \
|
||||
new_version="$$major.$$minor.$$((patch + 1))"; \
|
||||
fi; \
|
||||
if [ -n "$$(jj tag list "$(TAG_PREFIX)$$new_version" 2>/dev/null)" ]; then \
|
||||
echo "✗ tag $(TAG_PREFIX)$$new_version already exists (use RELEASE=x.y.z)" >&2; exit 1; \
|
||||
fi; \
|
||||
echo "Version: $$current -> $$new_version"; \
|
||||
sed -i.bak "s/^version = \"$$current\"/version = \"$$new_version\"/" $(CARGO_TOML) && \
|
||||
rm $(CARGO_TOML).bak
|
||||
|
||||
.PHONY: release
|
||||
release: bump-version
|
||||
## bookmark-check: Does main track main@origin? Otherwise the push of main would fail (read-only)
|
||||
bookmark-check:
|
||||
@.crate-kit/scripts/bookmark-check.sh
|
||||
|
||||
## jjpush: Documents the commit, advances main to it and pushes main (no PR branch), then starts a new commit
|
||||
jjpush: bookmark-check deps-check
|
||||
@echo "$(YELLOW)→ Pushing the commit to main...$(NC)"
|
||||
@jj auto-doc
|
||||
@jj git push --change @
|
||||
@new_version=$$(grep '^version = ' $(CARGO_TOML) | head -n 1 | sed 's/version = "\(.*\)"/\1/'); \
|
||||
git_hash=$$(jj log -r @ --no-graph -T 'commit_id'); \
|
||||
commits=$$(jj log -r 'latest(tags())..@' --no-graph -T 'description ++ "\n"' 2>/dev/null || \
|
||||
jj log --no-graph -T 'description ++ "\n"' --limit 30); \
|
||||
notes=$$(printf 'Write concise markdown release notes for obikmer (a Rust kmer genomics tool). Be technical and direct. Base them strictly on these commit messages:\n\n%s' "$$commits" | aichat 2>/dev/null); \
|
||||
tag_msg="$${notes:-Release v$$new_version}"; \
|
||||
git tag -a "v$$new_version" -m "$$tag_msg" "$$git_hash" && \
|
||||
git push origin "v$$new_version"
|
||||
@.crate-kit/scripts/push-main.sh
|
||||
@.crate-kit/scripts/new-commit.sh
|
||||
@echo "$(GREEN)✓ main pushed; new working commit created on top of it$(NC)"
|
||||
|
||||
## jjrelease: Release (ci, version bump, notes, push of main, tag v<version> pushed; release.yml then builds)
|
||||
jjrelease: bookmark-check ci bump-version
|
||||
@echo "$(BLUE)→ Documenting the undocumented commits...$(NC)"
|
||||
@jj auto-doc
|
||||
@.crate-kit/scripts/release-notes.sh
|
||||
@echo "$(BLUE)→ Documenting the current commit...$(NC)"
|
||||
@jj auto-doc
|
||||
@echo "$(BLUE)→ Pushing main...$(NC)"
|
||||
@.crate-kit/scripts/push-main.sh
|
||||
@scripts/jj-tag.sh
|
||||
@.crate-kit/scripts/new-commit.sh
|
||||
@echo "$(GREEN)✓ Tag pushed: the CI (release.yml) builds and publishes the release$(NC)"
|
||||
|
||||
## print-%: Value of a make variable (e.g. make print-REGISTRY)
|
||||
print-%:
|
||||
@echo '$($*)'
|
||||
|
||||
# ── crate-kit (registry `obi`, joint development) ─────────────────────────────
|
||||
# obiskim is an APPLICATION workspace, not a crate. It includes dev-patch.mk (private registry
|
||||
# definition, local patches to neighbouring crates, deps-check/deps-bump) and jj.mk (jjnew, jjfetch).
|
||||
# The crate targets of crate.mk (publish, api-*, kit-check: it requires a release.yaml workflow) do NOT
|
||||
# apply; the release targets above are the application's own, built on the kit's scripts.
|
||||
# .crate-kit/ is resynchronized from obi-kit (which assembles crate-kit) at every make, before the include.
|
||||
# Skipped when obi-kit is absent (CI, repository cloned alone): the committed copy is used.
|
||||
# Included last so that the default goal stays `build`.
|
||||
KIT_SRC ?= ../obi-kit
|
||||
$(shell [ -x '$(KIT_SRC)/tools/kit-copy.sh' ] && '$(KIT_SRC)/tools/kit-copy.sh' .crate-kit)
|
||||
|
||||
include .crate-kit/dev-patch.mk
|
||||
include .crate-kit/jj.mk
|
||||
|
||||
# Exported after the includes: KIT_LANG comes from org.mk (`?=`), and an earlier `export KIT_LANG` would
|
||||
# define it empty with GNU make 3.81 (macOS).
|
||||
export KIT_LANG CARGO_TOML
|
||||
export PMOJJ_LANG = $(KIT_LANG)
|
||||
Reference in new issue
Block a user