Update version macro #15
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |