This is an automated email from the ASF dual-hosted git repository.

panxiaolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new a68ed24d20 [Chore](workflow) add sonar cloud on cpp workflow (#24189)
a68ed24d20 is described below

commit a68ed24d2081410aa1d03e10cbc49bb416bfd196
Author: Pxl <[email protected]>
AuthorDate: Thu Sep 14 15:14:05 2023 +0800

    [Chore](workflow) add sonar cloud on cpp workflow (#24189)
    
    add sonar cloud on cpp workflow
---
 .github/actions/sonarcloud-github-action |  1 +
 .github/workflows/code-checks.yml        | 50 ++++++++++++++++++++++++++++++++
 .gitmodules                              |  3 ++
 3 files changed, 54 insertions(+)

diff --git a/.github/actions/sonarcloud-github-action 
b/.github/actions/sonarcloud-github-action
new file mode 160000
index 0000000000..c25d2e7e3d
--- /dev/null
+++ b/.github/actions/sonarcloud-github-action
@@ -0,0 +1 @@
+Subproject commit c25d2e7e3def96d0d1781000d3c429da22cd6252
diff --git a/.github/workflows/code-checks.yml 
b/.github/workflows/code-checks.yml
index 8bb81404ca..3e11e031a0 100644
--- a/.github/workflows/code-checks.yml
+++ b/.github/workflows/code-checks.yml
@@ -104,3 +104,53 @@ jobs:
       # clang-tidy review not required now
       # - if: steps.review.outputs.total_comments > 0
       #   run: exit 1
+
+  sonar-cloud-cpp:
+    name: "SonarCloud on cpp"
+    if: ${{ github.event_name == 'pull_request_target' }}
+    runs-on: ubuntu-22.04
+    steps:
+      - name: Checkout ${{ github.ref }} ( ${{ 
github.event.pull_request.head.sha }} )
+        uses: actions/checkout@v3
+        with:
+          ref: ${{ github.event.pull_request.head.sha }}
+          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
+        if: ${{ steps.filter.outputs.be_changes == 'true' }}
+        run: |
+          export DEFAULT_DIR='/opt/doris'
+
+          mkdir "${DEFAULT_DIR}"
+          wget 
https://github.com/amosbird/ldb_toolchain_gen/releases/download/v0.18/ldb_toolchain_gen.sh
 \
+            -q -O /tmp/ldb_toolchain_gen.sh
+          bash /tmp/ldb_toolchain_gen.sh "${DEFAULT_DIR}/ldb-toolchain"
+
+          sudo DEBIAN_FRONTEND=noninteractive apt install --yes tzdata byacc
+
+          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}"
+          DISABLE_JAVA_UDF=ON DORIS_TOOLCHAIN=clang OUTPUT_BE_BINARY=0 
./build.sh --be
+
+      - name: SonarCloud Scan
+        if: ${{ steps.filter.outputs.be_changes == 'true' }}
+        uses: sonarsource/sonarcloud-github-action@master
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+          projectBaseDir: be
\ No newline at end of file
diff --git a/.gitmodules b/.gitmodules
index 9fe51bfd1d..9fc337f3bf 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -33,3 +33,6 @@
        path = be/src/clucene
        url = https://github.com/apache/doris-thirdparty.git
        branch = clucene
+[submodule ".github/actions/sonarcloud-github-action"]
+       path = .github/actions/sonarcloud-github-action
+       url = https://github.com/SonarSource/sonarcloud-github-action


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to