From f06e75f3693d6d91ea1bd91fc919733224ee05af Mon Sep 17 00:00:00 2001 From: Gang Wu Date: Fri, 27 Dec 2024 14:29:29 +0800 Subject: [PATCH 1/5] Add GitHub cpp-linter-action --- .github/workflows/cpp-linter.yml | 51 +++++++++++++++++++++++++++++ .github/workflows/license_check.yml | 1 + 2 files changed, 52 insertions(+) create mode 100644 .github/workflows/cpp-linter.yml diff --git a/.github/workflows/cpp-linter.yml b/.github/workflows/cpp-linter.yml new file mode 100644 index 000000000..ebd1e4592 --- /dev/null +++ b/.github/workflows/cpp-linter.yml @@ -0,0 +1,51 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: C++ Linter + +on: + pull_request: + paths-ignore: + - '.github/**' + - 'ci/**' + - 'cmake_modules/**' + branches: + - main + +jobs: + cpp-linter: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - uses: cpp-linter/cpp-linter-action@v2.13.3 + id: linter + continue-on-error: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + style: file + tidy-checks: file + files-changed-only: true + lines-changed-only: true + thread-comments: true + ignore: 'build|cmake_modules|ci' + database: build/compile_commands.json + - name: Fail fast?! + if: steps.linter.outputs.checks-failed != 0 + run: | + echo "some linter checks failed. ${{ steps.linter.outputs.checks-failed }}" + exit 1 diff --git a/.github/workflows/license_check.yml b/.github/workflows/license_check.yml index 0d5037eaa..a9aae6cfc 100644 --- a/.github/workflows/license_check.yml +++ b/.github/workflows/license_check.yml @@ -16,6 +16,7 @@ # under the License. name: "Run License Check" + on: pull_request jobs: From dec73a32d67d70d9f8adf58ba703bc263810e5d0 Mon Sep 17 00:00:00 2001 From: Gang Wu Date: Mon, 30 Dec 2024 17:26:39 +0800 Subject: [PATCH 2/5] Update .github/workflows/cpp-linter.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Raúl Cumplido --- .github/workflows/cpp-linter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cpp-linter.yml b/.github/workflows/cpp-linter.yml index ebd1e4592..372f6541b 100644 --- a/.github/workflows/cpp-linter.yml +++ b/.github/workflows/cpp-linter.yml @@ -31,7 +31,7 @@ jobs: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - - uses: cpp-linter/cpp-linter-action@v2.13.3 + - uses: cpp-linter/cpp-linter-action@v2.13.4 id: linter continue-on-error: true env: From 80a31f562676c73efe20e47624b6aa2d7d803b52 Mon Sep 17 00:00:00 2001 From: Gang Wu Date: Mon, 30 Dec 2024 17:32:27 +0800 Subject: [PATCH 3/5] break the file --- .github/workflows/cpp-linter.yml | 1 + api/iceberg/table.h | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cpp-linter.yml b/.github/workflows/cpp-linter.yml index 372f6541b..6693f9f2d 100644 --- a/.github/workflows/cpp-linter.yml +++ b/.github/workflows/cpp-linter.yml @@ -44,6 +44,7 @@ jobs: thread-comments: true ignore: 'build|cmake_modules|ci' database: build/compile_commands.json + extra-args: '-std=c++20 -Wall' - name: Fail fast?! if: steps.linter.outputs.checks-failed != 0 run: | diff --git a/api/iceberg/table.h b/api/iceberg/table.h index f06e336b5..e05e3da1e 100644 --- a/api/iceberg/table.h +++ b/api/iceberg/table.h @@ -20,15 +20,24 @@ #pragma once #include -#include + + + + #include namespace iceberg { -class Table { - public: - virtual ~Table() = default; - virtual std::string_view print() const = 0; - static std::unique_ptr create(); + class Table { +public: + virtual ~Table( ) = default; + + virtual std::string_view print() const = 0; + + + static std::unique_ptr
create(); + +private: + int SOME_ID = 1; }; } // namespace iceberg From e171cab618d335f77835a296079cc466ea32589f Mon Sep 17 00:00:00 2001 From: Gang Wu Date: Mon, 30 Dec 2024 17:36:20 +0800 Subject: [PATCH 4/5] revert to 2.13.3 --- .github/workflows/cpp-linter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cpp-linter.yml b/.github/workflows/cpp-linter.yml index 6693f9f2d..a420f3e00 100644 --- a/.github/workflows/cpp-linter.yml +++ b/.github/workflows/cpp-linter.yml @@ -31,7 +31,7 @@ jobs: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - - uses: cpp-linter/cpp-linter-action@v2.13.4 + - uses: cpp-linter/cpp-linter-action@v2.13.3 id: linter continue-on-error: true env: From d6dceae2bcfc95521340e05ae33d9d927a6ec987 Mon Sep 17 00:00:00 2001 From: Gang Wu Date: Tue, 31 Dec 2024 09:38:09 +0800 Subject: [PATCH 5/5] insert a build step --- .github/workflows/cpp-linter.yml | 8 ++++++-- api/iceberg/table.h | 21 ++++++--------------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/.github/workflows/cpp-linter.yml b/.github/workflows/cpp-linter.yml index a420f3e00..6291ac999 100644 --- a/.github/workflows/cpp-linter.yml +++ b/.github/workflows/cpp-linter.yml @@ -31,6 +31,11 @@ jobs: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 + - name: Run build + run: | + mkdir build && cd build + cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + cmake --build . - uses: cpp-linter/cpp-linter-action@v2.13.3 id: linter continue-on-error: true @@ -43,8 +48,7 @@ jobs: lines-changed-only: true thread-comments: true ignore: 'build|cmake_modules|ci' - database: build/compile_commands.json - extra-args: '-std=c++20 -Wall' + database: build - name: Fail fast?! if: steps.linter.outputs.checks-failed != 0 run: | diff --git a/api/iceberg/table.h b/api/iceberg/table.h index e05e3da1e..f06e336b5 100644 --- a/api/iceberg/table.h +++ b/api/iceberg/table.h @@ -20,24 +20,15 @@ #pragma once #include - - - - #include +#include namespace iceberg { - class Table { -public: - virtual ~Table( ) = default; - - virtual std::string_view print() const = 0; - - - static std::unique_ptr
create(); - -private: - int SOME_ID = 1; +class Table { + public: + virtual ~Table() = default; + virtual std::string_view print() const = 0; + static std::unique_ptr
create(); }; } // namespace iceberg