diff --git a/.github/workflows/code-analysys.yml b/.github/workflows/code-analysys.yml
new file mode 100644
index 000000000000..2a27c9a8812b
--- /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 516ceef53f41..fbb14d0d873e 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 be530d1f627d..c99aeae8e0e7 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,8 @@
# Paimon (Incubating)
+[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)
+[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=apache_incubator-paimon&metric=alert_status)](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 abfd6998db6f..2b5e2a14de32 100644
--- a/pom.xml
+++ b/pom.xml
@@ -123,6 +123,7 @@ under the License.
2.4.9
1.11.1
3.2.3
+ 0.8.8
@@ -187,6 +188,14 @@ under the License.
${awaitility.version}
test
+
+
+ org.jacoco
+ org.jacoco.agent
+ ${jacoco.version}
+ runtime
+ test
+
@@ -664,6 +673,36 @@ under the License.
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ ${jacoco.version}
+
+ false
+ ${project.build.directory}/jacoco.exec
+
+
+
+ default-instrument
+
+ instrument
+
+
+
+ default-restore-instrumented-classes
+
+ restore-instrumented-classes
+
+
+
+ default-report
+
+ report
+
+
+
+
diff --git a/tools/ci/sonar_check.sh b/tools/ci/sonar_check.sh
new file mode 100644
index 000000000000..3551929fd658
--- /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