From ff277747870d0d08c1674c15bd9a4ecd7e860818 Mon Sep 17 00:00:00 2001 From: Gang Wu Date: Fri, 29 Nov 2024 00:00:04 +0800 Subject: [PATCH 1/5] WIP: Use cpp-linter --- .github/workflows/build_and_test.yml | 32 ++++++------- .github/workflows/cpp-lint.yml | 67 ++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/cpp-lint.yml diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 1ea3bff41b..f61ebc0a55 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -158,22 +158,22 @@ jobs: ./mvnw install -DskipTests ./mvnw javadoc:javadoc - formatting-check: - name: "C++ format check" - runs-on: ubuntu-22.04 - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Run build - run: | - mkdir build - cd build - cmake .. -DBUILD_JAVA=OFF -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DSTOP_BUILD_ON_WARNING=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DBUILD_CPP_ENABLE_METRICS=1 - make - - name: Check clang-tidy - run: cd build && make check-clang-tidy - - name: Check clang-format - run: cd build && make check-format + # formatting-check: + # name: "C++ format check" + # runs-on: ubuntu-22.04 + # steps: + # - name: Checkout repository + # uses: actions/checkout@v4 + # - name: Run build + # run: | + # mkdir build + # cd build + # cmake .. -DBUILD_JAVA=OFF -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DSTOP_BUILD_ON_WARNING=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DBUILD_CPP_ENABLE_METRICS=1 + # make + # - name: Check clang-tidy + # run: cd build && make check-clang-tidy + # - name: Check clang-format + # run: cd build && make check-format license-check: name: "License Check" diff --git a/.github/workflows/cpp-lint.yml b/.github/workflows/cpp-lint.yml new file mode 100644 index 0000000000..79dd7f3a11 --- /dev/null +++ b/.github/workflows/cpp-lint.yml @@ -0,0 +1,67 @@ +# 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: + push: + paths: + - '**.cc' + - '**.hh' + - '.clang-format' + - '.clang-tidy' + branches: + - main + pull_request: + paths: + - '**.cc' + - '**.hh' + - '.clang-format' + - '.clang-tidy' + branches: + - main + +jobs: + cpp-linter: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Run build + run: | + mkdir build + cd build + cmake .. -DBUILD_JAVA=OFF -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DSTOP_BUILD_ON_WARNING=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DBUILD_CPP_ENABLE_METRICS=1 + make + - name: Run linter + uses: cpp-linter/cpp-linter-action@v2 + id: linter + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + style: file + tidy-checks: file + files-changed-only: true + lines-changed-only: false + thread-comments: true + ignore: 'build|thirdparty' + database: build/compile_commands.json + extra-args: -Wno-unused-parameter + + - name: Fail fast?! + if: steps.linter.outputs.checks-failed > 0 + run: exit 1 From b93ef67e1028c2637209aa775cc9fb725aa86748 Mon Sep 17 00:00:00 2001 From: Gang Wu Date: Fri, 29 Nov 2024 00:08:21 +0800 Subject: [PATCH 2/5] add name --- .github/workflows/cpp-lint.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cpp-lint.yml b/.github/workflows/cpp-lint.yml index 79dd7f3a11..8c251268fe 100644 --- a/.github/workflows/cpp-lint.yml +++ b/.github/workflows/cpp-lint.yml @@ -37,6 +37,7 @@ on: jobs: cpp-linter: + name: "C++ Linter" runs-on: ubuntu-latest steps: - name: Checkout repository From 1db34788c6d44516cd184ae730807c0833571f51 Mon Sep 17 00:00:00 2001 From: Gang Wu Date: Fri, 29 Nov 2024 00:10:47 +0800 Subject: [PATCH 3/5] fix --- .github/workflows/build_and_test.yml | 42 +++++---- .github/workflows/cpp-lint.yml | 128 +++++++++++++-------------- 2 files changed, 90 insertions(+), 80 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index f61ebc0a55..404be4ab3d 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -158,22 +158,32 @@ jobs: ./mvnw install -DskipTests ./mvnw javadoc:javadoc - # formatting-check: - # name: "C++ format check" - # runs-on: ubuntu-22.04 - # steps: - # - name: Checkout repository - # uses: actions/checkout@v4 - # - name: Run build - # run: | - # mkdir build - # cd build - # cmake .. -DBUILD_JAVA=OFF -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DSTOP_BUILD_ON_WARNING=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DBUILD_CPP_ENABLE_METRICS=1 - # make - # - name: Check clang-tidy - # run: cd build && make check-clang-tidy - # - name: Check clang-format - # run: cd build && make check-format + formatting-check: + name: "C++ format check" + runs-on: ubuntu-22.04 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Run build + run: | + mkdir build + cd build + cmake .. -DBUILD_JAVA=OFF -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DSTOP_BUILD_ON_WARNING=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DBUILD_CPP_ENABLE_METRICS=1 + make + - name: Run linter + uses: cpp-linter/cpp-linter-action@v2 + id: linter + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + style: file + tidy-checks: file + files-changed-only: true + lines-changed-only: false + thread-comments: true + ignore: 'build|thirdparty' + database: build/compile_commands.json + extra-args: -Wno-unused-parameter license-check: name: "License Check" diff --git a/.github/workflows/cpp-lint.yml b/.github/workflows/cpp-lint.yml index 8c251268fe..37e685ddb0 100644 --- a/.github/workflows/cpp-lint.yml +++ b/.github/workflows/cpp-lint.yml @@ -1,68 +1,68 @@ -# 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. +# # 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 +# name: C++ Linter -on: - push: - paths: - - '**.cc' - - '**.hh' - - '.clang-format' - - '.clang-tidy' - branches: - - main - pull_request: - paths: - - '**.cc' - - '**.hh' - - '.clang-format' - - '.clang-tidy' - branches: - - main +# on: +# push: +# paths: +# - '**.cc' +# - '**.hh' +# - '.clang-format' +# - '.clang-tidy' +# branches: +# - main +# pull_request: +# paths: +# - '**.cc' +# - '**.hh' +# - '.clang-format' +# - '.clang-tidy' +# branches: +# - main -jobs: - cpp-linter: - name: "C++ Linter" - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Run build - run: | - mkdir build - cd build - cmake .. -DBUILD_JAVA=OFF -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DSTOP_BUILD_ON_WARNING=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DBUILD_CPP_ENABLE_METRICS=1 - make - - name: Run linter - uses: cpp-linter/cpp-linter-action@v2 - id: linter - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - style: file - tidy-checks: file - files-changed-only: true - lines-changed-only: false - thread-comments: true - ignore: 'build|thirdparty' - database: build/compile_commands.json - extra-args: -Wno-unused-parameter +# jobs: +# cpp-linter: +# name: "C++ Linter" +# runs-on: ubuntu-latest +# steps: +# - name: Checkout repository +# uses: actions/checkout@v4 +# - name: Run build +# run: | +# mkdir build +# cd build +# cmake .. -DBUILD_JAVA=OFF -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DSTOP_BUILD_ON_WARNING=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DBUILD_CPP_ENABLE_METRICS=1 +# make +# - name: Run linter +# uses: cpp-linter/cpp-linter-action@v2 +# id: linter +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# with: +# style: file +# tidy-checks: file +# files-changed-only: true +# lines-changed-only: false +# thread-comments: true +# ignore: 'build|thirdparty' +# database: build/compile_commands.json +# extra-args: -Wno-unused-parameter - - name: Fail fast?! - if: steps.linter.outputs.checks-failed > 0 - run: exit 1 +# - name: Fail fast?! +# if: steps.linter.outputs.checks-failed > 0 +# run: exit 1 From 2986e70864698f387282f64bd763649dbc601f8e Mon Sep 17 00:00:00 2001 From: Gang Wu Date: Tue, 3 Dec 2024 09:15:40 +0800 Subject: [PATCH 4/5] add back cpp-lint.yml --- .github/workflows/cpp-lint.yml | 96 +++++++++++++++++----------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/.github/workflows/cpp-lint.yml b/.github/workflows/cpp-lint.yml index 37e685ddb0..194d228913 100644 --- a/.github/workflows/cpp-lint.yml +++ b/.github/workflows/cpp-lint.yml @@ -15,54 +15,54 @@ # # specific language governing permissions and limitations # # under the License. -# name: C++ Linter +name: C++ Linter -# on: -# push: -# paths: -# - '**.cc' -# - '**.hh' -# - '.clang-format' -# - '.clang-tidy' -# branches: -# - main -# pull_request: -# paths: -# - '**.cc' -# - '**.hh' -# - '.clang-format' -# - '.clang-tidy' -# branches: -# - main +on: + push: + paths: + - '**.cc' + - '**.hh' + - '.clang-format' + - '.clang-tidy' + branches: + - main + pull_request: + paths: + - '**.cc' + - '**.hh' + - '.clang-format' + - '.clang-tidy' + branches: + - main -# jobs: -# cpp-linter: -# name: "C++ Linter" -# runs-on: ubuntu-latest -# steps: -# - name: Checkout repository -# uses: actions/checkout@v4 -# - name: Run build -# run: | -# mkdir build -# cd build -# cmake .. -DBUILD_JAVA=OFF -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DSTOP_BUILD_ON_WARNING=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DBUILD_CPP_ENABLE_METRICS=1 -# make -# - name: Run linter -# uses: cpp-linter/cpp-linter-action@v2 -# id: linter -# env: -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -# with: -# style: file -# tidy-checks: file -# files-changed-only: true -# lines-changed-only: false -# thread-comments: true -# ignore: 'build|thirdparty' -# database: build/compile_commands.json -# extra-args: -Wno-unused-parameter +jobs: + cpp-linter: + name: "C++ Linter" + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Run build + run: | + mkdir build + cd build + cmake .. -DBUILD_JAVA=OFF -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DSTOP_BUILD_ON_WARNING=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DBUILD_CPP_ENABLE_METRICS=1 + make + - name: Run linter + uses: cpp-linter/cpp-linter-action@v2 + id: linter + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + style: file + tidy-checks: file + files-changed-only: true + lines-changed-only: false + thread-comments: true + ignore: 'build|thirdparty' + database: build/compile_commands.json + extra-args: -Wno-unused-parameter -# - name: Fail fast?! -# if: steps.linter.outputs.checks-failed > 0 -# run: exit 1 + - name: Fail fast?! + if: steps.linter.outputs.checks-failed > 0 + run: exit 1 From a690c74da619bc576d887a43570893e75cfeadbd Mon Sep 17 00:00:00 2001 From: Gang Wu Date: Tue, 3 Dec 2024 23:41:46 +0800 Subject: [PATCH 5/5] set version --- .github/workflows/build_and_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 404be4ab3d..1e1bde35e3 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -171,7 +171,7 @@ jobs: cmake .. -DBUILD_JAVA=OFF -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DSTOP_BUILD_ON_WARNING=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DBUILD_CPP_ENABLE_METRICS=1 make - name: Run linter - uses: cpp-linter/cpp-linter-action@v2 + uses: cpp-linter/cpp-linter-action@v2.13.2 id: linter env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}