From a675b64b5f9291d90fa71d65a524ad12be63ec15 Mon Sep 17 00:00:00 2001 From: Timofey Khoruzhii Date: Tue, 9 May 2023 01:18:34 +0300 Subject: [PATCH] add clang format to CI --- .clang-format | 12 ++++++++++++ .gitea/workflows/check-format.yml | 25 +++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 .clang-format create mode 100644 .gitea/workflows/check-format.yml diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..a418472 --- /dev/null +++ b/.clang-format @@ -0,0 +1,12 @@ +BasedOnStyle: Google + +AccessModifierOffset: -1 +DerivePointerAlignment: false + +IndentWidth: 2 +ColumnLimit: 100 + +IncludeBlocks: Preserve +SortIncludes: false + +AllowShortFunctionsOnASingleLine: Empty diff --git a/.gitea/workflows/check-format.yml b/.gitea/workflows/check-format.yml new file mode 100644 index 0000000..303ba05 --- /dev/null +++ b/.gitea/workflows/check-format.yml @@ -0,0 +1,25 @@ +name: Clang-format Check + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + clang-format-check: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install clang-format + run: sudo apt-get install -y clang-format + + - name: Check code formatting + run: | + find . -type f -regex '.*\.\(cpp\|hpp\|c\|h\)' -exec clang-format -style=file -i {} \; + git diff --exit-code