This is an automated email from the ASF dual-hosted git repository.

mmuzaf pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new 93155687fe3 IGNIE-19178 Analyze banches and pull requests with 
SonarCloud (#10621)
93155687fe3 is described below

commit 93155687fe31c18a5be70a3791420e5b9d24aa41
Author: Maxim Muzafarov <3415046+mmu...@users.noreply.github.com>
AuthorDate: Fri Apr 7 18:03:51 2023 +0300

    IGNIE-19178 Analyze banches and pull requests with SonarCloud (#10621)
    
    * IGNIE-19178 Analyze Apache Ignite project with SonarCloud
---
 .github/workflows/commit-check.yml       | 11 ++--
 .github/workflows/sonar-branch.yml       | 77 ++++++++++++++++++++++++++++
 .github/workflows/sonar-pr-from-fork.yml | 87 ++++++++++++++++++++++++++++++++
 parent/pom.xml                           |  3 ++
 4 files changed, 174 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/commit-check.yml 
b/.github/workflows/commit-check.yml
index e488d9a14ef..ad818297108 100644
--- a/.github/workflows/commit-check.yml
+++ b/.github/workflows/commit-check.yml
@@ -13,7 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-name: Check code style and abandoned tests.
+name: Code Style, Abandoned Tests
 on:
   pull_request:
   push:
@@ -21,6 +21,10 @@ on:
       - master
       - 'ignite-[0-9].[0-9]+.[0-9]+*'
 
+concurrency:
+  group: ${{ github.workflow }}-${{ github.event.pull_request.number || 
github.ref }}
+  cancel-in-progress: true
+
 jobs:
   check-java:
     runs-on: ubuntu-latest
@@ -54,13 +58,12 @@ jobs:
 
       - name: Run codestyle and licenses checks
         run: |
-          mvn test-compile 
-Pall-java,licenses,lgpl,checkstyle,examples,all-scala,scala,check-licenses -B 
-V
+          ./mvnw test-compile 
-Pall-java,licenses,lgpl,checkstyle,examples,all-scala,scala,check-licenses -B 
-V
 
       - name: Run abandoned tests checks.
         if: ${{ matrix.java == '8' }}
         run : |
-          mvn test -Pcheck-test-suites,all-java,all-scala,scala -B -V
-
+          ./mvnw test -Pcheck-test-suites,all-java,all-scala,scala -B -V
 
   check-dotnet:
     name: Сheck .NET code
diff --git a/.github/workflows/sonar-branch.yml 
b/.github/workflows/sonar-branch.yml
new file mode 100644
index 00000000000..6a8628c5360
--- /dev/null
+++ b/.github/workflows/sonar-branch.yml
@@ -0,0 +1,77 @@
+# 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: Sonar Quality Branch Analysis
+
+on:
+  push:
+    branches:
+      - master
+      - 'ignite-[0-9].[0-9]+.[0-9]+*'
+
+env:
+  MAVEN_OPTS: -Xms2g
+
+jobs:
+  sonarcloud:
+    name: Sonar Analysis
+    if: github.repository == 'apache/ignite'
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v3
+        with:
+          fetch-depth: 0
+
+      - name: Setup java
+        uses: actions/setup-java@v3
+        with:
+          distribution: 'temurin'
+          java-version: 11
+          cache: 'maven'
+
+      - name: Cache SonarCloud packages
+        uses: actions/cache@v3
+        with:
+          path: ~/.sonar/cache
+          key: ${{ runner.os }}-sonar
+          restore-keys: ${{ runner.os }}-sonar
+
+      - name: Cache Maven packages
+        uses: actions/cache@v3
+        with:
+          path: ~/.m2
+          key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
+          restore-keys: ${{ runner.os }}-m2
+
+      - name: Install Libnuma
+        run: sudo apt-get update && sudo apt-get install libnuma-dev
+
+      - name: Build with Maven
+        run: |
+          ./mvnw install -P all-java,lgpl,examples,skip-docs -DskipTests -B -V 
         
+
+      - name: Sonar Analyze Upload
+        run: >
+          ./mvnw org.sonarsource.scanner.maven:sonar-maven-plugin:sonar 
+          -P all-java,lgpl,examples,skip-docs
+          -Dsonar.branch.name=${{ github.ref_name }}
+          -Dsonar.projectKey=apache_ignite
+          -Dsonar.login=${SONARCLOUD_TOKEN}
+          -B -V
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          SONARCLOUD_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
diff --git a/.github/workflows/sonar-pr-from-fork.yml 
b/.github/workflows/sonar-pr-from-fork.yml
new file mode 100644
index 00000000000..8c1e1f78e08
--- /dev/null
+++ b/.github/workflows/sonar-pr-from-fork.yml
@@ -0,0 +1,87 @@
+# 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: Sonar Quality Pull Request Analysis
+
+on: [pull_request_target]
+
+permissions:
+  contents: read
+
+env:
+  MAVEN_OPTS: -Xms2g
+
+concurrency:
+  group: ${{ github.workflow }}-${{ github.event.pull_request.number || 
github.ref }}
+  cancel-in-progress: true
+
+jobs:
+  sonarcloud:
+    if: github.repository == 'apache/ignite'
+    name: Sonar Analysis
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v3
+        with:
+          ref: "refs/pull/${{ github.event.number }}/merge"
+          fetch-depth: 0
+
+      - name: Set up JDK11
+        uses: actions/setup-java@v3
+        with:
+          distribution: 'temurin'
+          java-version: '11'
+          cache: 'maven'
+
+      - name: Cache SonarCloud packages
+        uses: actions/cache@v3
+        with:
+          path: ~/.sonar/cache
+          key: ${{ runner.os }}-sonar
+          restore-keys: ${{ runner.os }}-sonar
+
+      - name: Cache local Maven repository
+        uses: actions/cache@v3
+        with:
+          path: ~/.m2/repository
+          key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
+          restore-keys: |
+            ${{ runner.os }}-m2
+
+      - name: Install Libnuma
+        run: sudo apt-get update && sudo apt-get install libnuma-dev
+
+      - name: Build with Maven
+        run: |
+          ./mvnw clean install -P all-java,lgpl,examples,skip-docs -DskipTests 
-B -V          
+
+      - name: Sonar Analyze Upload
+        run: >
+          ./mvnw org.sonarsource.scanner.maven:sonar-maven-plugin:sonar 
+          -P all-java,lgpl,examples,skip-docs
+          -Dsonar.pullrequest.branch=${{ github.head_ref }}
+          -Dsonar.pullrequest.base=${{ github.base_ref }}
+          -Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
+          -Dsonar.pullrequest.github.repository=apache/ignite
+          -Dsonar.pullrequest.provider=GitHub 
+          -Dsonar.pullrequest.github.summary_comment=true
+          -Dsonar.projectKey=apache_ignite
+          -Dsonar.login=${SONARCLOUD_TOKEN}
+          -B -V
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          SONARCLOUD_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
diff --git a/parent/pom.xml b/parent/pom.xml
index 71730159b9f..82b5a0ba4c8 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -155,6 +155,9 @@
 
         <!-- Maven plugins versions -->
         <maven.javadoc.plugin.version>3.2.0</maven.javadoc.plugin.version>
+        <sonar.organization>apache</sonar.organization>
+        <sonar.host.url>https://sonarcloud.io</sonar.host.url>
+        <sonar.exclusions>**/generated/**/*</sonar.exclusions>
 
         <!-- OSGI Manifest generation default property values -->
         <osgi.import.package>*</osgi.import.package>

Reply via email to