Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,23 @@ on:
branches: [main]

jobs:
# Guard: the README version badge must match DIX_VERSION, so the static badge
# can never silently drift from the shipped version. Fix drift with
# `scripts/bump-version.sh <version>` (updates both in one shot).
version-badge:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: README version badge matches DIX_VERSION
run: |
code=$(grep -oE '#define DIX_VERSION "[0-9.]+"' waveform.c | grep -oE '[0-9]+(\.[0-9]+)+')
badge=$(grep -oE 'badge/version-[0-9.]+-orange' README.md | grep -oE '[0-9]+(\.[0-9]+)+')
echo "DIX_VERSION=$code README badge=$badge"
if [ -z "$code" ] || [ "$code" != "$badge" ]; then
echo "::error::README version badge ($badge) != DIX_VERSION ($code). Run scripts/bump-version.sh <version>."
exit 1
fi

# Pure DSP unit tests — no VLC needed, so they run natively on all three OSes.
unit-tests:
strategy:
Expand Down
24 changes: 24 additions & 0 deletions scripts/bump-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
# Bump the project version in ONE shot so the README version badge never drifts
# from the shipped version: updates DIX_VERSION in waveform.c AND the shields.io
# version badge in README.md. CI (the `version-badge` job) fails if they differ,
# so this is the supported way to bump.
#
# Usage: ./scripts/bump-version.sh 3.5.5
set -euo pipefail
cd "$(dirname "$0")/.."

V="${1:-}"
if [[ ! "$V" =~ ^[0-9]+\.[0-9]+(\.[0-9]+)?$ ]]; then
echo "usage: scripts/bump-version.sh X.Y[.Z] (e.g. 3.5.5)" >&2
exit 1
fi

# -i.bak works on both BSD (macOS) and GNU sed; remove the backup after.
sed -i.bak -E "s/#define DIX_VERSION \"[0-9.]+\"/#define DIX_VERSION \"$V\"/" waveform.c
sed -i.bak -E "s#badge/version-[0-9.]+-orange#badge/version-$V-orange#" README.md
rm -f waveform.c.bak README.md.bak

echo "bumped to $V:"
grep -n '#define DIX_VERSION' waveform.c
grep -no 'badge/version-[0-9.]*-orange' README.md
Loading