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

sjaranowski pushed a commit to branch mvn4
in repository https://gitbox.apache.org/repos/asf/maven-gh-actions-shared.git

commit 852491ae057abac9fa196d90ca9e88f836c4bc33
Author: Slawomir Jaranowski <s.jaranow...@gmail.com>
AuthorDate: Sat Jun 1 16:40:27 2024 +0200

    Add support for Maven 4
---
 .github/workflows/maven-verify-test.yml | 27 +++++++++++++--
 .github/workflows/maven-verify.yml      | 60 ++++++++++++++++++++++++++++++---
 2 files changed, 81 insertions(+), 6 deletions(-)

diff --git a/.github/workflows/maven-verify-test.yml 
b/.github/workflows/maven-verify-test.yml
index 3cd11dd..5945c6d 100644
--- a/.github/workflows/maven-verify-test.yml
+++ b/.github/workflows/maven-verify-test.yml
@@ -21,12 +21,14 @@ on: [ push, pull_request ]
 
 jobs:
 
+  # default config
   verify-1:
     name: Verify 1
     uses: ./.github/workflows/maven-verify.yml
 
+  # override fail fast config
   verify-2:
-    name: Verify 2
+    name: Verify 2 - fail fast config
     uses: ./.github/workflows/maven-verify.yml
     needs: verify-1
     with:
@@ -35,4 +37,25 @@ jobs:
       ff-jdk: '21'
       verify-goal: clean install
       verify-fail-fast: false
-      maven-matrix: '[ "3.9.6", "3.8.8", "3.6.3" ]'
+      maven-matrix: '[ "3.9.7", "3.8.8", "3.6.3" ]'
+
+  # test with Maven 4
+  verify-3:
+    name: Verify 3 - with Maven 4
+    uses: ./.github/workflows/maven-verify.yml
+    needs: verify-2
+    with:
+      maven4-enabled: true
+      ff-site-run: false
+      ff-goal: verify
+      verify-goal: verify
+
+  # test with Maven 4 without fail fast job
+  verify-4:
+    name: Verify 4 - with Maven 4 - no ff job
+    uses: ./.github/workflows/maven-verify.yml
+    needs: verify-3
+    with:
+      maven4-enabled: true
+      ff-run: false
+      verify-goal: verify
diff --git a/.github/workflows/maven-verify.yml 
b/.github/workflows/maven-verify.yml
index b8a2cca..c90a575 100644
--- a/.github/workflows/maven-verify.yml
+++ b/.github/workflows/maven-verify.yml
@@ -50,6 +50,18 @@ on:
         default: '[ "3.6.3", "3.9.7" ]'
         type: string
 
+      maven4-verison:
+        description: The Maven 4.x version matrix
+        required: false
+        default: '4.0.0-beta-3'
+        type: string
+
+      maven4-enabled:
+        description: Determinate if use Maven 4 in build matrix
+        required: false
+        default: false
+        type: boolean
+
       matrix-include:
         description: include for matrix as json
         required: false
@@ -227,12 +239,52 @@ jobs:
       - name: Clean Ensuring no file handle remains open on windows
         run: ./mvnw clean --errors --batch-mode --show-version
 
-  verify:
+  # prepare matrix data for verify step
+  setup-matrix:
+    runs-on: "ubuntu-latest"
     needs: fail-fast-build
+    if: always() && ( !inputs.ff-run || needs.fail-fast-build.result == 
'success' )
+    outputs:
+      maven: ${{ steps.maven.outputs.matrix }}
+      exclude: ${{ steps.exclude.outputs.matrix }}
+
+    steps:
+      - id: maven
+        name: setup Maven matrix
+        run: |
+          {
+            echo 'matrix<<EOF'
+            if [ "${{ inputs.maven4-enabled }}" = "true" ]; then
+              echo '${{ inputs.maven-matrix }}' | jq -c '. + ["${{ 
inputs.maven4-verison }}"]'
+            else
+              echo '${{ inputs.maven-matrix }}'            
+            fi
+            echo 'EOF'
+          } >> "$GITHUB_OUTPUT"
+          
+          cat "$GITHUB_OUTPUT"
+
+      - id: exclude
+        name: setup exclude matrix
+        run: |
+          {
+            echo 'matrix<<EOF'
+            if [ "${{ inputs.maven4-enabled }}" = "true" ]; then
+              echo '${{ inputs.matrix-exclude }}' | jq -c '. + [{"jdk": "8", 
"maven": "${{ inputs.maven4-verison }}"}]'
+            else
+              echo '${{ inputs.matrix-exclude }}'            
+            fi
+            echo 'EOF'
+          } >> "$GITHUB_OUTPUT"
+          
+          cat "$GITHUB_OUTPUT"
+          
+
+  verify:
+    needs: setup-matrix
     name: ${{ matrix.os }} jdk-${{ matrix.jdk }}-${{ matrix.distribution }} 
${{ matrix.maven }}
     timeout-minutes: ${{ inputs.timeout-minutes }}
     runs-on: ${{ matrix.os }}
-    if: always() && ( !inputs.ff-run || needs.fail-fast-build.result == 
'success' )
 
     strategy:
       fail-fast: ${{ inputs.verify-fail-fast }}
@@ -240,9 +292,9 @@ jobs:
         os: ${{ fromJSON( inputs.os-matrix ) }}
         jdk: ${{ fromJSON( inputs.jdk-matrix ) }}
         distribution: ${{ fromJSON( inputs.jdk-distribution-matrix ) }}
-        maven: ${{ fromJSON( inputs.maven-matrix ) }}
+        maven: ${{ fromJSON( needs.setup-matrix.outputs.maven ) }}
         include: ${{ fromJSON( inputs.matrix-include ) }}
-        exclude: ${{ fromJSON( inputs.matrix-exclude ) }}
+        exclude: ${{ fromJSON( needs.setup-matrix.outputs.exclude ) }}
       max-parallel: ${{ inputs.max-parallel }}
 
     steps:

Reply via email to