From abb78c39269e581ed6866e9666a5042b4a9c2f3e Mon Sep 17 00:00:00 2001 From: Jack Date: Wed, 7 Aug 2024 10:00:03 +0100 Subject: [PATCH] Move Java installation from `apt-get` to `setup-java` action MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In https://github.com/hazelcast/client-compatibility-suites/pull/127#issuecomment-2272140720 it was identified that using `apt-get` to install Java on GitHub runners can cause issues with Maven using the right JDK, and that using `setup-java` instead resolves that. Fixes: https://github.com/hazelcast/hazelcast-cpp-client/issues/1222 🤞 --- .github/java-config.env | 2 ++ .github/workflows/build-pr.yml | 11 ++++++++++- .github/workflows/nightly-ubuntu-i386.yml | 11 ++++++++++- 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 .github/java-config.env diff --git a/.github/java-config.env b/.github/java-config.env new file mode 100644 index 000000000..a4160c17d --- /dev/null +++ b/.github/java-config.env @@ -0,0 +1,2 @@ +JAVA_VERSION=11 +JAVA_DISTRIBUTION=temurin \ No newline at end of file diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index b60985f52..a7a2cb071 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -200,7 +200,7 @@ jobs: - name: Install Necessary Packages run: | apt-get update - apt-get install -y build-essential cmake curl git libssl-dev maven net-tools openjdk-11-jre-headless gdb curl + apt-get install -y build-essential cmake curl git libssl-dev net-tools gdb curl - name: Make sure the target architecture is 32 bit run: | @@ -215,6 +215,15 @@ jobs: ref: ${{ needs.get-refs.outputs.ref }} token: ${{ secrets.GH_TOKEN }} + - name: Read Java Config + run: cat ${{ github.workspace }}/.github/java-config.env >> $GITHUB_ENV + + - name: "Setup JDK" + uses: "actions/setup-java@v4" + with: + java-version: ${{ env.JAVA_VERSION }} + distribution: ${{ env.JAVA_DISTRIBUTION }} + - name: Download hazelcast-enterprise-tests.jar run: | curl -H "Authorization: token ${{ secrets.GH_TOKEN }}" https://raw.githubusercontent.com/hazelcast/private-test-artifacts/data/certs.jar > hazelcast-enterprise-5.3.0-SNAPSHOT-tests.jar diff --git a/.github/workflows/nightly-ubuntu-i386.yml b/.github/workflows/nightly-ubuntu-i386.yml index e29a2f913..c7fbc5620 100644 --- a/.github/workflows/nightly-ubuntu-i386.yml +++ b/.github/workflows/nightly-ubuntu-i386.yml @@ -49,7 +49,7 @@ jobs: - name: Install Necessary Packages run: | apt-get update - apt-get install -y build-essential cmake curl git libssl-dev maven net-tools openjdk-11-jre-headless gdb curl + apt-get install -y build-essential cmake curl git libssl-dev net-tools gdb curl - name: Make sure the target architecture is 32 bit run: | @@ -60,6 +60,15 @@ jobs: - uses: actions/checkout@v1 + - name: Read Java Config + run: cat ${{ github.workspace }}/.github/java-config.env >> $GITHUB_ENV + + - name: "Setup JDK" + uses: "actions/setup-java@v4" + with: + java-version: ${{ env.JAVA_VERSION }} + distribution: ${{ env.JAVA_DISTRIBUTION }} + - name: Download hazelcast-enterprise-tests.jar run: | curl -H "Authorization: token ${{ secrets.GH_TOKEN }}" https://raw.githubusercontent.com/hazelcast/private-test-artifacts/data/certs.jar > hazelcast-enterprise-5.3.0-SNAPSHOT-tests.jar