Skip to content

Commit d8735a1

Browse files
committed
Fix cross-language CI by auto-discovering JDK homes and setting Java 17 as default
1 parent 753c021 commit d8735a1

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

.github/actions/setup-environment-action/action.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,18 @@ runs:
6969
tox-${{ runner.os }}-py${{ inputs.python-version == 'default' && '310' || inputs.python-version }}-${{ hashFiles('sdks/python/tox.ini') }}-
7070
tox-${{ runner.os }}-py${{ inputs.python-version == 'default' && '310' || inputs.python-version }}-
7171
72+
- name: Install Java 11 fallback
73+
if: ${{ inputs.java-version == 'default' }}
74+
uses: actions/setup-java@v4
75+
with:
76+
distribution: 'temurin'
77+
java-version: '11'
7278
- name: Install Java
7379
if: ${{ inputs.java-version != '' }}
7480
uses: actions/setup-java@v4
7581
with:
7682
distribution: 'temurin'
77-
java-version: ${{ inputs.java-version == 'default' && '11' || inputs.java-version }}
83+
java-version: ${{ inputs.java-version == 'default' && '17' || inputs.java-version }}
7884
- name: Setup Gradle
7985
uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0
8086
with:

buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,16 @@ class BeamModulePlugin implements Plugin<Project> {
507507

508508
project.ext.mavenGroupId = 'org.apache.beam'
509509

510+
if (!project.hasProperty('java17Home') && System.getenv('JAVA_HOME_17_X64')) {
511+
project.ext.java17Home = System.getenv('JAVA_HOME_17_X64')
512+
}
513+
if (!project.hasProperty('java11Home') && System.getenv('JAVA_HOME_11_X64')) {
514+
project.ext.java11Home = System.getenv('JAVA_HOME_11_X64')
515+
}
516+
if (!project.hasProperty('java21Home') && System.getenv('JAVA_HOME_21_X64')) {
517+
project.ext.java21Home = System.getenv('JAVA_HOME_21_X64')
518+
}
519+
510520
// Default to dash-separated directories for artifact base name,
511521
// which will also be the default artifactId for maven publications
512522
project.apply plugin: 'base'

0 commit comments

Comments
 (0)