add format rule and fix CI

This commit is contained in:
Yanis002
2025-02-14 15:24:31 +01:00
parent 09c76db44b
commit 030b3e17f1
5 changed files with 51 additions and 56 deletions
+32
View File
@@ -0,0 +1,32 @@
name: Check Format
on:
push:
pull_request:
jobs:
format:
runs-on: ubuntu-24.04
defaults:
run:
shell: bash
steps:
# Checkout the repository (shallow clone)
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
# Set Git config
- name: Git config
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
# Run formatter
- name: Run clang-format
run: find include libs src -name *.h -o -name *.c -o -name *.hpp -o -name *.cpp | xargs clang-format -i
# Cancel if there's a diff
- name: Check status
run: git diff --name-only --exit-code