Skip to content

Commit

Permalink
Use Java 21 LTS
Browse files Browse the repository at this point in the history
John Duffell has reported improved speed from Java 21 LTS:

https://chat.google.com/room/AAAAag0I08g/Nvinl3aN_cU/

...and Mariot has confirmed that we should be encouraging people to move to Java 21.

In `gha-scala-library-release-workflow` we always use the same version of Java to _compile_ the project, regardless of the repo, because we've not yet encountered a need to configure the Java on a pre-repo basis. However, we do recommend that repos specify the `-release` flag in their `build.sbt` `scalacOptions`, which specifies the minimum release of Java that should be supported in the resulting artifacts - we still have some systems runinng on Java 8, so unfortunately they need `-release:8`

https://docs.scala-lang.org/overviews/jdk-compatibility/overview.html#jdk-21-compatibility-notes
  • Loading branch information
rtyley committed Mar 14, 2024
1 parent e5c513a commit 5a688f1
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/reusable-release.yml
Expand Up @@ -10,6 +10,11 @@ on:
default: '807361' # Only for use by the Guardian!
required: false # ...but if you're not the Guardian, you'll want to set this explicitly
type: string
LIBRARY_BUILD_JAVA_VERSION_FILE:
description: "Path within the repo to the java-version-file - see https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#java-version-file"
default: '.tool-versions' # as used by https://asdf-vm.com/
required: false
type: string
SONATYPE_PROFILE_NAME:
description: 'Sonatype account profile name, eg "com.gu", "org.xerial", etc (not your Sonatype username)'
default: 'com.gu' # Only for use by the Guardian!
Expand Down Expand Up @@ -54,6 +59,7 @@ env:
RUN_ATTEMPT_UID: ${{ github.run_id }}-${{ github.run_attempt }}
TEMPORARY_BRANCH: release-workflow/temporary/${{ github.run_id }}
GITHUB_REPO_URL: ${{ github.server_url }}/${{ github.repository }}
LATEST_LTS_JAVA_VERSION: '21' # Used by all parts of the workflow that are not invoking the library's build process

jobs:
init:
Expand All @@ -68,7 +74,7 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 17
java-version: ${{ env.LATEST_LTS_JAVA_VERSION }}
gpg-private-key: ${{ secrets.PGP_PRIVATE_KEY }}
- name: Read Identifiers from Signing Key
id: read-identifiers
Expand Down Expand Up @@ -115,7 +121,7 @@ jobs:
- uses: actions/setup-java@v4 # don't 'cache: sbt', at least until https://github.com/actions/setup-java/pull/564 is merged
with:
distribution: corretto
java-version: 17
java-version-file: ${{ inputs.LIBRARY_BUILD_JAVA_VERSION_FILE }}
# - name: Debug MIMA assessment
# run: |
# sbt "show versionPolicyFindIssues"
Expand Down Expand Up @@ -176,7 +182,7 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 17
java-version: ${{ env.LATEST_LTS_JAVA_VERSION }}
gpg-private-key: ${{ secrets.PGP_PRIVATE_KEY }}
- name: Create commit
id: create-commit
Expand Down Expand Up @@ -250,7 +256,7 @@ jobs:
- uses: actions/setup-java@v4 # don't 'cache: sbt', at least until https://github.com/actions/setup-java/pull/564 is resolved
with:
distribution: corretto
java-version: 17
java-version-file: ${{ inputs.LIBRARY_BUILD_JAVA_VERSION_FILE }}
- name: Generate artifacts
run: |
cat << EndOfFile > sbt-commands.txt
Expand Down Expand Up @@ -305,7 +311,7 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 17
java-version: ${{ env.LATEST_LTS_JAVA_VERSION }}
gpg-private-key: ${{ secrets.PGP_PRIVATE_KEY }}
- name: Sign artifacts
run: |
Expand Down Expand Up @@ -377,7 +383,7 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 17
java-version: ${{ env.LATEST_LTS_JAVA_VERSION }}
cache: sbt # the issue described in https://github.com/actions/setup-java/pull/564 doesn't affect this step (no version.sbt)
- name: Release
env:
Expand Down

0 comments on commit 5a688f1

Please sign in to comment.