Place Java setup in re-usable workflow file (#17541)

Co-authored-by: Stian Thorgersen <stianst@gmail.com>
This commit is contained in:
Jon Koops 2023-07-26 12:35:21 +02:00 committed by GitHub
parent db49430efb
commit 2f617bd28e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 37 additions and 66 deletions

View file

@ -5,29 +5,18 @@ inputs:
upload-m2-repo:
description: Upload Maven repository for org.keycloak artifacts
required: false
default: true
default: "true"
upload-dist:
description: Upload distribution
required: false
default: false
jdk-dist:
description: JDK distribution
required: false
default: temurin
jdk-version:
description: JDK version
required: false
default: 17
default: "false"
runs:
using: composite
steps:
- id: setup-java
name: Setup Java
uses: actions/setup-java@v3
with:
distribution: ${{ inputs.jdk-dist }}
java-version: ${{ inputs.jdk-version }}
uses: ./.github/actions/java-setup
- id: maven-cache
name: Maven cache

View file

@ -9,14 +9,14 @@ inputs:
jdk-version:
description: JDK version
required: false
default: 17
default: "17"
runs:
using: composite
steps:
- id: setup-java
name: Setup Java
uses: actions/setup-java@v3
uses: ./.github/actions/java-setup
with:
distribution: ${{ inputs.jdk-dist }}
java-version: ${{ inputs.jdk-version }}

22
.github/actions/java-setup/action.yml vendored Normal file
View file

@ -0,0 +1,22 @@
name: Setup Java
description: Sets up Java.
inputs:
distribution:
description: Java distribution.
required: false
default: temurin
java-version:
description: The Java version that is going to be set up.
required: false
default: "17"
runs:
using: composite
steps:
- id: setup-java
name: Setup Java
uses: actions/setup-java@v3
with:
distribution: ${{ inputs.distribution }}
java-version: ${{ inputs.java-version }}

View file

@ -1,25 +1,11 @@
name: Setup unit test
description: Download Maven caches needed for unit tests
inputs:
jdk-dist:
description: JDK distribution
required: false
default: temurin
jdk-version:
description: JDK version
required: false
default: 17
runs:
using: composite
steps:
- id: setup-java
name: Setup Java
uses: actions/setup-java@v3
with:
distribution: ${{ inputs.jdk-dist }}
java-version: ${{ inputs.jdk-version }}
- name: Setup Java
uses: ./.github/actions/java-setup
- id: maven-cache
name: Maven cache

View file

@ -9,8 +9,6 @@ on:
workflow_dispatch:
env:
DEFAULT_JDK_VERSION: 17
DEFAULT_JDK_DIST: temurin
SUREFIRE_RERUN_FAILING_COUNT: 2
concurrency:
@ -357,8 +355,6 @@ jobs:
- id: unit-test-setup
name: Unit test setup
uses: ./.github/actions/unit-test-setup
with:
jdk-version: 17
- name: Run crypto tests
run: docker run --rm --workdir /github/workspace -v "${{ github.workspace }}":"/github/workspace" -v "$HOME/.m2":"/root/.m2" registry.access.redhat.com/ubi8/ubi:latest .github/scripts/run-fips-ut.sh

View file

@ -8,10 +8,6 @@ on:
pull_request:
workflow_dispatch:
env:
DEFAULT_JDK_VERSION: 17
DEFAULT_JDK_DIST: temurin
concurrency:
# Only cancel jobs for PR updates
group: documentation-${{ github.head_ref || github.run_id }}
@ -46,10 +42,7 @@ jobs:
- id: setup-java
name: Setup Java
uses: actions/setup-java@v3
with:
distribution: ${{ env.DEFAULT_JDK_DIST }}
java-version: ${{ env.DEFAULT_JDK_VERSION }}
uses: ./.github/actions/java-setup
- id: maven-cache
name: Maven cache
@ -86,10 +79,7 @@ jobs:
- id: setup-java
name: Setup Java
uses: actions/setup-java@v3
with:
distribution: ${{ env.DEFAULT_JDK_DIST }}
java-version: ${{ env.DEFAULT_JDK_VERSION }}
uses: ./.github/actions/java-setup
- id: maven-cache
name: Maven cache

View file

@ -8,10 +8,6 @@ on:
pull_request:
workflow_dispatch:
env:
DEFAULT_JDK_VERSION: 17
DEFAULT_JDK_DIST: temurin
concurrency:
# Only cancel jobs for PR updates
group: guides-${{ github.head_ref || github.run_id }}

View file

@ -9,8 +9,6 @@ on:
workflow_dispatch:
env:
DEFAULT_JDK_VERSION: 17
DEFAULT_JDK_DIST: temurin
MINIKUBE_VERSION: v1.28.0
KUBERNETES_VERSION: v1.22.3
@ -63,10 +61,8 @@ jobs:
id: vars
run: echo "version_local=0.0.1-${GITHUB_SHA::6}" >> $GITHUB_ENV
- uses: actions/setup-java@v3
with:
distribution: ${{ env.DEFAULT_JDK_DIST }}
java-version: ${{ env.DEFAULT_JDK_VERSION }}
- name: Setup Java
uses: ./.github/actions/java-setup
- name: Setup Minikube-Kubernetes
uses: manusa/actions-setup-minikube@v2.7.2
@ -110,10 +106,8 @@ jobs:
id: vars
run: echo "version_remote=0.0.1-${GITHUB_SHA::6}" >> $GITHUB_ENV
- uses: actions/setup-java@v3
with:
distribution: ${{ env.DEFAULT_JDK_DIST }}
java-version: ${{ env.DEFAULT_JDK_VERSION }}
- name: Setup Java
uses: ./.github/actions/java-setup
- name: Setup Minikube-Kubernetes
uses: manusa/actions-setup-minikube@v2.7.2
@ -156,10 +150,8 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: ${{ env.DEFAULT_JDK_DIST }}
java-version: ${{ env.DEFAULT_JDK_VERSION }}
- name: Setup Java
uses: ./.github/actions/java-setup
- name: Setup Minikube-Kubernetes
uses: manusa/actions-setup-minikube@v2.7.2