Fix jdk setup in GHA (#14091)

Instead of downloading jdk everytime we run CI, we're using inbuilt temurin jdk distributions 8, 11, 17 by settiing JAVA_HOME variable. This is not working as expected since we were not setting this as global environment variable as a result all CI builds are running on jdk11. This PR fixes the issue.
This commit is contained in:
Tejaswini Bandlamudi 2023-05-12 10:36:59 +05:30 committed by GitHub
parent eae9e07ea9
commit 8ef99f091a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 13 deletions

View File

@ -76,7 +76,8 @@ jobs:
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Setup java - name: Setup java
run: export JAVA_HOME=$JAVA_HOME_${{ inputs.build_jdk }}_X64 run: |
echo "JAVA_HOME=$JAVA_HOME_${{ inputs.build_jdk }}_X64" >> $GITHUB_ENV
- name: Restore Maven repository - name: Restore Maven repository
id: maven-restore id: maven-restore

View File

@ -63,7 +63,8 @@ jobs:
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Setup java - name: Setup java
run: export JAVA_HOME=$JAVA_HOME_${{ inputs.runtime_jdk }}_X64 run: |
echo "JAVA_HOME=$JAVA_HOME_${{ inputs.runtime_jdk }}_X64" >> $GITHUB_ENV
- name: Restore Maven repository - name: Restore Maven repository
id: maven-restore id: maven-restore

View File

@ -54,7 +54,8 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- name: setup jdk${{ inputs.jdk }} - name: setup jdk${{ inputs.jdk }}
run: export JAVA_HOME=$JAVA_HOME_${{ inputs.jdk }}_X64 run: |
echo "JAVA_HOME=$JAVA_HOME_${{ inputs.jdk }}_X64" >> $GITHUB_ENV
- name: Restore Maven repository - name: Restore Maven repository
id: maven-restore id: maven-restore
@ -98,4 +99,5 @@ jobs:
- name: test & coverage - name: test & coverage
env: env:
MAVEN_PROJECTS: ${{ inputs.maven_projects }} MAVEN_PROJECTS: ${{ inputs.maven_projects }}
run: ./.github/scripts/unit_tests_script.sh run: |
./.github/scripts/unit_tests_script.sh

View File

@ -53,7 +53,8 @@ jobs:
echo "java_version=${jdk:3}" >> $GITHUB_ENV echo "java_version=${jdk:3}" >> $GITHUB_ENV
- name: setup ${{ matrix.java }} - name: setup ${{ matrix.java }}
run: export JAVA_HOME=$JAVA_HOME_${{ env.java_version }}_X64 run: |
echo "JAVA_HOME=$JAVA_HOME_${{ env.java_version }}_X64" >> $GITHUB_ENV
- name: packaging check - name: packaging check
run: | run: |
@ -141,12 +142,9 @@ jobs:
- name: checkout branch - name: checkout branch
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Set up JDK 11 - name: setup JDK11
uses: actions/setup-java@v3 run: |
with: echo "JAVA_HOME=$JAVA_HOME_11_X64" >> $GITHUB_ENV
java-version: '11'
distribution: 'temurin'
cache: maven
- name: setup node - name: setup node
uses: actions/setup-node@v3 uses: actions/setup-node@v3

View File

@ -58,8 +58,9 @@ jobs:
- name: Checkout branch - name: Checkout branch
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Setup java - name: setup jdk${{ matrix.jdk }}
run: export JAVA_HOME=$JAVA_HOME_${{ matrix.jdk }}_X64 run: |
echo "JAVA_HOME=$JAVA_HOME_${{ matrix.jdk }}_X64" >> $GITHUB_ENV
- name: Cache Maven m2 repository - name: Cache Maven m2 repository
id: maven id: maven