build: test format #1

Merged
Future merged 4 commits from build/test-format into master 2025-02-05 15:49:54 +00:00
2 changed files with 36 additions and 0 deletions
Showing only changes of commit a0fdf4a4b7 - Show all commits

View File

@ -0,0 +1,28 @@
name: check-formatting
on:
push:
branches:
- "*"
pull_request:
branches:
- "*"
types: [opened, synchronize, reopened]
jobs:
check-formatting:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@main
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v2.0.5
with:
version: "11.0"
- name: Test formatting for all files
working-directory: ${{ github.workspace }}
run: |
export CLANG_FORMAT_BIN="${LLVM_PATH}/bin/clang-format"
./scripts/check-format.sh

8
scripts/check-format.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
# Go to repository root
cd "$(dirname "$0")/.." || exit 2
CLANG_FORMAT_BIN="${CLANG_FORMAT_BIN:-clang-format}"
find ./src -iname '*.hpp' -o -iname '*.cpp' | xargs $CLANG_FORMAT_BIN -Werror -ferror-limit=1 --dry-run