Merge pull request #187 from Sichao25/yus/spline_interpolator #17
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: [ develop ] | |
| pull_request: | |
| branches: [ develop ] | |
| jobs: | |
| format-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' | |
| - name: Install clang-format | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y clang-format-18 | |
| - name: Install cmake-format | |
| run: pip install PyYAML cmake-format==0.6.13 | |
| - name: Check C++ code format | |
| run: | | |
| EXIT_CODE=0 | |
| while read file; do | |
| if ! clang-format --dry-run --Werror "$file"; then | |
| echo "$file is not properly formatted" | |
| echo "Run: clang-format -i $file" | |
| EXIT_CODE=1 | |
| fi | |
| done < <(find . -name "*.cpp" -o -name "*.hpp" -o -name "*.c" -o -name "*.h" -o -name "*.cc" -o -name "*.cxx") | |
| if [ $EXIT_CODE -eq 1 ]; then | |
| echo "Some C/C++ files are not properly formatted" | |
| exit 1 | |
| fi | |
| echo "All C/C++ files are properly formatted" | |
| - name: Check CMake code format | |
| run: | | |
| EXIT_CODE=0 | |
| while read file; do | |
| if ! cmake-format --check "$file"; then | |
| echo "$file is not properly formatted. Reformat with clang-format-18." | |
| echo "Run: cmake-format -i $file" | |
| EXIT_CODE=1 | |
| fi | |
| done < <(find . -name "CMakeLists.txt" -o -name "*.cmake") | |
| if [ $EXIT_CODE -eq 1 ]; then | |
| echo "Some CMake files are not properly formatted. Reformat with cmake-format 0.6.13." | |
| exit 1 | |
| fi | |
| echo "All CMake files are properly formatted" |