Skip to content

Commit f36c772

Browse files
committed
Add integration test workflow
Add an `integration-test.yaml` workflow that starts all the available tests for a given Log4j version. This workflow is started: - at each modification of this repository. - once a day to test the latest Log4j snapshot. - manually, after we close a Staging Maven Repository during the release process.
1 parent 96ebf66 commit f36c772

File tree

13 files changed

+430
-554
lines changed

13 files changed

+430
-554
lines changed

.github/workflows/android-reusable-test.yaml

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,14 @@ on:
2121
workflow_call:
2222
inputs:
2323
log4j-version:
24-
description: 'Log4j version'
25-
required: true
24+
description: Version of Log4j Core
2625
type: string
26+
# Should point to the current 2.x snapshot version
27+
default: 2.25.0-SNAPSHOT
28+
log4j-repository-url:
29+
description: Additional Maven repository
30+
type: string
31+
default: 'https://repository.apache.org/snapshots'
2732

2833
permissions: read-all
2934

@@ -46,6 +51,12 @@ jobs:
4651

4752
- name: Setup Gradle
4853
uses: gradle/actions/setup-gradle@d156388eb19639ec20ade50009f3d199ce1e2808 # 4.1.0
54+
with:
55+
develocity-access-key: ${{ secrets.GE_ACCESS_KEY }}
56+
develocity-injection-enabled: true
57+
develocity-url: https://ge.apache.org
58+
develocity-plugin-version: 3.18.1
59+
4960

5061
- name: Enable KVM
5162
run: |
@@ -56,10 +67,17 @@ jobs:
5667
- name: Create AVD Device
5768
id: avd
5869
shell: bash
59-
env:
60-
ANDROID_SDK_VERSION: 10406996
61-
ANDROID_SDK_CHECKSUM: 8919e8752979db73d8321e9babe2caedcc393750817c1a5f56c128ec442fb540
6270
run: |
71+
# Debug environment variables
72+
printenv | grep '^ANDROID\|^HOME' | sort
73+
74+
# Set `ANDROID_USER_HOME` since `emulator` and `avdmanager` use different definitions:
75+
# * `avdmanager` uses `$XDG_CONFIG_HOME/.android` with a fallback to `$HOME/.android`:
76+
# https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:common/src/main/java/com/android/prefs/AbstractAndroidLocations.kt
77+
# * `emulator` uses `HOME/.android`
78+
export ANDROID_USER_HOME="$HOME/.android"
79+
echo "ANDROID_USER_HOME=$ANDROID_USER_HOME" >> $GITHUB_ENV
80+
6381
# List installed and available packages
6482
$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --list
6583
# Download images
@@ -71,6 +89,7 @@ jobs:
7189
--name generic-api-31-device \
7290
--device "5.4in FWVGA" \
7391
--package "system-images;android-31;default;x86_64"
92+
$ANDROID_HOME/cmdline-tools/latest/bin/avdmanager list avds
7493
# Run emulator
7594
$ANDROID_HOME/emulator/emulator \
7695
-no-audio -no-window \
@@ -91,10 +110,12 @@ jobs:
91110
shell: bash
92111
env:
93112
LOG4J_VERSION: ${{ inputs.log4j-version }}
113+
LOG4J_REPOSITORY_URL: ${{ inputs.log4j-repository-url }}
94114
run: |
95115
log4j-samples-android/gradlew -p log4j-samples-android \
96116
--console plain \
97117
-Plog4j.version=$LOG4J_VERSION \
118+
-Plog4j.repository.url=$LOG4J_REPOSITORY_URL \
98119
build connectedCheck
99120
100121
- name: Remove AVD Device

.github/workflows/android-test.yaml

Lines changed: 0 additions & 34 deletions
This file was deleted.

.github/workflows/build.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ on:
3030
- "**.adoc"
3131
- "**.md"
3232
- "**.txt"
33+
schedule:
34+
- cron: "29 17 * * *"
3335

3436
permissions: read-all
3537

3638
jobs:
3739

38-
build:
40+
integration-test:
3941
if: github.actor != 'dependabot[bot]'
40-
uses: apache/logging-parent/.github/workflows/build-reusable.yaml@rel/11.3.0
41-
with:
42-
java-version: 21
42+
uses: apache/logging-log4j-samples/.github/workflows/integration-test.yaml@main

.github/workflows/graalvm-reusable-test.yaml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@ name: graalvm-reusable-test
2020
on:
2121
workflow_call:
2222
inputs:
23-
backend:
24-
description: 'Logging backend'
25-
required: true
26-
type: string
2723
log4j-version:
28-
description: 'Log4j version'
29-
required: true
24+
description: Version of Log4j Core
25+
type: string
26+
# Should point to the current 2.x snapshot version
27+
default: 2.25.0-SNAPSHOT
28+
log4j-repository-url:
29+
description: Additional Maven repository
3030
type: string
31+
default: 'https://repository.apache.org/snapshots'
3132

3233
permissions: read-all
3334

@@ -40,6 +41,7 @@ jobs:
4041
strategy:
4142
fail-fast: false
4243
matrix:
44+
backend: [ jul, log4j-core-minimal, log4j-core-jtl, log4j-core, logback, simple]
4345
os: [ macos-latest, ubuntu-latest, windows-latest ]
4446

4547
steps:
@@ -57,7 +59,7 @@ jobs:
5759
shell: bash
5860
env:
5961
LOG4J_VERSION: ${{ inputs.log4j-version }}
60-
MAVEN_PROFILE: use-${{ inputs.backend }}
62+
MAVEN_PROFILE: use-${{ matrix.backend }}
6163
run: |
6264
./mvnw -f log4j-samples-graalvm \
6365
--show-version --batch-mode --errors --no-transfer-progress \

.github/workflows/graalvm-test.yaml

Lines changed: 0 additions & 38 deletions
This file was deleted.

.github/workflows/integration-test.yaml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@
1818
name: integration-test
1919

2020
on:
21+
workflow_call:
22+
inputs:
23+
log4j-version:
24+
description: Version of Log4j Core
25+
type: string
26+
# Should point to the current 2.x snapshot version
27+
default: 2.25.0-SNAPSHOT
28+
log4j-repository-url:
29+
description: Additional Maven repository
30+
type: string
31+
default: 'https://repository.apache.org/snapshots'
2132
workflow_dispatch:
2233
inputs:
2334
log4j-version:
@@ -36,21 +47,21 @@ permissions: read-all
3647
jobs:
3748

3849
jre-test:
39-
uses: apache/logging-parent/.github/workflows/build-reusable.yaml@feature/maven-args
50+
uses: apache/logging-parent/.github/workflows/build-reusable.yaml@main
4051
with:
4152
java-version: 21
4253
maven-args: |
43-
-Dlog4j.version=${{log4j-version}}
44-
-Dlog4j.repository.url=${{log4j-repository-url}}
54+
-Dlog4j.version=${{ inputs.log4j-version }}
55+
-Dlog4j.repository.url=${{ inputs.log4j-repository-url }}
4556
4657
android-test:
47-
uses: apache/logging-log4j-samples/.github/workflows/android-reusable-test.yaml@feature/integrated-tests
58+
uses: apache/logging-log4j-samples/.github/workflows/android-reusable-test.yaml@main
4859
with:
4960
log4j-version: ${{ inputs.log4j-version }}
5061
log4j-repository-url: ${{ inputs.log4j-repository-url }}
5162

5263
graalvm-test:
53-
uses: apache/logging-log4j-samples/.github/workflows/graalvm-reusable-test.yaml@feature/integrated-tests
64+
uses: apache/logging-log4j-samples/.github/workflows/graalvm-reusable-test.yaml@main
5465
with:
5566
log4j-version: ${{ inputs.log4j-version }}
56-
log4j-repository-url: ${{ inputs.log4j-repository-url }}
67+
log4j-repository-url: ${{ inputs.log4j-repository-url }}

.github/workflows/merge-dependabot.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,21 @@ permissions: read-all
2828

2929
jobs:
3030

31-
build:
31+
integration-test:
3232
if: github.repository == 'apache/logging-log4j-samples' && github.event_name == 'pull_request_target' && github.actor == 'dependabot[bot]'
33-
uses: apache/logging-parent/.github/workflows/build-reusable.yaml@rel/11.3.0
33+
uses: apache/logging-log4j-samples/.github/workflows/integration-test.yaml@main
3434
with:
3535
java-version: 21
3636

3737
merge-dependabot:
3838
needs: build
39-
uses: apache/logging-parent/.github/workflows/merge-dependabot-reusable.yaml@rel/11.3.0
39+
uses: apache/logging-parent/.github/workflows/merge-dependabot-reusable.yaml@main
4040
permissions:
4141
contents: write # to push changelog commits
4242
pull-requests: write # to close the PR
4343
secrets:
4444
GPG_SECRET_KEY: ${{ secrets.LOGGING_GPG_SECRET_KEY }} # to sign commits
45+
with:
46+
maven-args: |
47+
-Dlog4j.version=${{ inputs.log4j-version }}
48+
-Dlog4j.repository.url=${{ inputs.log4j-repository-url }}

.mvn/wrapper/maven-wrapper.properties

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
# KIND, either express or implied. See the License for the
1515
# specific language governing permissions and limitations
1616
# under the License.
17-
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.0/apache-maven-3.9.0-bin.zip
18-
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
17+
wrapperVersion=3.3.2
18+
distributionType=only-script
19+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip

log4j-samples-android/gradle.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
android.useAndroidX = true
2020

2121
##
22-
# Version of Log4j to use
22+
# Version of Log4j Core
2323
#
24-
# Defaults to the last stable 2.x release
24+
# Default: last stable 2.x release
2525
log4j.version = 2.24.1
2626

2727
##
28-
# Additional Maven Repository to use
28+
# Additional Maven repository
2929
#
30-
# Defaults to Apache Snapshots Repository
30+
# Default: Apache Snapshots Repository
3131
log4j.repository.url = https://repository.apache.org/snapshots

log4j-samples-graalvm/pom.xml

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,21 @@
2929
<name>Apache Log4j Samples: GraalVM native image</name>
3030

3131
<properties>
32+
<!--
33+
~ Version of Log4j Core
34+
~
35+
~ Set to latest stable 2.x release for users.
36+
~ Our workflows override this.
37+
-->
38+
<log4j.version>2.24.1</log4j.version>
39+
<!--
40+
~ Additional Maven repository
41+
~
42+
~ Default: Apache Snapshots Repository
43+
~ Our workflows override this.
44+
-->
45+
<log4j.repository.url>https://repository.apache.org/snapshots</log4j.repository.url>
46+
3247
<!-- Some samples require JDK 9+ -->
3348
<minimalJavaBuildVersion>17</minimalJavaBuildVersion>
3449
<maven.compiler.release>17</maven.compiler.release>
@@ -133,21 +148,11 @@
133148

134149
<repositories>
135150

151+
<!-- The repository that contains the requested Log4j version -->
136152
<repository>
137-
<releases>
138-
<enabled>false</enabled>
139-
</releases>
140-
<id>apache.snapshots</id>
141-
<name>Apache Snapshot Repository</name>
142-
<url>https://repository.apache.org/snapshots</url>
143-
</repository>
144-
145-
<repository>
146-
<snapshots>
147-
<enabled>false</enabled>
148-
</snapshots>
149-
<id>apache.staging</id>
150-
<url>https://repository.apache.org/content/repositories/orgapachelogging-1303</url>
153+
<id>log4j</id>
154+
<name>Log4j Maven Repository</name>
155+
<url>${log4j.repository.url}</url>
151156
</repository>
152157

153158
</repositories>

0 commit comments

Comments
 (0)