-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add pre-commit hook + clang-format GHA
- Loading branch information
1 parent
36045f7
commit 9053ebe
Showing
3 changed files
with
43 additions
and
10 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
# Redirect output to stderr. | ||
exec 1>&2 | ||
|
||
# Run clang-format on staged files; abort the commit if any files are changed | ||
if ! git clang-format ; then | ||
echo "linting made changes to source files; aborting commit" | ||
exit 1 | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: clang-format check | ||
on: [pull_request] | ||
jobs: | ||
formatting-check: | ||
name: Formatting Check | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
path: | ||
- 'include' | ||
- 'src' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Run clang-format style check | ||
uses: jidicula/[email protected] | ||
with: | ||
clang-format-version: '17' | ||
check-path: ${{ matrix.path }} |
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