Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/clang_format.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Clang Format Check

on:
push:
branches: [ "master" ]
paths-ignore:
- '**/*.md'
- '*.md'
pull_request:
branches: [ "master" ]
paths-ignore:
- '**/*.md'
- '*.md'

jobs:
clang-format:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install clang-format
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y clang-format-19

- name: Fetch base branch
if: github.event_name == 'pull_request'
run: |
echo "Fetching base branch ${{ github.base_ref }}"
git fetch origin ${{ github.base_ref }}:${{ github.base_ref }}

- name: Get Git Diff
id: diff
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "Getting diff for pull request"
git diff origin/${{ github.base_ref }}...HEAD > diff.patch
else
echo "Getting diff for commit"
git diff ${{ github.event.before }} ${{ github.event.after }} > diff.patch
fi

- name: Check formatting
shell: bash
run: |
cat diff.patch | clang-format-diff-19 -p 1 > diff_format.patch

if [ -s diff_format.patch ]; then
echo "❌ Code formatting issues found. See diff_format.patch."
exit 1
fi

- name: Upload clang-formatted diff
if: failure()
uses: actions/upload-artifact@v4
with:
name: clang-format-diff
path: diff_format.patch
2 changes: 2 additions & 0 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ on:
branches: [ "master" ]
paths-ignore:
- '**/*.md'
- '*.md'
pull_request:
branches: [ "master" ]
paths-ignore:
- '**/*.md'
- '*.md'

jobs:
run-matrix:
Expand Down
Loading