ci: run clang-format.py script

This commit is contained in:
Anton Kochkov 2023-08-03 14:28:19 +08:00 committed by Anton Kochkov
parent b3181b5493
commit 0d9851c1e0

View File

@ -26,27 +26,34 @@ jobs:
- '**.c' - '**.c'
- '**.h' - '**.h'
- '.github/workflows/linter.yml' - '.github/workflows/linter.yml'
- 'scripts/clang-format.py'
- '_clang-format'
clang-format: clang-format:
needs: changes needs: changes
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
if: ${{ needs.changes.outputs.clang-format == 'true' }} if: ${{ needs.changes.outputs.clang-format == 'true' }}
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Install wget - name: Install wget, software-properties-common, lsb-release (dependencies of LLVM install script)
run: sudo apt --assume-yes install wget run: sudo apt --assume-yes install wget software-properties-common lsb-release
- name: Install automatic llvm (stable branch) - name: Uninstall old conflicting packages
run: sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" run: sudo apt purge --assume-yes --auto-remove llvm python3-lldb-14 llvm-14
- name: Install clang-format-11 - name: Install automatic LLVM 16
run: sudo apt --assume-yes install clang-format-11 run: wget https://apt.llvm.org/llvm.sh -O /tmp/llvm-install.sh; chmod +x /tmp/llvm-install.sh; sudo /tmp/llvm-install.sh 16
- name: Install clang-format-16
run: sudo apt --assume-yes install clang-format-16
- name: Install gitpython - name: Install gitpython
run: sudo pip install gitpython run: sudo pip install gitpython
- name: Run clang-format - name: Run clang-format
run: | run: |
find ./src -regex '.*\.\(cpp\|h\|c\)' -exec clang-format -style=file --dry-run --Werror {} \; sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-16 160
clang-format --version
python scripts/clang-format.py --check --verbose