From 8d322533af80c68a056b16a5f2caec8483d0b47b Mon Sep 17 00:00:00 2001 From: deftio Date: Sun, 19 Apr 2026 22:38:52 -0700 Subject: [PATCH 1/2] update ci tools --- README.md | 2 +- VERSION | 2 +- docs/releases.md | 7 ++ idf_component.yml | 2 +- library.json | 2 +- library.properties | 2 +- llms.txt | 2 +- pages/assets/site.js | 2 +- pages/releases.html | 7 ++ release_notes.md | 21 +++- src/FR_math.h | 4 +- src/FR_math_2D.cpp | 2 +- src/FR_math_2D.h | 2 +- tools/check_published_versions.sh | 158 ++++++++++++++++++++++++++++++ tools/make_release.sh | 11 ++- 15 files changed, 209 insertions(+), 17 deletions(-) create mode 100755 tools/check_published_versions.sh diff --git a/README.md b/README.md index 8e03fc9..e1b4e87 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![CI](https://github.com/deftio/fr_math/actions/workflows/ci.yml/badge.svg)](https://github.com/deftio/fr_math/actions/workflows/ci.yml) [![Coverage](https://img.shields.io/badge/coverage-99%25-brightgreen.svg)](#building-and-testing) [![Docs](https://img.shields.io/badge/docs-online-blue.svg)](https://deftio.github.io/fr_math/) -[![Version](https://img.shields.io/badge/version-2.0.4-blue.svg)](release_notes.md) +[![Version](https://img.shields.io/badge/version-2.0.5-blue.svg)](release_notes.md) # FR_Math: A C Language Fixed-Point Math Library for Embedded Systems diff --git a/VERSION b/VERSION index 2165f8f..e010258 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0.4 +2.0.5 diff --git a/docs/releases.md b/docs/releases.md index 92e0f1a..2f6e11c 100644 --- a/docs/releases.md +++ b/docs/releases.md @@ -4,6 +4,13 @@ Release highlights. For the full per-symbol change log, see [release_notes.md](https://github.com/deftio/fr_math/blob/master/release_notes.md) in the repo. +## v2.0.5 — 2026 + +Release pipeline fixes. Fixed squash-merge divergence handling and +on-master push/CI sequencing in `tools/make_release.sh`. + +--- + ## v2.0.4 — 2026 CI fix release. Fixed `release.yml` coverage step, release pipeline diff --git a/idf_component.yml b/idf_component.yml index e2ffd66..e9083b8 100644 --- a/idf_component.yml +++ b/idf_component.yml @@ -1,4 +1,4 @@ -version: "2.0.4" +version: "2.0.5" description: "Compact fixed-point math library for embedded systems. Integer-only with caller-selectable radix. Trig, log/exp, sqrt, hypot, wave generators, ADSR, and 2D transforms. Zero dependencies." url: "https://github.com/deftio/fr_math" repository: "https://github.com/deftio/fr_math.git" diff --git a/library.json b/library.json index 2b99532..a9a743c 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "FR_Math", - "version": "2.0.4", + "version": "2.0.5", "description": "Compact fixed-point math library for embedded systems. Integer-only with caller-selectable radix. Trig, log/exp, sqrt, hypot, wave generators, ADSR, and 2D transforms in 4KB of flash. Zero dependencies.", "keywords": [ "fixed-point", diff --git a/library.properties b/library.properties index 193a54e..ac2b952 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=FR_Math -version=2.0.4 +version=2.0.5 author=M. A. Chatterjee maintainer=M. A. Chatterjee sentence=Compact fixed-point math library for embedded systems. 4KB flash, zero dependencies, any radix. diff --git a/llms.txt b/llms.txt index f01d9fe..bd23772 100644 --- a/llms.txt +++ b/llms.txt @@ -9,7 +9,7 @@ or libraries. Pure C99, zero dependencies beyond ``. - Repository: https://github.com/deftio/fr_math - Documentation: https://deftio.github.io/fr_math/ - License: BSD-2-Clause -- Version: 2.0.4 +- Version: 2.0.5 ## Key concept: radix parameter diff --git a/pages/assets/site.js b/pages/assets/site.js index 50487f6..8fff01d 100644 --- a/pages/assets/site.js +++ b/pages/assets/site.js @@ -16,7 +16,7 @@ ════════════════════════════════════════════════════════════════════ */ (function () { - var FR_VERSION = 'v2.0.4'; + var FR_VERSION = 'v2.0.5'; // Detect whether we're a top-level page or inside guide/. // Works for both file:// and http(s):// because we look for the diff --git a/pages/releases.html b/pages/releases.html index 9c6272d..d87abe0 100644 --- a/pages/releases.html +++ b/pages/releases.html @@ -21,6 +21,13 @@

Releases

release_notes.md in the repo.

+

v2.0.5 — 2026

+ +

Release pipeline fixes. Fixed squash-merge divergence handling and +on-master push/CI sequencing in tools/make_release.sh.

+ +
+

v2.0.4 — 2026

CI fix release. Fixed release.yml coverage step, release pipeline diff --git a/release_notes.md b/release_notes.md index 48e951b..c4c9ee5 100644 --- a/release_notes.md +++ b/release_notes.md @@ -1,18 +1,29 @@ # FR_Math Release Notes +## Version 2.0.5 (2026) + +Release pipeline fixes. No functional changes to the math library. + +- Fixed `tools/make_release.sh` failing after squash-merge: local master + diverges from origin (squash creates a new commit), so `git pull + --ff-only` fails. Now detects divergence and resets to origin/master. +- Fixed on-master release path: script now pushes master to origin and + waits for CI before tagging (previously skipped both, causing tags to + point at commits not yet on the remote). +- Release pipeline auto-commits pipeline-generated changes (badge + updates, version sync) instead of failing on a dirty working tree. + Unexpected dirty files still block the release. + ## Version 2.0.4 (2026) CI fix release. No functional changes to the math library. - Fixed `release.yml` coverage step failing due to stale gcov invocation -- Release pipeline (`tools/make_release.sh`) now auto-commits - pipeline-generated changes (badge updates, version sync) instead of - failing on a dirty working tree - Removed conflicting auto-release job from `ci.yml` (replaced by tag-triggered `release.yml`) - Documentation updated: `release_management.md`, `docs/building.md`, - and `pages/guide/building.html` now accurately describe the 17-step - guided release pipeline + and `pages/guide/building.html` now accurately describe the guided + release pipeline --- diff --git a/src/FR_math.h b/src/FR_math.h index 5c1983a..82bea96 100644 --- a/src/FR_math.h +++ b/src/FR_math.h @@ -32,8 +32,8 @@ #ifndef __FR_Math_h__ #define __FR_Math_h__ -#define FR_MATH_VERSION "2.0.4" -#define FR_MATH_VERSION_HEX 0x020004 /* major << 16 | minor << 8 | patch */ +#define FR_MATH_VERSION "2.0.5" +#define FR_MATH_VERSION_HEX 0x020005 /* major << 16 | minor << 8 | patch */ #ifdef __cplusplus extern "C" diff --git a/src/FR_math_2D.cpp b/src/FR_math_2D.cpp index 80e8447..31132bf 100644 --- a/src/FR_math_2D.cpp +++ b/src/FR_math_2D.cpp @@ -5,7 +5,7 @@ * * @copy Copyright (C) <2001-2026> * @author M A Chatterjee - * @version 2.0.4 M. A. Chatterjee, cleaned up naming + * @version 2.0.5 M. A. Chatterjee, cleaned up naming * * This file contains integer math settable fixed point radix math routines for * use on systems in which floating point is not desired or unavailable. diff --git a/src/FR_math_2D.h b/src/FR_math_2D.h index 89b01a5..1045577 100644 --- a/src/FR_math_2D.h +++ b/src/FR_math_2D.h @@ -3,7 +3,7 @@ * * @copy Copyright (C) <2001-2026> * @author M A Chatterjee - * @version 2.0.4 M. A. Chatterjee, cleaned up naming + * @version 2.0.5 M. A. Chatterjee, cleaned up naming * * This file contains integer math settable fixed point radix math routines for * use on systems in which floating point is not desired or unavailable. diff --git a/tools/check_published_versions.sh b/tools/check_published_versions.sh new file mode 100755 index 0000000..99b2dc4 --- /dev/null +++ b/tools/check_published_versions.sh @@ -0,0 +1,158 @@ +#!/usr/bin/env bash +# +# check_published_versions.sh — show the published version of FR_Math +# on every distribution channel alongside the local source version. +# +# Usage: +# bash tools/check_published_versions.sh +# +# Channels checked: +# - Local source (FR_MATH_VERSION_HEX in src/FR_math.h) +# - GitHub Releases (gh CLI or GitHub API) +# - Arduino Library Manager (arduino-cli or library index API) +# - PlatformIO Registry (pio CLI or registry API) +# - ESP-IDF Component Registry (API only; compote has no query command) + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)" + +# Colors (disabled if stdout is not a TTY). +if [[ -t 1 ]]; then + GREEN='\033[0;32m' + YELLOW='\033[1;33m' + RED='\033[0;31m' + CYAN='\033[0;36m' + NC='\033[0m' +else + GREEN='' + YELLOW='' + RED='' + CYAN='' + NC='' +fi + +# ----------------------------------------------------------------------- +# Local source version +# ----------------------------------------------------------------------- +LOCAL_VER="unknown" +H_FILE="${PROJECT_ROOT}/src/FR_math.h" +if [[ -f "${H_FILE}" ]]; then + RAW_HEX=$(grep '#define FR_MATH_VERSION_HEX' "${H_FILE}" | awk '{print $3}' | tr -d '\r') + if [[ -n "${RAW_HEX}" ]]; then + HEX_NUM=$((RAW_HEX)) + V_MAJ=$(( (HEX_NUM >> 16) & 0xff )) + V_MIN=$(( (HEX_NUM >> 8) & 0xff )) + V_PAT=$(( HEX_NUM & 0xff )) + LOCAL_VER="${V_MAJ}.${V_MIN}.${V_PAT}" + fi +fi + +# ----------------------------------------------------------------------- +# GitHub Releases +# ----------------------------------------------------------------------- +get_github_version() { + if command -v gh &>/dev/null; then + gh api repos/deftio/fr_math/releases/latest --jq '.tag_name' 2>/dev/null | sed 's/^v//' || echo "not found" + elif command -v curl &>/dev/null; then + curl -sf https://api.github.com/repos/deftio/fr_math/releases/latest \ + | python3 -c "import sys,json; print(json.load(sys.stdin).get('tag_name','not found').lstrip('v'))" 2>/dev/null || echo "not found" + else + echo "no tool" + fi +} + +# ----------------------------------------------------------------------- +# Arduino Library Manager +# ----------------------------------------------------------------------- +get_arduino_version() { + if command -v arduino-cli &>/dev/null; then + local result + result=$(arduino-cli lib search "FR_Math" 2>/dev/null || true) + if echo "$result" | grep -q "FR_Math"; then + echo "$result" | grep -A1 "^Name:" | grep "Version:" | awk '{print $2}' || echo "not found" + else + echo "not registered" + fi + elif command -v curl &>/dev/null; then + local ver + ver=$(curl -sf https://downloads.arduino.cc/libraries/library_index.json.gz 2>/dev/null \ + | gunzip 2>/dev/null \ + | python3 -c " +import sys, json +data = json.load(sys.stdin) +libs = [l for l in data['libraries'] if l['name'] == 'FR_Math'] +if libs: + latest = max(libs, key=lambda x: x['version']) + print(latest['version']) +else: + print('not registered') +" 2>/dev/null || echo "error") + echo "$ver" + else + echo "no tool" + fi +} + +# ----------------------------------------------------------------------- +# PlatformIO Registry +# ----------------------------------------------------------------------- +get_platformio_version() { + if command -v pio &>/dev/null; then + pio pkg show deftio/FR_Math 2>/dev/null \ + | grep -i 'library' | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1 || echo "not found" + elif command -v curl &>/dev/null; then + curl -sf "https://registry.platformio.org/api/packages/deftio/library/FR_Math" \ + | python3 -c "import sys,json; print(json.load(sys.stdin)['version']['name'])" 2>/dev/null || echo "not found" + else + echo "no tool" + fi +} + +# ----------------------------------------------------------------------- +# ESP-IDF Component Registry +# ----------------------------------------------------------------------- +get_espressif_version() { + if command -v curl &>/dev/null; then + curl -sf "https://components.espressif.com/api/components/deftio/fr_math" \ + | python3 -c "import sys,json; print(json.load(sys.stdin)['versions'][0]['version'])" 2>/dev/null || echo "not found" + else + echo "no tool" + fi +} + +# ----------------------------------------------------------------------- +# Print results +# ----------------------------------------------------------------------- +echo "" +echo -e "${CYAN}FR_Math Published Versions${NC}" +echo "==========================" +echo "" + +BRANCH=$(git -C "${PROJECT_ROOT}" rev-parse --abbrev-ref HEAD 2>/dev/null || echo "unknown") +printf " %-22s %s\n" "Branch:" "${BRANCH}" +printf " %-22s %s\n" "Local version:" "${LOCAL_VER}" +echo "" + +GITHUB_VER=$(get_github_version) +ARDUINO_VER=$(get_arduino_version) +PIO_VER=$(get_platformio_version) +ESP_VER=$(get_espressif_version) + +color_version() { + local ver="$1" + if [[ "$ver" == "$LOCAL_VER" ]]; then + echo -e "${GREEN}${ver}${NC}" + elif [[ "$ver" == "not found" || "$ver" == "not registered" || "$ver" == "no tool" || "$ver" == "error" ]]; then + echo -e "${YELLOW}${ver}${NC}" + else + echo -e "${RED}${ver}${NC} (drift)" + fi +} + +printf " %-22s %b\n" "GitHub Releases:" "$(color_version "$GITHUB_VER")" +printf " %-22s %b\n" "Arduino Library:" "$(color_version "$ARDUINO_VER")" +printf " %-22s %b\n" "PlatformIO Registry:" "$(color_version "$PIO_VER")" +printf " %-22s %b\n" "ESP-IDF Components:" "$(color_version "$ESP_VER")" +echo "" diff --git a/tools/make_release.sh b/tools/make_release.sh index 0ef6fb5..11aaed5 100755 --- a/tools/make_release.sh +++ b/tools/make_release.sh @@ -608,7 +608,16 @@ do_switch_master() { fi run_cmd git checkout master - run_cmd git pull --ff-only origin master + run_cmd git fetch origin master + # After a squash-merge, local master and origin/master have diverged + # (the squash commit is a new commit). Reset to origin/master which + # has the authoritative squash-merged content. + if ! git merge-base --is-ancestor origin/master HEAD 2>/dev/null; then + echo " Local master diverged from origin (expected after squash-merge)." + run_cmd git reset --hard origin/master + else + run_cmd git pull --ff-only origin master + fi BRANCH="master" ON_MASTER=true pass "On master at $(git rev-parse --short HEAD)." From db7c36b5d5a95b92690a5a81b4d4c324262f294d Mon Sep 17 00:00:00 2001 From: deftio Date: Sun, 19 Apr 2026 23:56:15 -0700 Subject: [PATCH 2/2] fixed ci script error --- tools/make_release.sh | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/tools/make_release.sh b/tools/make_release.sh index 11aaed5..441181d 100755 --- a/tools/make_release.sh +++ b/tools/make_release.sh @@ -364,15 +364,24 @@ do_push_branch() { fi fi - # Check if we're ahead of origin (works for both master and feature branches). - local ahead - ahead=$(git rev-list --count "origin/$BRANCH..HEAD" 2>/dev/null || echo "0") - if [ "$ahead" -eq 0 ]; then - pass "$BRANCH is up to date with origin." - return 0 + # Check if remote branch exists and whether we're ahead. + local remote_exists=true + if ! git rev-parse --verify "origin/$BRANCH" &>/dev/null; then + remote_exists=false + fi + + if $remote_exists; then + local ahead + ahead=$(git rev-list --count "origin/$BRANCH..HEAD" 2>/dev/null || echo "0") + if [ "$ahead" -eq 0 ]; then + pass "$BRANCH is up to date with origin." + return 0 + fi + echo " $ahead commit(s) ahead of origin/$BRANCH." + else + echo " Remote branch origin/$BRANCH does not exist yet." fi - echo " $ahead commit(s) ahead of origin/$BRANCH." confirm "Push $BRANCH to origin?" run_cmd git push -u origin "$BRANCH" pass "Pushed."