Skip to content

Commit

Permalink
ci: update openjdk installations to latest
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
easye committed Mar 18, 2024
1 parent a1320c5 commit 8381add
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 43 deletions.
35 changes: 20 additions & 15 deletions .github/workflows/abcl-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
5 changes: 4 additions & 1 deletion ci/ensure-jenv-is-present.bash
Original file line number Diff line number Diff line change
@@ -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)"


18 changes: 18 additions & 0 deletions ci/install-ant.bash
Original file line number Diff line number Diff line change
@@ -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"



5 changes: 4 additions & 1 deletion ci/install-jenv.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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




53 changes: 28 additions & 25 deletions ci/install-openjdk.bash
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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"
;;
Expand All @@ -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"
;;
Expand All @@ -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"
;;
Expand All @@ -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"
;;
Expand All @@ -138,16 +140,16 @@ 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"
;;
esac
;;
*)
echo No known dist for $(uname)
echo No known dist for ${uname}
esac
}

Expand All @@ -161,7 +163,7 @@ function download_and_extract() {
popd
}

function add_jdk() {
function add_jdk_to_jenv() {
echo $dist
echo $tmpdir
case $(uname) in
Expand All @@ -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
5 changes: 4 additions & 1 deletion ci/set-jdk.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -63,4 +66,4 @@ function set_jdk() {
popd
}

set_jdk ${ABCL_JDK} ${ABCL_ROOT}
set_jdk ${JDK_VERSION} ${ABCL_VERSION}

0 comments on commit 8381add

Please sign in to comment.