From aa30a2350ae007fc3ad3bc11a0af8d46e52b9831 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 13 Dec 2023 23:20:23 +0800 Subject: [PATCH] CI: add lint github workflow for running clang-format (#3749) so that we can identify changes which do not confirm to the clang-format rules. Signed-off-by: Kefu Chai --- .github/workflows/lint.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 000000000000..b906fac275a5 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,26 @@ +name: lint + +on: + pull_request: + paths: + - '**.h' + - '**.cc' + +permissions: + contents: read + +jobs: + format_code: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install clang-format + uses: aminya/setup-cpp@v1 + with: + clangformat: 17.0.5 + + - name: Run clang-format + run: | + find include src -name '*.h' -o -name '*.cc' | xargs clang-format -i -style=file -fallback-style=none + git diff --exit-code