[Chore](workflow) add sonar cloud on cpp workflow (#24189)

add sonar cloud on cpp workflow
This commit is contained in:
Pxl
2023-09-14 15:14:05 +08:00
committed by GitHub
parent 51811f72b3
commit a68ed24d20
3 changed files with 54 additions and 0 deletions

View File

@ -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

3
.gitmodules vendored
View File

@ -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