Skip to content

Commit 5c3fa96

Browse files
devin-ai-integration[bot]zfields@blues.com
and
zfields@blues.com
authored
Add version check to ensure consistency between NoteDefines.h and library.properties (#137)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: zfields@blues.com <zfields@blues.com>
1 parent 9a3a264 commit 5c3fa96

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

.github/workflows/version-check.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Version Check
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
paths:
7+
- 'src/NoteDefines.h'
8+
- 'library.properties'
9+
pull_request:
10+
branches: [ master ]
11+
paths:
12+
- 'src/NoteDefines.h'
13+
- 'library.properties'
14+
workflow_dispatch:
15+
16+
jobs:
17+
check-version:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v3
22+
23+
- name: Check version consistency
24+
run: |
25+
chmod +x scripts/check_version.sh
26+
./scripts/check_version.sh

scripts/check_version.sh

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Script to check that the version in src/NoteDefines.h matches the version in library.properties
5+
# Usage: ./check_version.sh
6+
7+
# Get the version from library.properties
8+
LIBRARY_VERSION=$(grep "^version=" library.properties | cut -d= -f2)
9+
10+
# Get the version components from NoteDefines.h
11+
MAJOR=$(grep "NOTE_ARDUINO_VERSION_MAJOR" src/NoteDefines.h | grep -o "[0-9]\+")
12+
MINOR=$(grep "NOTE_ARDUINO_VERSION_MINOR" src/NoteDefines.h | grep -o "[0-9]\+")
13+
PATCH=$(grep "NOTE_ARDUINO_VERSION_PATCH" src/NoteDefines.h | grep -o "[0-9]\+")
14+
15+
# Construct the version string from the components
16+
DEFINES_VERSION="$MAJOR.$MINOR.$PATCH"
17+
18+
echo "Version in library.properties: $LIBRARY_VERSION"
19+
echo "Version in src/NoteDefines.h: $DEFINES_VERSION"
20+
21+
# Compare the versions
22+
if [ "$LIBRARY_VERSION" = "$DEFINES_VERSION" ]; then
23+
echo "✅ Versions match!"
24+
exit 0
25+
else
26+
echo "❌ Version mismatch!"
27+
echo "library.properties version: $LIBRARY_VERSION"
28+
echo "src/NoteDefines.h version: $DEFINES_VERSION"
29+
exit 1
30+
fi

0 commit comments

Comments
 (0)