virittaa

Log | Files | Refs | README | LICENSE

commit 605d95190ed2fbf58388e589ba6e410d12a04878
parent 67ffb74fddf4e07cf4587b3753c4507996cb4308
Author: mtmn <miro@haravara.org>
Date:   Sun, 14 Jun 2026 13:20:03 +0200

build: rework release script, add BSD build opts

Diffstat:
A.cargo/config.toml | 8++++++++
DCHANGELOG.md | 66------------------------------------------------------------------
Dcliff.toml | 45---------------------------------------------
Mhack/release | 91++++++++++++++++++++++++++++++++++++++++++++-----------------------------------
4 files changed, 59 insertions(+), 151 deletions(-)

diff --git a/.cargo/config.toml b/.cargo/config.toml @@ -0,0 +1,8 @@ +[target.x86_64-unknown-freebsd] +rustflags = ["-C", "target-cpu=x86-64"] + +[target.x86_64-unknown-openbsd] +rustflags = ["-C", "target-cpu=x86-64"] + +[alias] +zb-freebsd = "zigbuild --release --target x86_64-unknown-freebsd" diff --git a/CHANGELOG.md b/CHANGELOG.md @@ -1,66 +0,0 @@ -# Changelog - -## [1.2.1] - 2026-05-17 - -### Dependencies - -- **deps:** Update `ogg_pager` to 0.7.2 ([`8083c5c`](https://git.sr.ht/~mtmn/virittaa/commit/8083c5c61a418e175365180a37a66abcb2489ab4)) - -## [1.2.0] - 2026-05-14 - -### Features - -- Rework cli, update sled ([`b4f514b`](https://git.sr.ht/~mtmn/virittaa/commit/b4f514be3b06a3897179331687cac0844089fa07)) - -## [1.1.0] - 2026-05-14 - -### Bug Fixes - -- Report code leftovers; search fix ([`e75cff3`](https://git.sr.ht/~mtmn/virittaa/commit/e75cff3b66887e210a690a05183719b9ff2ce0bc)) -- Print most recent at the bottom when listing ([`e7b3d49`](https://git.sr.ht/~mtmn/virittaa/commit/e7b3d49450c49c0c58020ebc32625f5ae726aba7)) - -### Features - -- Add timestamp to db entries ([`b15c402`](https://git.sr.ht/~mtmn/virittaa/commit/b15c402ae352767c978b2637ab0b152054a6df38)) - -## [1.0.1] - 2026-05-14 - -### Bug Fixes - -- Handle oob bpm range ([`777c402`](https://git.sr.ht/~mtmn/virittaa/commit/777c402909372bd380b73ddc0019630a789db099)) -- Respect `--limit` on each argument ([`e1d7e9c`](https://git.sr.ht/~mtmn/virittaa/commit/e1d7e9cc5877f5639f4aa6b411816d62dfa11bc2)) - -## [1.0.0] - 2026-05-14 - -### Features - -- Store metadata in virittaa.db ([`b44df35`](https://git.sr.ht/~mtmn/virittaa/commit/b44df3563bdf09df96415f324d6d11bf7d9c4c8e)) -- **breaking:** Deprecate csv report; default db path ([`48dfccd`](https://git.sr.ht/~mtmn/virittaa/commit/48dfccd5d56b01f40f86c515b5feb6c54358d7c0)) -- Move helpers into utils.rs ([`1a2fc99`](https://git.sr.ht/~mtmn/virittaa/commit/1a2fc99e702712236695b83983e00b20337a5ecb)) - -## [0.3.0] - 2026-05-11 - -### Features - -- Perf improvements ([`fc759a0`](https://git.sr.ht/~mtmn/virittaa/commit/fc759a04e0b72ab6dffe3130f17c19e176cf55cb)) - -## [0.2.0] - 2026-05-07 - -### Features - -- Enable bindgen for aubio-rs to support aarch64-darwin ([`1043169`](https://git.sr.ht/~mtmn/virittaa/commit/10431695be2d9f4b930837d8ee697d4d19bc0d67)) - -## [0.1.1] - 2026-05-07 - -### Bug Fixes - -- Glibc overrides for aarch64-darwin ([`fdf7a7e`](https://git.sr.ht/~mtmn/virittaa/commit/fdf7a7ea8579cd7077a058c4551978b4d33beb29)) - -## [0.1.0] - -### Features - -- Init ([`a654643`](https://git.sr.ht/~mtmn/virittaa/commit/a6546430e05fb631e2d609102cf5c8aabc6b96de)) -- Rename `--write`, rustfmt, cargo.lock ([`328ffa5`](https://git.sr.ht/~mtmn/virittaa/commit/328ffa576ef9923de7a0229535e50ec0bf9685ec)) -- Add nix flake with cross-platform builds ([`6865860`](https://git.sr.ht/~mtmn/virittaa/commit/6865860ceb6cf4ae5248b35632f9568f241415bb)) -- Add release script ([`a53937d`](https://git.sr.ht/~mtmn/virittaa/commit/a53937dbafce481629b057e12964f8f8f2863d34)) diff --git a/cliff.toml b/cliff.toml @@ -1,45 +0,0 @@ -[changelog] -header = "# Changelog\n\n" -body = """ -{% if version -%} -## [{{ version | trim_start_matches(pat="v") }}]{% if previous.version %} - {{ timestamp | date(format="%Y-%m-%d") }}{% endif %} - -{% else -%} -## [Unreleased] - -{% endif -%} -{% for group, commits in commits | group_by(attribute="group") -%} -### {{ group }} - -{% for commit in commits -%} -- {% if commit.breaking %}**breaking:** {% endif -%} -{% if commit.scope %}**{{ commit.scope }}:** {% endif -%} -{{ commit.message | upper_first }} \ -([`{{ commit.id | truncate(length=7, end="") }}`](https://git.sr.ht/~mtmn/virittaa/commit/{{ commit.id }})) -{% endfor %} -{% endfor %} -""" -footer = "" -trim = true - -[git] -conventional_commits = true -filter_unconventional = true -split_commits = false -commit_parsers = [ - { message = "^feat", group = "Features" }, - { message = "^fix", group = "Bug Fixes" }, - { message = "^docs", group = "Documentation" }, - { message = "^test", group = "Testing" }, - { message = "^chore\\(deps\\)", group = "Dependencies" }, - { message = "^chore", skip = true }, - { message = "^ci", skip = true }, -] -protect_breaking_commits = true -filter_commits = true -tag_pattern = "v[0-9].*" -topo_order = false -sort_commits = "oldest" - -[bump] -initial_tag = "v0.1.0" diff --git a/hack/release b/hack/release @@ -1,55 +1,66 @@ #!/usr/bin/env bash set -euo pipefail +cd "$(dirname "$0")/.." -require() { - command -v "$1" &>/dev/null || { - echo "error: $1 not found" - exit 1 - } -} -require git -require git-cliff - -# --- pre-flight --- +BRANCH="master" +REMOTE="origin" -if [ "$(git rev-parse --abbrev-ref HEAD)" != "master" ]; then - echo "error: not on master branch" +die() { + echo "error: $*" >&2 exit 1 -fi +} -if [ -n "$(git status --porcelain)" ]; then - echo "error: working tree is dirty" - exit 1 -fi +update_version_file() { + local version="$1" + [ -f Cargo.toml ] || return 0 + sed -i "s/^version = .*/version = \"$version\"/" Cargo.toml + git add Cargo.toml + if command -v cargo >/dev/null 2>&1; then + cargo generate-lockfile + [ -f Cargo.lock ] && git add Cargo.lock + fi +} -# --- version calculation --- +command -v git >/dev/null 2>&1 || die "git not found" -next=$(git-cliff --bumped-version | sed 's/^v//') +usage="usage: $(basename "$0") current | <version> [--push]" -if git tag | grep -qx "v$next"; then - echo "no releasable commits since v$next" +if [ "${1:-}" = "current" ]; then + [ "$#" -eq 1 ] || die "$usage" + latest=$(git tag --list 'v[0-9]*' --sort=-v:refname | head -n1) + [ -n "$latest" ] || die "no release tags yet" + echo "${latest#v}" exit 0 fi -echo "releasing -> v$next" - -# --- update Cargo.toml --- - -sed -i "s/^version = .*/version = \"$next\"/" Cargo.toml -cargo generate-lockfile -git add Cargo.toml Cargo.lock - -# --- changelog --- - -git-cliff --tag "v$next" --output CHANGELOG.md -sed -i -e :a -e '/^\s*$/{$d;N;ba' -e '}' CHANGELOG.md -git add CHANGELOG.md - -git commit -m "chore: release v$next" +version="" +push=0 +for arg in "$@"; do + case "$arg" in + --push) push=1 ;; + -*) die "unknown flag: $arg" ;; + *) + [ -z "$version" ] || die "unexpected argument: $arg" + version="$arg" + ;; + esac +done + +[ -n "$version" ] || die "$usage" +echo "$version" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+([-+][0-9A-Za-z.-]+)*$' || + die "'$version' is not a semantic version" + +if [ "$push" -eq 0 ]; then + echo "would release v$version" + exit 0 +fi -# --- tag and push --- +[ "$(git rev-parse --abbrev-ref HEAD)" = "$BRANCH" ] || die "not on $BRANCH branch" +[ -z "$(git status --porcelain)" ] || die "working tree is dirty" +git rev-parse -q --verify "refs/tags/v$version" >/dev/null 2>&1 && die "tag v$version already exists" -git tag "v$next" -git push origin master --tags +update_version_file "$version" -echo "released v$next successfully" +git commit -m "release: v$version" +git tag -a "v$version" -m "v$version" +git push "$REMOTE" "$BRANCH" --follow-tags