Skip to content

Commit efa2553

Browse files
committed
Fix sonar cannot work
1 parent d13abe6 commit efa2553

File tree

3 files changed

+49
-18
lines changed

3 files changed

+49
-18
lines changed

.github/workflows/unit-test.yml

+15-18
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ on:
2626
branches:
2727
- '[0-9]+.[0-9]+.[0-9]+-prepare'
2828
- '[0-9]+.[0-9]+.[0-9]+-release'
29+
- dev
30+
pull_request_target:
31+
paths:
32+
- '**/pom.xml'
2933

3034
env:
3135
LOG_DIR: /tmp/dolphinscheduler
@@ -35,6 +39,10 @@ concurrency:
3539
cancel-in-progress: true
3640

3741
jobs:
42+
build:
43+
permissions:
44+
contents: read
45+
pull-requests: write
3846
paths-filter:
3947
name: Unit-Test-Path-Filter
4048
runs-on: ubuntu-latest
@@ -79,20 +87,7 @@ jobs:
7987
run: ./mvnw clean verify -B -Dmaven.test.skip=false -Dspotless.skip=true -DskipUT=false
8088
- name: Upload coverage report to codecov
8189
run: CODECOV_TOKEN="09c2663f-b091-4258-8a47-c981827eb29a" bash <(curl -s https://codecov.io/bash)
82-
sonarcloud-analysis:
83-
name: SonarCloud-Analysis
84-
needs: paths-filter
85-
runs-on: ubuntu-latest
86-
timeout-minutes: 30
87-
steps:
88-
- uses: actions/checkout@v4
89-
with:
90-
submodules: true
91-
- uses: actions/cache@v4
92-
with:
93-
path: ~/.m2/repository
94-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-unit-test
95-
restore-keys: ${{ runner.os }}-maven-
90+
9691
# Set up JDK 17 for SonarCloud.
9792
- name: Set up JDK 17
9893
uses: actions/setup-java@v4
@@ -109,9 +104,11 @@ jobs:
109104
-Dsonar.organization=apache
110105
-Dsonar.core.codeCoveragePlugin=jacoco
111106
-Dsonar.projectKey=apache-dolphinscheduler
107+
-Dsonar.login=e4058004bc6be89decf558ac819aa1ecbee57682
112108
-Dsonar.exclusions=,dolphinscheduler-ui/src/**/i18n/locale/*.js,dolphinscheduler-microbench/src/**/*
113-
-Dsonar.token=e4058004bc6be89decf558ac819aa1ecbee57682
114-
-Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120
109+
-Dhttp.keepAlive=false
110+
-Dmaven.wagon.http.pool=false
111+
-Dmaven.wagon.httpconnectionManager.ttlSeconds=120
115112
-DskipUT=true
116113
env:
117114
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -120,7 +117,7 @@ jobs:
120117
name: Unit Test
121118
runs-on: ubuntu-latest
122119
timeout-minutes: 30
123-
needs: [ unit-test, paths-filter, sonarcloud-analysis ]
120+
needs: [ unit-test, paths-filter ]
124121
if: always()
125122
steps:
126123
- name: Status
@@ -129,7 +126,7 @@ jobs:
129126
echo "Skip Unit Test!"
130127
exit 0
131128
fi
132-
if [[ ${{ needs.unit-test.result }} != 'success' || ${{ needs.sonarcloud-analysis.result }} != 'success' ]]; then
129+
if [[ ${{ needs.unit-test.result }} != 'success' ]]; then
133130
echo "Unit Test Failed!"
134131
exit -1
135132
fi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.dolphinscheduler.plugin.task.api.utils;
19+
20+
import static com.google.common.truth.Truth.assertThat;
21+
22+
import org.junit.jupiter.api.Test;
23+
24+
class TaskTypeUtilsTest {
25+
26+
@Test
27+
void isSwitchTask() {
28+
assertThat(TaskTypeUtils.isSwitchTask("SWITCH")).isTrue();
29+
}
30+
31+
}

pom.xml

+3
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,9 @@
643643
<goals>
644644
<goal>restore-instrumented-classes</goal>
645645
</goals>
646+
<configuration>
647+
<excludes>com/github/dreamhead/moco/*</excludes>
648+
</configuration>
646649
</execution>
647650
<execution>
648651
<id>default-report</id>

0 commit comments

Comments
 (0)