From 17d7c75458cb5f40e44c18dc69b52bb3f0ab950c Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 25 Feb 2025 19:26:12 +0000 Subject: [PATCH 1/2] Add version check to ensure consistency between NoteDefines.h and library.properties Co-Authored-By: zfields@blues.com --- .github/workflows/version-check.yml | 26 +++++++++++++++++++++++++ scripts/check_version.sh | 30 +++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 .github/workflows/version-check.yml create mode 100755 scripts/check_version.sh diff --git a/.github/workflows/version-check.yml b/.github/workflows/version-check.yml new file mode 100644 index 0000000..f8f447a --- /dev/null +++ b/.github/workflows/version-check.yml @@ -0,0 +1,26 @@ +name: Version Check + +on: + push: + branches: [ master ] + paths: + - 'src/NoteDefines.h' + - 'library.properties' + pull_request: + branches: [ master ] + paths: + - 'src/NoteDefines.h' + - 'library.properties' + workflow_dispatch: + +jobs: + check-version: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Check version consistency + run: | + chmod +x scripts/check_version.sh + ./scripts/check_version.sh diff --git a/scripts/check_version.sh b/scripts/check_version.sh new file mode 100755 index 0000000..d0cb031 --- /dev/null +++ b/scripts/check_version.sh @@ -0,0 +1,30 @@ +#!/bin/bash +set -e + +# Script to check that the version in src/NoteDefines.h matches the version in library.properties +# Usage: ./check_version.sh + +# Get the version from library.properties +LIBRARY_VERSION=$(grep "^version=" library.properties | cut -d= -f2) + +# Get the version components from NoteDefines.h +MAJOR=$(grep "NOTE_ARDUINO_VERSION_MAJOR" src/NoteDefines.h | grep -o "[0-9]\+") +MINOR=$(grep "NOTE_ARDUINO_VERSION_MINOR" src/NoteDefines.h | grep -o "[0-9]\+") +PATCH=$(grep "NOTE_ARDUINO_VERSION_PATCH" src/NoteDefines.h | grep -o "[0-9]\+") + +# Construct the version string from the components +DEFINES_VERSION="$MAJOR.$MINOR.$PATCH" + +echo "Version in library.properties: $LIBRARY_VERSION" +echo "Version in src/NoteDefines.h: $DEFINES_VERSION" + +# Compare the versions +if [ "$LIBRARY_VERSION" = "$DEFINES_VERSION" ]; then + echo "✅ Versions match!" + exit 0 +else + echo "❌ Version mismatch!" + echo "library.properties version: $LIBRARY_VERSION" + echo "src/NoteDefines.h version: $DEFINES_VERSION" + exit 1 +fi From 9c9afc296072ec0f8d4624ea5deed3b93b49a8d8 Mon Sep 17 00:00:00 2001 From: "Zachary J. Fields" Date: Tue, 25 Feb 2025 21:11:37 +0000 Subject: [PATCH 2/2] test: improper version check --- library.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.properties b/library.properties index 454790d..0c72709 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Blues Wireless Notecard -version=1.6.4 +version=2.6.4 author=Blues maintainer=Blues sentence=An easy to use Notecard Library for Arduino.