Skip to content

Update version macro #15

Update version macro

Update version macro #15

Workflow file for this run

name: Format check
on:
push:
branches:
- '*'
jobs:
format-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Clang-Format
run: |
if ! command -v clang-format &> /dev/null; then
echo "Clang-Format not found, installing..."
sudo apt-get update
sudo apt-get install -y clang-format
else
echo "Clang-Format is already installed."
fi
- name: Check formatting
run: |
# Find all C/C++ files and check formatting
files=$(find . -name '*.h' -o -name '*.c' -o -name '*.hpp' -o -name '*.cpp')
if [ -z "$files" ]; then
echo "No C/C++ files found."
exit 0
fi
# Initialize a flag to track formatting issues
formatting_issues=0
# Check formatting for each file
for file in $files; do
if clang-format -style=file -output-replacements-xml "$file" | grep -q '<replacement '; then
echo "Formatting issues found in $file"
formatting_issues=1
fi
done
# Exit with the appropriate status code
if [ $formatting_issues -eq 1 ]; then
echo "Please format the files using clang-format version "$(clang-format --version)" and commit the changes."
exit 1
else
echo "All files are properly formatted."
exit 0
fi