From a689d70e2b49d26cc4e08e0d9a7a9f365769bf28 Mon Sep 17 00:00:00 2001 From: Ahmad El Sayed Date: Mon, 6 May 2024 00:33:05 +0200 Subject: [PATCH] Added clang format workflow --- .github/workflows/clang-format.yml | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/clang-format.yml diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml new file mode 100644 index 0000000..a49338f --- /dev/null +++ b/.github/workflows/clang-format.yml @@ -0,0 +1,32 @@ +name: Clang Format + +on: + push: + branches: + - master + - "feature/**" + +jobs: + clang_format: + runs-on: ubuntu-22.04 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install clang-format + run: | + sudo apt-get update + sudo apt-get install -y clang-format + + - name: Check code formatting + run: | + ${{ github.workspace }}/scripts/clang-format/format.sh \ + --clang_format_file ${{ github.workspace }}/.clang-format \ + --directories ${{ github.workspace }}/src ${{ github.workspace }}/include ${{ github.workspace }}/tests + clang_format_diff=$(git diff) + if [[ -n "$clang_format_diff" ]]; then + echo "Found formatting errors:" + echo "$clang_format_diff" + exit 1 + fi