Skip to content

Commit

Permalink
[Chore](checks) run sonar-cloud-java when fe changed (apache#24420)
Browse files Browse the repository at this point in the history
run sonar-cloud-java when fe changed
  • Loading branch information
BiteTheDDDDt authored Sep 15, 2023
1 parent df5b5ae commit 15c8ff1
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,53 +29,72 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Paths Filter
uses: ./.github/actions/paths-filter
id: filter
with:
filters: |
fe_changes:
- 'fe/**'
- 'gensrc/proto/**'
- 'gensrc/thrift/**'
- name: Set up JDK 11
if: ${{ steps.filter.outputs.fe_changes == 'true' }}
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'adopt'
- name: Cache SonarCloud packages
if: ${{ steps.filter.outputs.fe_changes == 'true' }}
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Cache Maven packages
if: ${{ steps.filter.outputs.fe_changes == 'true' }}
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Setup thrift
if: ${{ steps.filter.outputs.fe_changes == 'true' }}
run: |
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y thrift-compiler=0.16.0-2
thrift --version
mkdir -p thirdparty/installed/bin/
cd thirdparty/installed/bin/ && ln -s /usr/bin/thrift thrift
- name: Install protoc
if: ${{ steps.filter.outputs.fe_changes == 'true' }}
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler libprotobuf-dev
cd thirdparty/installed/bin/ && ln -s /usr/bin/protoc protoc
- name: Set up environment
if: ${{ steps.filter.outputs.fe_changes == 'true' }}
run: |
# Install Bash if necessary
sudo apt-get update
sudo apt-get install -y bash
- name: Generated Source Code
if: ${{ steps.filter.outputs.fe_changes == 'true' }}
shell: bash
run: |
bash generated-source.sh
- name: Cache local Maven repository
if: ${{ steps.filter.outputs.fe_changes == 'true' }}
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Analyze FE
if: ${{ steps.filter.outputs.fe_changes == 'true' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Expand All @@ -85,14 +104,11 @@ jobs:
mvn --batch-mode verify sonar:sonar -DskipTests -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=apache -Dsonar.projectKey=apache_incubator-doris -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120
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
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
submodules: recursive
fetch-depth: 0

- name: Paths Filter
uses: ./.github/actions/paths-filter
Expand Down

0 comments on commit 15c8ff1

Please sign in to comment.