Update clang-format-check.yml #112
This file contains 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: Clang-Format Check | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
check-format: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the code | |
- uses: actions/checkout@v3 | |
# Step 2: Install clang-format version 19 | |
- name: Install clang-format | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y clang-format-19 | |
sudo ln -sf /usr/bin/clang-format-19 /usr/bin/clang-format | |
- name: Check clang-format version | |
run: clang-format --version | |
# Step 3: Check formatting | |
- name: Run clang-format | |
run: | | |
# Find all .cpp and .hpp files | |
find . -name '*.cpp' -o -name '*.hpp' > files_to_check.txt | |
# Check if clang-format would make changes | |
clang-format --dry-run -Werror $(cat files_to_check.txt) |