Skip to content

Install both latest LTS and current Java #306

Install both latest LTS and current Java

Install both latest LTS and current Java #306

Workflow file for this run

name: GitHub CI
on:
push:
branches:
- master
pull_request:
branches:
- master
defaults:
run:
shell: 'bash -o errexit -o nounset -o pipefail {0}'
jobs:
ci:
runs-on: ubuntu-latest
strategy:
matrix:
versions:
- directory: jdk11
ltsJavaVersion: 11
- directory: jdk11-alpine
ltsJavaVersion: 11
variant: alpine
- directory: jdk11-focal
ltsJavaVersion: 11
variant: focal
- directory: jdk17
ltsJavaVersion: 17
- directory: jdk17-alpine
ltsJavaVersion: 17
variant: alpine
- directory: jdk17-focal
ltsJavaVersion: 17
variant: focal
- directory: jdk17-graal
ltsJavaVersion: 17
variant: graal
- directory: jdk17-focal-graal
ltsJavaVersion: 17
variant: focal-graal
- directory: jdk21
ltsJavaVersion: 21
- directory: jdk21-alpine
ltsJavaVersion: 21
variant: alpine
- directory: jdk21-graal
ltsJavaVersion: 21
variant: graal
- directory: jdk-lts-and-current
ltsJavaVersion: 21
currentJavaVersion: 22
- directory: jdk-lts-and-current-alpine
ltsJavaVersion: 21
currentJavaVersion: 22
variant: alpine
- directory: jdk-lts-and-current-graal
ltsJavaVersion: 21
currentJavaVersion: 22
variant: graal
steps:
- name: checkout
uses: actions/checkout@v2
- name: build
env:
directory: ${{ matrix.versions.directory }}
run: |
cd "${directory}"
grep "FROM " Dockerfile | cut -d' ' -f2 | xargs -I{} docker pull {}
docker build --tag "gradle:${directory}" .
- name: test
env:
directory: ${{ matrix.versions.directory }}
ltsJavaVersion: ${{ matrix.versions.ltsJavaVersion }}
currentJavaVersion: ${{ matrix.versions.currentJavaVersion }}
expectedGradleVersion: "8.7"
run: |
toolchainJavaVersion="${currentJavaVersion:-${ltsJavaVersion}}"
if [[ "${matrix.versions.variant:-''}" = "graal" ]]; then
cd test-graal
sed --regexp-extended --in-place "s/JavaLanguageVersion\.of\([0-9]+\)/JavaLanguageVersion.of(${toolchainJavaVersion})/" app/build.gradle
else
cd test
sed --regexp-extended --in-place "s/JavaLanguageVersion\.of\([0-9]+\)/JavaLanguageVersion.of(${toolchainJavaVersion})/" lib/build.gradle.kts
fi
./run.sh "gradle:${directory}" "${expectedGradleVersion}"