You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by pk...@apache.org on 2024/10/10 19:42:01 UTC

(logging-log4j-samples) 01/01: Add manual integration test workflow

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

pkarwasz pushed a commit to branch feature/integrated-tests
in repository https://gitbox.apache.org/repos/asf/logging-log4j-samples.git

commit 69831fccf64c5931aef0da89b9542f5cb379e9e0
Author: Piotr P. Karwasz <pi...@karwasz.org>
AuthorDate: Thu Oct 10 21:41:49 2024 +0200

    Add manual integration test workflow
    
    Add an `integration-test.yaml` workflow that starts all the available tests for a given Log4j version.
    
    This workflow can be started manually, after we close a Staging Maven Repository during the release process.
---
 .github/workflows/android-reusable-test.yaml | 11 +++++-
 .github/workflows/graalvm-reusable-test.yaml | 16 ++++----
 .github/workflows/integration-test.yaml      | 56 ++++++++++++++++++++++++++++
 log4j-samples-android/gradle.properties      |  8 ++--
 log4j-samples-graalvm/pom.xml                | 33 +++++++++-------
 pom.xml                                      | 24 +++++++++---
 6 files changed, 116 insertions(+), 32 deletions(-)

diff --git a/.github/workflows/android-reusable-test.yaml b/.github/workflows/android-reusable-test.yaml
index 70812c9..2f0b9e0 100644
--- a/.github/workflows/android-reusable-test.yaml
+++ b/.github/workflows/android-reusable-test.yaml
@@ -21,9 +21,14 @@ on:
   workflow_call:
     inputs:
       log4j-version:
-        description: 'Log4j version'
-        required: true
+        description: Version of Log4j Core
         type: string
+        # Should point to the current 2.x snapshot version
+        default: 2.25.0-SNAPSHOT
+      log4j-repository-url:
+        description: Additional Maven repository
+        type: string
+        default: 'https://repository.apache.org/snapshots'
 
 permissions: read-all
 
@@ -91,10 +96,12 @@ jobs:
         shell: bash
         env:
           LOG4J_VERSION: ${{ inputs.log4j-version }}
+          LOG4J_REPOSITORY_URL: ${{ inputs.log4j-repository-url }}
         run: |
           log4j-samples-android/gradlew -p log4j-samples-android \
           --console plain \
           -Plog4j.version=$LOG4J_VERSION \
+          -Plog4j.repository.url=$LOG4J_REPOSITORY_URL \
           build connectedCheck
 
       - name: Remove AVD Device
diff --git a/.github/workflows/graalvm-reusable-test.yaml b/.github/workflows/graalvm-reusable-test.yaml
index c118826..1f3d9a2 100644
--- a/.github/workflows/graalvm-reusable-test.yaml
+++ b/.github/workflows/graalvm-reusable-test.yaml
@@ -20,14 +20,15 @@ name: graalvm-reusable-test
 on:
   workflow_call:
     inputs:
-      backend:
-        description: 'Logging backend'
-        required: true
-        type: string
       log4j-version:
-        description: 'Log4j version'
-        required: true
+        description: Version of Log4j Core
+        type: string
+        # Should point to the current 2.x snapshot version
+        default: 2.25.0-SNAPSHOT
+      log4j-repository-url:
+        description: Additional Maven repository
         type: string
+        default: 'https://repository.apache.org/snapshots'
 
 permissions: read-all
 
@@ -40,6 +41,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
+        backend: [ jul, log4j-core-minimal, log4j-core-jtl, log4j-core, logback, simple]
         os: [ macos-latest, ubuntu-latest, windows-latest ]
 
     steps:
@@ -57,7 +59,7 @@ jobs:
         shell: bash
         env:
           LOG4J_VERSION: ${{ inputs.log4j-version }}
-          MAVEN_PROFILE: use-${{ inputs.backend }}
+          MAVEN_PROFILE: use-${{ matrix.backend }}
         run: |
           ./mvnw -f log4j-samples-graalvm \
             --show-version --batch-mode --errors --no-transfer-progress \
diff --git a/.github/workflows/integration-test.yaml b/.github/workflows/integration-test.yaml
new file mode 100644
index 0000000..70dcc1a
--- /dev/null
+++ b/.github/workflows/integration-test.yaml
@@ -0,0 +1,56 @@
+#
+# 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: integration-test
+
+on:
+  workflow_dispatch:
+    inputs:
+      log4j-version:
+        description: Version of Log4j Core
+        # Should point to the current 2.x snapshot version
+        default: 2.25.0-SNAPSHOT
+      log4j-repository-url:
+        description: Additional Maven repository
+        default: 'https://repository.apache.org/snapshots'
+
+env:
+  MAVEN_ARGS: ${{ inputs.log4j-version }}
+
+permissions: read-all
+
+jobs:
+
+  jre-test:
+    uses: apache/logging-parent/.github/workflows/build-reusable.yaml@feature/maven-args
+    with:
+      java-version: 21
+      maven-args: |
+        -Dlog4j.version=${{log4j-version}}
+        -Dlog4j.repository.url=${{log4j-repository-url}}
+
+  android-test:
+    uses: apache/logging-log4j-samples/.github/workflows/android-reusable-test.yaml@feature/integrated-tests
+    with:
+      log4j-version: ${{ inputs.log4j-version }}
+      log4j-repository-url: ${{ inputs.log4j-repository-url }}
+
+  graalvm-test:
+    uses: apache/logging-log4j-samples/.github/workflows/graalvm-reusable-test.yaml@feature/integrated-tests
+    with:
+      log4j-version: ${{ inputs.log4j-version }}
+      log4j-repository-url: ${{ inputs.log4j-repository-url }}
\ No newline at end of file
diff --git a/log4j-samples-android/gradle.properties b/log4j-samples-android/gradle.properties
index 63e8e74..1258a0a 100644
--- a/log4j-samples-android/gradle.properties
+++ b/log4j-samples-android/gradle.properties
@@ -19,13 +19,13 @@
 android.useAndroidX = true
 
 ##
-# Version of Log4j to use
+# Version of Log4j Core
 #
-# Defaults to the last stable 2.x release
+# Default: last stable 2.x release
 log4j.version = 2.24.1
 
 ##
-# Additional Maven Repository to use
+# Additional Maven repository
 #
-# Defaults to Apache Snapshots Repository
+# Default: Apache Snapshots Repository
 log4j.repository.url = https://repository.apache.org/snapshots
\ No newline at end of file
diff --git a/log4j-samples-graalvm/pom.xml b/log4j-samples-graalvm/pom.xml
index 31f4c49..0c81682 100644
--- a/log4j-samples-graalvm/pom.xml
+++ b/log4j-samples-graalvm/pom.xml
@@ -29,6 +29,21 @@
   <name>Apache Log4j Samples: GraalVM native image</name>
 
   <properties>
+    <!--
+  ~ Version of Log4j Core
+  ~
+  ~ Set to latest stable 2.x release for users.
+  ~ Our workflows override this.
+  -->
+    <log4j.version>2.24.1</log4j.version>
+    <!--
+      ~ Additional Maven repository
+      ~
+      ~ Default: Apache Snapshots Repository
+      ~ Our workflows override this.
+      -->
+    <log4j.repository.url>https://repository.apache.org/snapshots</log4j.repository.url>
+
     <!-- Some samples require JDK 9+ -->
     <minimalJavaBuildVersion>17</minimalJavaBuildVersion>
     <maven.compiler.release>17</maven.compiler.release>
@@ -133,21 +148,11 @@
 
   <repositories>
 
+    <!-- The repository that contains the requested Log4j version -->
     <repository>
-      <releases>
-        <enabled>false</enabled>
-      </releases>
-      <id>apache.snapshots</id>
-      <name>Apache Snapshot Repository</name>
-      <url>https://repository.apache.org/snapshots</url>
-    </repository>
-
-    <repository>
-      <snapshots>
-        <enabled>false</enabled>
-      </snapshots>
-      <id>apache.staging</id>
-      <url>https://repository.apache.org/content/repositories/orgapachelogging-1303</url>
+      <id>log4j</id>
+      <name>Log4j Maven Repository</name>
+      <url>${log4j.repository.url}</url>
     </repository>
 
   </repositories>
diff --git a/pom.xml b/pom.xml
index f1b28be..c2d1315 100644
--- a/pom.xml
+++ b/pom.xml
@@ -56,6 +56,21 @@
          Hence, we use a fake version and DO NOT CHANGE IT! -->
     <revision>0.0.0-SNAPSHOT</revision>
 
+    <!--
+      ~ Version of Log4j Core
+      ~
+      ~ Set to latest stable 2.x release for users.
+      ~ Our workflows override this.
+      -->
+    <log4j.version>2.24.1</log4j.version>
+    <!--
+      ~ Additional Maven repository
+      ~
+      ~ Default: Apache Snapshots Repository
+      ~ Our workflows override this.
+      -->
+    <log4j.repository.url>https://repository.apache.org/snapshots</log4j.repository.url>
+
     <!-- Some samples require JDK 9+ -->
     <minimalJavaBuildVersion>11</minimalJavaBuildVersion>
     <maven.compiler.release>11</maven.compiler.release>
@@ -267,12 +282,11 @@
 
   <repositories>
 
+    <!-- The repository that contains the requested Log4j version -->
     <repository>
-      <snapshots>
-        <enabled>false</enabled>
-      </snapshots>
-      <id>apache.staging</id>
-      <url>https://repository.apache.org/content/repositories/orgapachelogging-1303</url>
+      <id>log4j</id>
+      <name>Log4j Maven Repository</name>
+      <url>${log4j.repository.url}</url>
     </repository>
 
   </repositories>