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

kusal pushed a commit to branch gh-actions-sonar
in repository https://gitbox.apache.org/repos/asf/struts.git

commit 80ac72a796b7460cc17d53eaba4cfad411adb2bc
Author: Kusal Kithul-Godage <g...@kusal.io>
AuthorDate: Mon Sep 18 20:52:28 2023 +1000

    Split SonarCloud into separate action
---
 .github/workflows/maven.yml                | 23 +++++---------------
 .github/workflows/{maven.yml => sonar.yml} | 34 ++++++++++--------------------
 2 files changed, 16 insertions(+), 41 deletions(-)

diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index e8a370952..3e4c8d96d 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -13,7 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-name: Java Build
+name: Java Maven
 
 on:
   pull_request:
@@ -29,6 +29,7 @@ env:
 
 jobs:
   build:
+    name: Build and Test
     runs-on: ubuntu-latest
     strategy:
       matrix:
@@ -36,24 +37,10 @@ jobs:
     steps:
       - name: Checkout code
         uses: actions/checkout@v4
-      - name: Set up cache
-        uses: actions/cache@v3.3.2
+      - uses: actions/setup-java@v3
         with:
-          path: ~/.m2/repository
-          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
-          restore-keys: |
-            ${{ runner.os }}-maven-
-      - name: Set up JDK ${{ matrix.java }}
-        uses: actions/setup-java@v3
-        with:
-          distribution: adopt
+          distribution: temurin
           java-version: ${{ matrix.java }}
+          cache: 'maven'
       - name: Build with Maven on Java ${{ matrix.java }}
-        if: matrix.java != '17'
         run: mvn -B -V -DskipAssembly verify --no-transfer-progress
-      - name: Code coverage on Java ${{ matrix.java }}
-        if: matrix.java == '17'
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-          SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
-        run: mvn -B -V -Pcoverage -DskipAssembly verify 
org.sonarsource.scanner.maven:sonar-maven-plugin:sonar --no-transfer-progress
diff --git a/.github/workflows/maven.yml b/.github/workflows/sonar.yml
similarity index 61%
copy from .github/workflows/maven.yml
copy to .github/workflows/sonar.yml
index e8a370952..edd9e54d0 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/sonar.yml
@@ -13,7 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-name: Java Build
+name: SonarCloud
 
 on:
   pull_request:
@@ -26,34 +26,22 @@ permissions: read-all
 env:
   MAVEN_OPTS: -Xmx2048m -Xms1024m
   LANG: en_US.utf8
+  JAVA_VERSION: 17
 
 jobs:
-  build:
+  sonarcloud:
+    name: Scan
     runs-on: ubuntu-latest
-    strategy:
-      matrix:
-        java: [ '8', '11', '17' ]
     steps:
-      - name: Checkout code
-        uses: actions/checkout@v4
-      - name: Set up cache
-        uses: actions/cache@v3.3.2
+      - uses: actions/checkout@v4
         with:
-          path: ~/.m2/repository
-          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
-          restore-keys: |
-            ${{ runner.os }}-maven-
-      - name: Set up JDK ${{ matrix.java }}
-        uses: actions/setup-java@v3
+          fetch-depth: 0
+      - uses: actions/setup-java@v3
         with:
-          distribution: adopt
-          java-version: ${{ matrix.java }}
-      - name: Build with Maven on Java ${{ matrix.java }}
-        if: matrix.java != '17'
-        run: mvn -B -V -DskipAssembly verify --no-transfer-progress
-      - name: Code coverage on Java ${{ matrix.java }}
-        if: matrix.java == '17'
-        env:
+          distribution: temurin
+          java-version: $JAVA_VERSION
+          cache: 'maven'
+      - env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
           SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
         run: mvn -B -V -Pcoverage -DskipAssembly verify 
org.sonarsource.scanner.maven:sonar-maven-plugin:sonar --no-transfer-progress

Reply via email to