add clang format to CI

This commit is contained in:
Timofey Khoruzhii 2023-05-09 01:18:34 +03:00
parent 474c035b21
commit a675b64b5f
2 changed files with 37 additions and 0 deletions

12
.clang-format Normal file
View file

@ -0,0 +1,12 @@
BasedOnStyle: Google
AccessModifierOffset: -1
DerivePointerAlignment: false
IndentWidth: 2
ColumnLimit: 100
IncludeBlocks: Preserve
SortIncludes: false
AllowShortFunctionsOnASingleLine: Empty

View file

@ -0,0 +1,25 @@
name: Clang-format Check
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
clang-format-check:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install clang-format
run: sudo apt-get install -y clang-format
- name: Check code formatting
run: |
find . -type f -regex '.*\.\(cpp\|hpp\|c\|h\)' -exec clang-format -style=file -i {} \;
git diff --exit-code