You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/12/01 04:05:18 UTC

[GitHub] [doris] adonis0147 commented on a diff in pull request #14709: [Chore](workflow) add clang-tidy workflow

adonis0147 commented on code in PR #14709:
URL: https://github.com/apache/doris/pull/14709#discussion_r1036668424


##########
.github/workflows/clang-format.yml:
##########
@@ -54,3 +54,57 @@ jobs:
       - name: Ignore it!
         if: ${{ steps.filter.outputs.be_changes == 'false' }}
         run: echo 'No need to check.'
+
+  clang-tidy:
+    name: "Clang Tidy"
+    runs-on: ubuntu-20.04

Review Comment:
   ```suggestion
       runs-on: ubuntu-22.04
   ```



##########
build.sh:
##########
@@ -282,6 +282,10 @@ if [[ -z "${USE_DWARF}" ]]; then
     USE_DWARF='OFF'
 fi
 
+if [[ -z "${OUTPUT_BE_BINARY}" ]]; then
+    BUILD_BE_BINARY=1
+fi
+

Review Comment:
   We don't need this.



##########
.github/workflows/clang-format.yml:
##########
@@ -54,3 +54,57 @@ jobs:
       - name: Ignore it!
         if: ${{ steps.filter.outputs.be_changes == 'false' }}
         run: echo 'No need to check.'
+
+  clang-tidy:
+    name: "Clang Tidy"
+    runs-on: ubuntu-20.04
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v3
+        with:
+          persist-credentials: false
+          submodules: recursive
+
+      - name: Paths Filter
+        uses: ./.github/actions/paths-filter
+        id: filter
+        with:
+          filters: |
+            be_changes:
+              - 'be/**'
+              - 'gensrc/proto/**'
+              - 'gensrc/thrift/**'
+      
+      - name: Generate compile_commands.json
+        run: |
+          export DEFAULT_DIR='/opt/doris'
+
+          mkdir "${DEFAULT_DIR}"
+          wget https://github.com/amosbird/ldb_toolchain_gen/releases/download/v0.14.2/ldb_toolchain_gen.sh \
+            -q -O /tmp/ldb_toolchain_gen.sh
+          bash /tmp/ldb_toolchain_gen.sh "${DEFAULT_DIR}/ldb-toolchain"
+
+          sudo apt update
+          sudo apt upgrade --yes
+          sudo DEBIAN_FRONTEND=noninteractive apt install --yes tzdata byacc
+
+          # set timezone
+          sudo ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
+          sudo dpkg-reconfigure --frontend noninteractive tzdata
+
+          pushd thirdparty
+          curl -L https://github.com/apache/doris-thirdparty/releases/download/automation/doris-thirdparty-prebuilt-linux-x86_64.tar.xz \
+            -o doris-thirdparty-prebuilt-linux-x86_64.tar.xz
+          tar -xvf doris-thirdparty-prebuilt-linux-x86_64.tar.xz
+          popd
+
+          export PATH="${DEFAULT_DIR}/ldb-toolchain/bin/:$(pwd)/thirdparty/installed/bin/:${PATH}"
+          DORIS_TOOLCHAIN=clang OUTPUT_BE_BINARY=0 ./build.sh --be

Review Comment:
   Just using command `cmake </path/contains/CMakeLists.txt>` can generate `compile_commands.json`.
   
   ```shell
   mkdir build
   pushd build
   cmake ../be
   popd
   ```



##########
.github/workflows/clang-format.yml:
##########
@@ -17,7 +17,7 @@
 #
 
 ---
-name: BE Code Formatter
+name: BE Code Checks
 on:
   pull_request:

Review Comment:
   Use `pull_request_target` to enable comment feature.
   ```suggestion
     pull_request_target
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org