From b6c5c63300b6185f5fafc6ec0b9716c77e155fcf Mon Sep 17 00:00:00 2001 From: Derek G Foster Date: Mon, 13 Nov 2023 17:46:04 -0800 Subject: [PATCH] Add clang-format check (#70) - Add job to CI pipeline to run clang-format on modified files to see if there are any formatting errors. Signed-off-by: Derek G Foster --- .github/workflows/pipeline.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 7db90de..6a1cdba 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -93,3 +93,28 @@ jobs: export SDE_INSTALL=$SDE_INSTALL_DIR cmake -S . -B build -C pipeline.cmake -DTDI_TARGET=DPDK cmake --build build --target krnlmon-test + + #--------------------------------------------------------------------- + # check_clang_format + #--------------------------------------------------------------------- + check_clang_format: + runs-on: ubuntu-latest + + steps: + - name: Check out krnlmon repository + uses: actions/checkout@v3 + + - name: Get list of changed Files + id: changes + uses: tj-actions/changed-files@v40 + with: + files: | + **.c + **.h + **.cc + + - name: Check for formatting errors + run: | + for file in ${{ steps.changes.outputs.all_changed_files }}; do + clang-format --dry-run -Werror $file + done