From d888221af0e0ba251b859a1cbfeedbeb8f2813ba Mon Sep 17 00:00:00 2001 From: Alex Kasko Date: Tue, 3 Mar 2026 19:32:03 +0000 Subject: [PATCH] Add format check job to CI This PR adds `make format-check` run to CI. It checks-in the `.clang-format` file from the main repo. Additionally it disables the CI runs for workflow-only changes. --- .clang-format | 34 +++++++++++++++++ .github/workflows/Linux.yml | 38 +++++++++++++++++-- .../workflows/MainDistributionPipeline.yml | 4 ++ .gitignore | 1 - src/postgres_attach.cpp | 1 - src/storage/postgres_clear_cache.cpp | 1 - 6 files changed, 72 insertions(+), 7 deletions(-) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 000000000..0c2efa1c8 --- /dev/null +++ b/.clang-format @@ -0,0 +1,34 @@ +--- +BasedOnStyle: LLVM +SortIncludes: false +TabWidth: 4 +IndentWidth: 4 +ColumnLimit: 120 +AllowShortFunctionsOnASingleLine: false +--- +UseTab: ForIndentation +DerivePointerAlignment: false +PointerAlignment: Right +AlignConsecutiveMacros: true +AlignTrailingComments: true +AllowAllArgumentsOnNextLine: true +AllowAllConstructorInitializersOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: true +AlignAfterOpenBracket: Align +SpaceBeforeCpp11BracedList: true +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpacesInAngles: false +SpacesInCStyleCastParentheses: false +SpacesInConditionalStatement: false +AllowShortLambdasOnASingleLine: Inline +AllowShortLoopsOnASingleLine: false +AlwaysBreakTemplateDeclarations: Yes +IncludeBlocks: Regroup +Language: Cpp +AccessModifierOffset: -4 +KeepEmptyLinesAtTheStartOfBlocks: false +--- +Language: Java +SpaceAfterCStyleCast: true +--- diff --git a/.github/workflows/Linux.yml b/.github/workflows/Linux.yml index 984ad7b4d..72dc73c98 100644 --- a/.github/workflows/Linux.yml +++ b/.github/workflows/Linux.yml @@ -1,15 +1,45 @@ name: Integration Tests -on: [push, pull_request,repository_dispatch] +on: + push: + paths-ignore: + - '**.md' + - '.github/workflows/**' + - '!.github/workflows/Linux.yml' + pull_request: + repository_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || '' }}-${{ github.base_ref || '' }}-${{ github.ref != 'refs/heads/main' || github.sha }} cancel-in-progress: true -defaults: - run: - shell: bash jobs: + + format-check: + name: Format Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: 'true' + + - name: Install + run: | + pip3 install \ + black==25.1.0 \ + clang_format==11.0.1 \ + cmake-format==0.6.13 + + - name: Format Check + run: | + python -m pip show black + python -m pip show cmake_format + python -m pip show clang_format + clang-format --version + clang-format --dump-config + make format-check + linux-tests-postgres: name: Run tests on Linux + needs: format-check runs-on: ubuntu-latest strategy: matrix: diff --git a/.github/workflows/MainDistributionPipeline.yml b/.github/workflows/MainDistributionPipeline.yml index 9924fdf5c..6ec44c21e 100644 --- a/.github/workflows/MainDistributionPipeline.yml +++ b/.github/workflows/MainDistributionPipeline.yml @@ -4,6 +4,10 @@ name: Main Extension Distribution Pipeline on: push: + paths-ignore: + - '**.md' + - '.github/workflows/**' + - '!.github/workflows/MainDistributionPipeline.yml' pull_request: workflow_dispatch: diff --git a/.gitignore b/.gitignore index 4de88d84f..94fc032ae 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,4 @@ cmake-build-debug .idea .DS_Store postgres/postgres -.clang-format postgres \ No newline at end of file diff --git a/src/postgres_attach.cpp b/src/postgres_attach.cpp index a7aceafda..4f1d01ce5 100644 --- a/src/postgres_attach.cpp +++ b/src/postgres_attach.cpp @@ -20,7 +20,6 @@ struct AttachFunctionData : public TableFunctionData { static unique_ptr AttachBind(ClientContext &context, TableFunctionBindInput &input, vector &return_types, vector &names) { - auto result = make_uniq(); result->dsn = input.inputs[0].GetValue(); diff --git a/src/storage/postgres_clear_cache.cpp b/src/storage/postgres_clear_cache.cpp index 25c7ef609..058cbad30 100644 --- a/src/storage/postgres_clear_cache.cpp +++ b/src/storage/postgres_clear_cache.cpp @@ -14,7 +14,6 @@ struct ClearCacheFunctionData : public TableFunctionData { static unique_ptr ClearCacheBind(ClientContext &context, TableFunctionBindInput &input, vector &return_types, vector &names) { - auto result = make_uniq(); return_types.push_back(LogicalType::BOOLEAN); names.emplace_back("Success");