add clang format to CI
This commit is contained in:
parent
474c035b21
commit
a675b64b5f
2 changed files with 37 additions and 0 deletions
12
.clang-format
Normal file
12
.clang-format
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
|
||||||
|
AccessModifierOffset: -1
|
||||||
|
DerivePointerAlignment: false
|
||||||
|
|
||||||
|
IndentWidth: 2
|
||||||
|
ColumnLimit: 100
|
||||||
|
|
||||||
|
IncludeBlocks: Preserve
|
||||||
|
SortIncludes: false
|
||||||
|
|
||||||
|
AllowShortFunctionsOnASingleLine: Empty
|
25
.gitea/workflows/check-format.yml
Normal file
25
.gitea/workflows/check-format.yml
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue