From 25a382d9f8954ef4f3e483a5f6bb25a94e83bbe1 Mon Sep 17 00:00:00 2001 From: Mark Evenson Date: Mon, 11 Mar 2024 16:36:54 +0100 Subject: [PATCH] ci: update openjdk installations to latest Stop depending on the GitHub installed CI Java. It used to be that with GitHub actions/setup-java@v1 we could Ant installed but use jenv to use our "own" openjdk to run it. Something changed, debugging the GitHub CI via multiple pull requests is tedious, so just try to use GitHub for any dependencies beyond bash. Robustify syntax for specifying operating system and architecture to install-openjdk. --- .github/workflows/abcl-test.yml | 35 ++++++++++++---------- ci/ensure-jenv-is-present.bash | 5 +++- ci/install-ant.bash | 18 +++++++++++ ci/install-jenv.bash | 5 +++- ci/install-openjdk.bash | 53 +++++++++++++++++---------------- ci/set-jdk.bash | 5 +++- 6 files changed, 78 insertions(+), 43 deletions(-) create mode 100644 ci/install-ant.bash diff --git a/.github/workflows/abcl-test.yml b/.github/workflows/abcl-test.yml index fdb0165e8..d0a0a2432 100644 --- a/.github/workflows/abcl-test.yml +++ b/.github/workflows/abcl-test.yml @@ -19,36 +19,41 @@ jobs: run: echo "JDK_VERSION=${{ matrix.jdk }}" >> $GITHUB_ENV - name: Clone ABCL - uses: actions/checkout@v2 - - - name: Install Java base for Ant - uses: actions/setup-java@v1 - with: - java-version: 8 + uses: actions/checkout@v4 - - name: Setup jenv - run: bash -x ./ci/ensure-jenv-is-present.bash && ant abcl.diagnostic + - name: Install jenv + run: | + . ./ci/install-jenv.bash + echo ~/.jenv/bin >> $GITHUB_PATH - name: Install OpenJDK - run: bash -x ./ci/install-openjdk.bash ${JDK_VERSION} + run: . ./ci/install-openjdk.bash ${JDK_VERSION} + - name: Install Ant + run: | + bash -x ./ci/install-ant.bash + echo ~/.local/share/java/apache-ant/bin >> $GITHUB_PATH + + - name: Ensure we are using the correct JDK + run: . ./ci/ensure-jenv-is-present.bash && ant abcl.diagnostic + - name: Set abcl.properties for build - run: bash -x ./ci/create-abcl-properties.bash ${JDK_VERSION} + run: . ./ci/create-abcl-properties.bash ${JDK_VERSION} - name: Build ABCL - run: bash -x ./ci/ensure-jenv-is-present.bash && $HOME/.jenv/shims/ant abcl + run: . ./ci/ensure-jenv-is-present.bash && ant abcl - name: Configure ASDF to find abcl - run: bash -x ./ci/asdf-finds-abcl.bash + run: . ./ci/asdf-finds-abcl.bash - name: Install Jeannie for testing - run: bash -x ./ci/install-jeannie.bash + run: . ./ci/install-jeannie.bash - name: Install NONTRIVIAL-GRAY-STREAMS for testing - run: bash -x ./ci/install-nontrivial-gray-streams.bash + run: . ./ci/install-nontrivial-gray-streams.bash - name: Install the ANSI-TEST suite - run: bash -x ./ci/install-ansi-test.bash + run: . ./ci/install-ansi-test.bash - name: Install Quicklisp run: | diff --git a/ci/ensure-jenv-is-present.bash b/ci/ensure-jenv-is-present.bash index d29505fbf..883f1eb4e 100644 --- a/ci/ensure-jenv-is-present.bash +++ b/ci/ensure-jenv-is-present.bash @@ -1,7 +1,10 @@ +#!/usr/bin/env bash + export JENV_ROOT=$HOME/.jenv if [[ $(echo $PATH | grep -c .jenv) -eq 0 ]]; then export PATH="$JENV_ROOT/bin:$PATH" fi eval "$(jenv init -)" -eval "$(jenv enable-plugin export)" + + diff --git a/ci/install-ant.bash b/ci/install-ant.bash new file mode 100644 index 000000000..3b63008db --- /dev/null +++ b/ci/install-ant.bash @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + + +tmpdir=/tmp +pushd "${tmpdir}" +ant_base=apache-ant-1.10.14 +wget https://www-eu.apache.org/dist/ant/binaries/${ant_base}-bin.zip +unzip ${tmpdir}/${ant_base}-bin.zip +popd + +install_dir="$HOME/.local/share/java" +mkdir -p "${install_dir}" +mv ${tmpdir}/${ant_base} "${install_dir}/apache-ant" + +echo Ant binary installed in "${install_dir}/apache-ant/bin" + + + diff --git a/ci/install-jenv.bash b/ci/install-jenv.bash index 8ddf5c670..60cc3d877 100644 --- a/ci/install-jenv.bash +++ b/ci/install-jenv.bash @@ -9,10 +9,13 @@ fi . ${DIR}/ensure-jenv-is-present.bash +# hack +export PROMP_COMMAND="" jenv enable-plugin ant jenv enable-plugin maven jenv enable-plugin export -jenv doctor + + diff --git a/ci/install-openjdk.bash b/ci/install-openjdk.bash index d40242d3d..d4635274e 100644 --- a/ci/install-openjdk.bash +++ b/ci/install-openjdk.bash @@ -1,15 +1,17 @@ #!/usr/bin/env bash +# set -euo pipefail # too strict for jenv DIR="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -. ${DIR}/install-jenv.bash +. ${DIR}/ensure-jenv-is-present.bash jdk=$1 if [[ -z $jdk ]]; then jdk=openjdk8 fi -uname=$2 -if [[ -z $uname ]]; then +if [[ $# -eq 2 ]]; then + uname=$2 +else uname=$(uname) fi @@ -20,18 +22,18 @@ dist= function determine_openjdk() { case $uname in # just x86_64 for now. We've got Rosseta2 c'est nes pas? - Darwin) + [Dd]arwin|darwin|macos) case $jdk in openjdk8) - v=392 - build=b08 + v=402 + build=b06 version=1.8.0.${v} topdir=jdk8u${v}-${build} dist="https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u${v}-${build}/OpenJDK8U-jdk_x64_mac_hotspot_8u${v}${build}.tar.gz" ;; openjdk11) - version=11.0.21 - build=9 + version=11.0.22 + build=7 topdir=jdk-${version}+${build} dist="https://github.com/adoptium/temurin11-binaries/releases/download/jdk-${version}%2B${build}/OpenJDK11U-jdk_x64_mac_hotspot_${version}_${build}.tar.gz" ;; @@ -51,8 +53,8 @@ function determine_openjdk() { dist="https://github.com/adoptium/temurin16-binaries/releases/download/jdk-16.0.2%2B7/OpenJDK16U-jdk_x64_mac_hotspot_16.0.2_7.tar.gz" ;; openjdk17) - version=17.0.9 - build=9 + version=17.0.10 + build=7 topdir="jdk-${version}+${build}" dist="https://github.com/adoptium/temurin17-binaries/releases/download/jdk-${version}%2B${build}/OpenJDK17U-jdk_x64_mac_hotspot_${version}_${build}.tar.gz" ;; @@ -76,25 +78,25 @@ function determine_openjdk() { ;; openjdk21) v="21" - id="${v}.0.1" - rev="12" + id="${v}.0.2" + rev="13" arch="jdk_x64_mac_hotspot" topdir="jdk-${id}+${rev}" dist="https://github.com/adoptium/temurin${v}-binaries/releases/download/jdk-${id}%2B${rev}/OpenJDK${v}U-${arch}_${id}_${rev}.tar.gz" ;; esac ;; - Linux) + [Ll]inux) case $jdk in openjdk8) - version=u392 - build=b08 + version=u402 + build=b06 topdir=jdk8${version}-${build} dist="https://github.com/adoptium/temurin8-binaries/releases/download/jdk8${version}-${build}/OpenJDK8U-jdk_x64_linux_hotspot_8${version}${build}.tar.gz" ;; openjdk11) - version=11.0.21 - build=9 + version=11.0.22 + build=7 topdir=jdk-${version}+${build} dist="https://github.com/adoptium/temurin11-binaries/releases/download/jdk-${version}%2B${build}/OpenJDK11U-jdk_x64_linux_hotspot_${version}_${build}.tar.gz" ;; @@ -114,8 +116,8 @@ function determine_openjdk() { dist="https://github.com/adoptium/temurin16-binaries/releases/download/jdk-16.0.2%2B7/OpenJDK16U-jdk_x64_linux_hotspot_16.0.2_7.tar.gz" ;; openjdk17) - version=17.0.9 - build=9 + version=17.0.10 + build=7 topdir="jdk-${version}+${build}" dist="https://github.com/adoptium/temurin17-binaries/releases/download/jdk-${version}%2B${build}/OpenJDK17U-jdk_x64_linux_hotspot_${version}_${build}.tar.gz" ;; @@ -138,8 +140,8 @@ function determine_openjdk() { ;; openjdk21) v="21" - id="${v}.0.1" - rev="12" + id="${v}.0.2" + rev="13" arch="jdk_x64_linux_hotspot" topdir="jdk-${id}+${rev}" dist="https://github.com/adoptium/temurin${v}-binaries/releases/download/jdk-${id}%2B${rev}/OpenJDK${v}U-${arch}_${id}_${rev}.tar.gz" @@ -147,7 +149,7 @@ function determine_openjdk() { esac ;; *) - echo No known dist for $(uname) + echo No known dist for ${uname} esac } @@ -161,7 +163,7 @@ function download_and_extract() { popd } -function add_jdk() { +function add_jdk_to_jenv() { echo $dist echo $tmpdir case $(uname) in @@ -176,8 +178,9 @@ function add_jdk() { determine_openjdk download_and_extract -add_jdk +add_jdk_to_jenv -. ${DIR}/set-jdk.bash ${jdk} +. ${DIR}/set-jdk.bash ${jdk} ${ABCL_ROOT} jenv doctor +exit 0 diff --git a/ci/set-jdk.bash b/ci/set-jdk.bash index c929aa2b6..8df1fdace 100644 --- a/ci/set-jdk.bash +++ b/ci/set-jdk.bash @@ -35,6 +35,9 @@ function set_jdk() { openjdk20) version=$(jenv versions | grep ^\ *20\.[0-9] | tail -1 | sed s/*//) ;; + openjdk21) + version=$(jenv versions | grep ^\ *21\.[0-9] | tail -1 | sed s/*//) + ;; *) echo Failed to find an available JDK matching ${abcl_jdk} echo in $(jenv versions) @@ -63,4 +66,4 @@ function set_jdk() { popd } -set_jdk ${ABCL_JDK} ${ABCL_ROOT} +set_jdk ${JDK_VERSION} ${ABCL_VERSION}