Skip to content

Commit 429cf3f

Browse files
committed
Fix sonar cannot work
1 parent 2db8098 commit 429cf3f

File tree

2 files changed

+16
-33
lines changed

2 files changed

+16
-33
lines changed

Diff for: .github/workflows/unit-test.yml

+8-19
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ on:
2626
branches:
2727
- '[0-9]+.[0-9]+.[0-9]+-prepare'
2828
- '[0-9]+.[0-9]+.[0-9]+-release'
29+
pull_request_target:
30+
paths:
31+
- '**/pom.xml'
2932

3033
env:
3134
LOG_DIR: /tmp/dolphinscheduler
@@ -35,6 +38,10 @@ concurrency:
3538
cancel-in-progress: true
3639

3740
jobs:
41+
build:
42+
permissions:
43+
contents: read
44+
pull-requests: write
3845
paths-filter:
3946
name: Unit-Test-Path-Filter
4047
runs-on: ubuntu-latest
@@ -93,26 +100,8 @@ jobs:
93100
path: ~/.m2/repository
94101
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-unit-test
95102
restore-keys: ${{ runner.os }}-maven-
96-
# Set up JDK 17 for SonarCloud.
97-
- name: Set up JDK 17
98-
uses: actions/setup-java@v2
99-
with:
100-
java-version: 17
101-
distribution: 'adopt'
102103
- name: Run SonarCloud Analysis
103-
run: >
104-
./mvnw --batch-mode verify sonar:sonar
105-
-Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml
106-
-Dmaven.test.skip=true
107-
-Dspotless.skip=true
108-
-Dsonar.host.url=https://sonarcloud.io
109-
-Dsonar.organization=apache
110-
-Dsonar.core.codeCoveragePlugin=jacoco
111-
-Dsonar.projectKey=apache-dolphinscheduler
112-
-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
115-
-DskipUT=true
104+
uses: SonarSource/sonarcloud-github-action@master
116105
env:
117106
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
118107
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

Diff for: pom.xml

+8-14
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
<maven.deploy.skip>false</maven.deploy.skip>
8484
<cobertura-maven-plugin.version>2.7</cobertura-maven-plugin.version>
8585
<auto-service.version>1.0.1</auto-service.version>
86-
<jacoco.skip>false</jacoco.skip>
8786
<maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
8887
<exec-maven-plugin.version>3.0.0</exec-maven-plugin.version>
8988
<owasp-dependency-check-maven.version>9.2.0</owasp-dependency-check-maven.version>
@@ -626,31 +625,26 @@
626625
<groupId>org.jacoco</groupId>
627626
<artifactId>jacoco-maven-plugin</artifactId>
628627
<version>${jacoco.version}</version>
629-
<configuration>
630-
<skip>${jacoco.skip}</skip>
631-
<dataFile>${project.build.directory}/jacoco.exec</dataFile>
632-
</configuration>
633628
<executions>
634629
<execution>
635-
<id>default-instrument</id>
636-
<goals>
637-
<goal>instrument</goal>
638-
</goals>
639-
</execution>
640-
<execution>
641-
<id>default-restore-instrumented-classes</id>
642630
<goals>
643-
<goal>restore-instrumented-classes</goal>
631+
<goal>prepare-agent</goal>
644632
</goals>
645633
</execution>
646634
<execution>
647-
<id>default-report</id>
635+
<id>report</id>
648636
<goals>
649637
<goal>report</goal>
650638
</goals>
639+
<phase>prepare-package</phase>
651640
</execution>
652641
</executions>
653642
</plugin>
643+
<plugin>
644+
<groupId>org.sonarsource.scanner.maven</groupId>
645+
<artifactId>sonar-maven-plugin</artifactId>
646+
<version>3.9.1.2184</version>
647+
</plugin>
654648
<plugin>
655649
<groupId>com.github.spotbugs</groupId>
656650
<artifactId>spotbugs-maven-plugin</artifactId>

0 commit comments

Comments
 (0)