add CI test for clang formatting #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |