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 2023/03/06 18:16:23 UTC
[logging-log4j2] 01/06: Simplify build
This is an automated email from the ASF dual-hosted git repository.
pkarwasz pushed a commit to branch 2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
commit be283b9d922d584104d9e5e524868f4027b44566
Author: Piotr P. Karwasz <pi...@karwasz.org>
AuthorDate: Mon Mar 6 08:07:32 2023 +0100
Simplify build
Remove multiple Java setup and Maven build steps.
The newest Java setup steps also deal with toolchains.
---
.github/workflows/build.yml | 95 ++++++++--------------------------
.github/workflows/codeql-analysis.yml | 26 +++-------
.github/workflows/maven-toolchains.xml | 37 -------------
3 files changed, 31 insertions(+), 127 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 4d96dda6d9..4c42867d52 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -42,25 +42,15 @@ jobs:
with:
fetch-depth: 32
- # JDK 11 is needed for the build.
+ # JDK 8 and 11 is needed for the build.
# Search `maven-toolchains-plugin` usages for details.
- - name: Setup JDK 11
+ - name: Setup JDK
uses: actions/setup-java@1df8dbefe2a8cbc99770194893dd902763bee34b # 3.9.0
with:
distribution: temurin
- java-version: 11
- java-package: jdk
- architecture: x64
- cache: maven
-
- # JDK 8 is needed for the build, and it is the primary bytecode target.
- # Hence, JDK 8 is set up after 11, so that JAVA_HOME used by Maven during build will point to 8.
- - name: Setup JDK 8
- uses: actions/setup-java@1df8dbefe2a8cbc99770194893dd902763bee34b # 3.9.0
- with:
- distribution: temurin
- java-version: 8
- java-package: jdk
+ java-version: |
+ 8
+ 11
architecture: x64
cache: maven
@@ -69,13 +59,13 @@ jobs:
# For details, see: https://maven.apache.org/guides/mini/guide-reproducible-builds.html#how-to-test-my-maven-build-reproducibility
# 2. `javadoc:javadoc-no-fork`, which is attached to the `site` goal
- name: Build
- timeout-minutes: 10
+ timeout-minutes: 60
shell: bash
+ env:
+ JAVA_HOME: ${{ env.JAVA_HOME_8_X64 }}
run: |
./mvnw \
--show-version --batch-mode --errors --no-transfer-progress \
- --global-toolchains ".github/workflows/maven-toolchains.xml" \
- -DskipTests=true \
clean install
# `clean verify artifact:compare` is required to generate the build reproducibility report.
@@ -84,58 +74,32 @@ jobs:
id: report-reproducible
timeout-minutes: 10
shell: bash
+ env:
+ JAVA_HOME: ${{ env.JAVA_HOME_8_X64 }}
run: |
./mvnw \
--show-version --batch-mode --errors --no-transfer-progress \
- --global-toolchains ".github/workflows/maven-toolchains.xml" \
-DskipTests=true \
- clean verify artifact:compare || failed=1
-
- # `artifact:compare` doesn't fail the build in case of a reproducibility problem.
- # Below we manually check reproducibility build reports and fail the build, if necessary.
- - name: Verify build reproducibility
- shell: bash
- run: |
- for report_file in target/*.buildcompare **/target/*.buildcompare; do
- if ! grep -q "^ko=0$" "$report_file"; then
- echo "Spotted build reproducibility failure in \`$report_file\`:"
- cat "$report_file"
- failed=1
- fi
- done
- if [ -n "$failed" ]; then
- exit $failed
- fi
+ clean package artifact:compare
- name: Upload reproducibility failure context artifacts
- if: failure() && steps.report-reproducible.outcome == 'failure'
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce
+ if: failure()
+ uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # 3.1.2
with:
- name: reproducubility-failure-context-${{matrix.os}}
+ name: reproducibility-failure-context-${{matrix.os}}
path: |
**/target/*.buildcompare
**/target/*.jar
**/target/reference/*.jar
- - name: Maven "verify"
- timeout-minutes: 60
- shell: bash
- run: |
- ./mvnw \
- --show-version --batch-mode --errors --no-transfer-progress \
- --global-toolchains ".github/workflows/maven-toolchains.xml" \
- -DtrimStackTrace=false \
- -Dsurefire.rerunFailingTestsCount=2 \
- -Dlog4j2.junit.fileCleanerSleepPeriodMillis=1000 \
- verify
-
- - name: Maven "site"
+ - name: Build site
timeout-minutes: 10
shell: bash
+ env:
+ JAVA_HOME: ${{ env.JAVA_HOME_8_X64 }}
run: |
./mvnw \
--show-version --batch-mode --errors --no-transfer-progress \
- --global-toolchains ".github/workflows/maven-toolchains.xml" \
site
merge:
@@ -169,31 +133,18 @@ jobs:
with:
fetch-depth: 32
- # JDK 11 is needed for the build.
+ # JDK 8 and 11 are needed for the build.
# Search `maven-toolchains-plugin` usages for details.
- - name: Setup JDK 11
+ - name: Setup JDK
uses: actions/setup-java@1df8dbefe2a8cbc99770194893dd902763bee34b # 3.9.0
with:
distribution: temurin
- java-version: 11
- java-package: jdk
+ java-version: |
+ 8
+ 11
architecture: x64
cache: maven
- # JDK 8 is needed for the build, and it is the primary bytecode target.
- # Hence, JDK 8 is set up after 11, so that JAVA_HOME used by Maven during build will point to 8.
- - name: Setup JDK 8
- uses: actions/setup-java@1df8dbefe2a8cbc99770194893dd902763bee34b # 3.9.0
- with:
- distribution: temurin
- java-version: 8
- java-package: jdk
- architecture: x64
- cache: maven
-
- - name: Inspect environment
- run: env | grep '^JAVA'
-
- name: Inspect project version
run: |
echo ::set-output name=version::$(./mvnw \
@@ -211,11 +162,11 @@ jobs:
run: |
./mvnw \
--show-version --batch-mode --errors --no-transfer-progress \
- --global-toolchains ".github/workflows/maven-toolchains.xml" \
--settings .github/workflows/maven-settings.xml \
-Dgpg.skip=true \
-DskipTests=true \
package install:install deploy:deploy
env:
+ JAVA_HOME: ${{ env.JAVA_HOME_8_X64 }}
NEXUS_USER: ${{ secrets.NEXUS_USER }}
NEXUS_PW: ${{ secrets.NEXUS_PW }}
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 9838931e79..4288cb5a78 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -60,36 +60,26 @@ jobs:
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
- # JDK 11 is needed for the build.
+ # JDK 8 and 11 is needed for the build.
# Search `maven-toolchains-plugin` usages for details.
- - name: Setup JDK 11
+ - name: Setup JDK
uses: actions/setup-java@1df8dbefe2a8cbc99770194893dd902763bee34b # 3.9.0
with:
distribution: temurin
- java-version: 11
- java-package: jdk
- architecture: x64
- cache: maven
-
- # JDK 8 is needed for the build, and it is the primary bytecode target.
- # Hence, JDK 8 is set up after 11, so that JAVA_HOME used by Maven during build will point to 8.
- - name: Setup JDK 8
- uses: actions/setup-java@1df8dbefe2a8cbc99770194893dd902763bee34b # 3.9.0
- with:
- distribution: temurin
- java-version: 8
- java-package: jdk
- architecture: x64
+ java-version: |
+ 8
+ 11
cache: maven
- name: Build with Maven
timeout-minutes: 60
shell: bash
+ env:
+ JAVA_HOME: ${{ env.JAVA_HOME_8_X64 }}
run: |
./mvnw \
--show-version --batch-mode --errors --no-transfer-progress \
- -DskipTests \
- --global-toolchains ".github/workflows/maven-toolchains.xml"
+ -DskipTests
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@959cbb7472c4d4ad70cdfe6f4976053fe48ab394 # 2.1.37
diff --git a/.github/workflows/maven-toolchains.xml b/.github/workflows/maven-toolchains.xml
deleted file mode 100644
index 066a50ff2f..0000000000
--- a/.github/workflows/maven-toolchains.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF8"?>
-<!--
- ~ 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.
- -->
-<toolchains>
- <toolchain>
- <type>jdk</type>
- <provides>
- <version>1.8</version>
- </provides>
- <configuration>
- <jdkHome>${env.JAVA_HOME_8_X64}</jdkHome>
- </configuration>
- </toolchain>
- <toolchain>
- <type>jdk</type>
- <provides>
- <version>11</version>
- </provides>
- <configuration>
- <jdkHome>${env.JAVA_HOME_11_X64}</jdkHome>
- </configuration>
- </toolchain>
-</toolchains>