ci(clang-format): add clang-format check workflow #4
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: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
clang-format-check: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the code from the repository | |
- name: Checkout the code | |
uses: actions/checkout@v3 | |
# Step 2: Add the official LLVM APT repository and install clang-format 20.0.0 | |
- name: Install clang-format 20.0.0 | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y wget software-properties-common | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh 20 | |
sudo apt-get install -y clang-format-20 | |
# Step 3: Run clang-format check | |
- name: Run clang-format check | |
run: | | |
FILES_TO_CHECK=$(find . -name "*.c" -o -name "*.h") | |
clang-format-20 -i $FILES_TO_CHECK --dry-run --Werror |