This is an automated email from the ASF dual-hosted git repository.
lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-paimon.git
The following commit(s) were added to refs/heads/master by this push:
new 9448c1626 [CI] Add Sonar Check (#836)
9448c1626 is described below
commit 9448c16265fec02c67d4739b49da880bdb673a32
Author: Guangdong Liu <[email protected]>
AuthorDate: Tue Apr 11 15:57:44 2023 +0800
[CI] Add Sonar Check (#836)
---
.github/workflows/code-analysys.yml | 38 ++++++++++++++++++++++++++++++++++++
.gitignore | 1 +
README.md | 3 +++
pom.xml | 39 +++++++++++++++++++++++++++++++++++++
tools/ci/sonar_check.sh | 21 ++++++++++++++++++++
5 files changed, 102 insertions(+)
diff --git a/.github/workflows/code-analysys.yml
b/.github/workflows/code-analysys.yml
new file mode 100644
index 000000000..2a27c9a88
--- /dev/null
+++ b/.github/workflows/code-analysys.yml
@@ -0,0 +1,38 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+name: SonarCloud
+on:
+ schedule:
+ - cron: '0 1 * * *'
+ workflow_dispatch:
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ timeout-minutes: 120
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ submodules: true
+ - name: Set up JDK 11
+ uses: actions/setup-java@v2
+ with:
+ java-version: 11
+ distribution: 'adopt'
+ - name: Run SonarCloud Analysis
+ run: bash ./tools/ci/sonar_check.sh
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
diff --git a/.gitignore b/.gitignore
index 516ceef53..fbb14d0d8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,3 +15,4 @@ target
.DS_Store
*.ipr
*.iws
+test/coverage
diff --git a/README.md b/README.md
index be530d1f6..c99aeae8e 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,8 @@
# Paimon (Incubating)
+[](https://www.apache.org/licenses/LICENSE-2.0.html)
+[](https://sonarcloud.io/summary/new_code?id=apache_incubator-paimon)
+
Paimon is a streaming data lake platform that supports high-speed data
ingestion, change data tracking and efficient real-time analytics.
Background and documentation is available at https://paimon.apache.org
diff --git a/pom.xml b/pom.xml
index abfd6998d..2b5e2a14d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -123,6 +123,7 @@ under the License.
<json-smart.version>2.4.9</json-smart.version>
<avro.version>1.11.1</avro.version>
<kafka.version>3.2.3</kafka.version>
+ <jacoco.version>0.8.8</jacoco.version>
</properties>
<dependencies>
@@ -187,6 +188,14 @@ under the License.
<version>${awaitility.version}</version>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.jacoco</groupId>
+ <artifactId>org.jacoco.agent</artifactId>
+ <version>${jacoco.version}</version>
+ <classifier>runtime</classifier>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<dependencyManagement>
@@ -664,6 +673,36 @@ under the License.
</execution>
</executions>
</plugin>
+ <!-- add plugin jacoco report -->
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <version>${jacoco.version}</version>
+ <configuration>
+ <skip>false</skip>
+ <dataFile>${project.build.directory}/jacoco.exec</dataFile>
+ </configuration>
+ <executions>
+ <execution>
+ <id>default-instrument</id>
+ <goals>
+ <goal>instrument</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>default-restore-instrumented-classes</id>
+ <goals>
+ <goal>restore-instrumented-classes</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>default-report</id>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
<pluginManagement>
diff --git a/tools/ci/sonar_check.sh b/tools/ci/sonar_check.sh
new file mode 100644
index 000000000..3551929fd
--- /dev/null
+++ b/tools/ci/sonar_check.sh
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+if [ ! "$SONAR_TOKEN" ]; then
+ echo "SONAR_TOKEN environment is null, skip check"
+ exit 0
+fi
+./mvnw --batch-mode verify sonar:sonar -Dmaven.test.skip=true
-Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=apache
-Dsonar.projectKey=apache_incubator-paimon
-Dsonar.core.codeCoveragePlugin=jacoco
-Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml
-Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false
-Dmaven.wagon.httpconnectionManager.ttlSeconds=120