Skip to content

add CI test for clang formatting #2

add CI test for clang formatting

add CI test for clang formatting #2

# SPDX-FileCopyrightText: 2025 CERN
# SPDX-License-Identifier: Apache-2.0
name: Clang-Format Check
on: [pull_request, push]
jobs:
clang-format-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Installing clang-format (adjust version as needed)
- name: Install clang-format
run: sudo apt-get update && sudo apt-get install -y clang-format-18
- name: Check formatting
run: |
# Specify file extensions to be checked
FILES=$(git ls-files '*.cpp' '*.h' '*.cu' '*.cuh' '*.hh' '*.cc' '*.icc')
# check version
clang-format-18 --version
# '-n' checks if files need reformatting
# '--Werror' throws an error if formatting is incorrect
clang-format-18 -style=file -n --Werror $FILES