Skip to content

Commit

Permalink
feat: add github action to check that all files are formatted
Browse files Browse the repository at this point in the history
To ignore certain folders we add a format file in them,
this is needed for the common and modules folders
since they bring too many legacy files.
  • Loading branch information
jr0me committed Jul 15, 2024
1 parent 3895d9d commit 4f22b43
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/clang-format-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Clang Format Check

on:
push:
branches:
- '**'
pull_request:
branches:
- '**'

jobs:
clang-format:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install clang-format
run: sudo apt-get install -y clang-format

- name: Run clang-format check
run: |
files=$(find . -type f \( -name '*.[ch]' -o -name '*.cpp' -o -name '*.hpp' \) ! -path './src/vcpkg/*' ! -path './src/build/*')
for file in $files; do
clang-format --dry-run -Werror $file
done
2 changes: 2 additions & 0 deletions src/common/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DisableFormat: true
SortIncludes: Never
2 changes: 2 additions & 0 deletions src/modules/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DisableFormat: true
SortIncludes: Never

0 comments on commit 4f22b43

Please sign in to comment.