Skip to content

Commit

Permalink
Added clang format workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmad-el-sayed committed May 5, 2024
1 parent c7449f8 commit a689d70
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Clang Format

on:
push:
branches:
- master
- "feature/**"

jobs:
clang_format:
runs-on: ubuntu-22.04

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install clang-format
run: |
sudo apt-get update
sudo apt-get install -y clang-format
- name: Check code formatting
run: |
${{ github.workspace }}/scripts/clang-format/format.sh \
--clang_format_file ${{ github.workspace }}/.clang-format \
--directories ${{ github.workspace }}/src ${{ github.workspace }}/include ${{ github.workspace }}/tests
clang_format_diff=$(git diff)
if [[ -n "$clang_format_diff" ]]; then
echo "Found formatting errors:"
echo "$clang_format_diff"
exit 1
fi

0 comments on commit a689d70

Please sign in to comment.