diff --git a/synthtool/gcp/templates/java_library/.github/sync-repo-settings.yaml b/synthtool/gcp/templates/java_library/.github/sync-repo-settings.yaml index 72acb9d8f..7dbee898d 100644 --- a/synthtool/gcp/templates/java_library/.github/sync-repo-settings.yaml +++ b/synthtool/gcp/templates/java_library/.github/sync-repo-settings.yaml @@ -41,7 +41,7 @@ branchProtectionRules: requiresStrictStatusChecks: false # List of required status check contexts that must pass for commits to be accepted to matching branches. requiredStatusCheckContexts: - - "dependencies (11)" + - "dependencies (17)" - "lint" - "units (8)" - "units (11)" diff --git a/synthtool/gcp/templates/java_library/.github/workflows/ci.yaml b/synthtool/gcp/templates/java_library/.github/workflows/ci.yaml index d283eeff4..71859e7a9 100644 --- a/synthtool/gcp/templates/java_library/.github/workflows/ci.yaml +++ b/synthtool/gcp/templates/java_library/.github/workflows/ci.yaml @@ -25,7 +25,7 @@ jobs: strategy: fail-fast: false matrix: - java: [8, 11, 17] + java: [11, 17] steps: - uses: actions/checkout@v3 - uses: actions/setup-java@v3 @@ -36,6 +36,28 @@ jobs: - run: .kokoro/build.sh env: JOB_TYPE: test + units-java8: + # Building using Java 17 and run the tests with Java 8 runtime + name: "units (8)" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + java-version: 8 + distribution: zulu + - name: "Set jvm system property environment variable for surefire plugin (unit tests)" + # Maven surefire plugin (unit tests) allows us to specify JVM to run the tests. + # https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#jvm + run: echo "SUREFIRE_JVM_OPT=-Djvm=${JAVA_HOME}/bin/java" >> $GITHUB_ENV + shell: bash + - uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: zulu + - run: .kokoro/build.sh + env: + JOB_TYPE: test windows: runs-on: windows-latest steps: @@ -54,7 +76,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [8, 11, 17] + java: [17] steps: - uses: actions/checkout@v3 - uses: actions/setup-java@v3 diff --git a/synthtool/gcp/templates/java_library/.kokoro/build.sh b/synthtool/gcp/templates/java_library/.kokoro/build.sh index ee2a0dd77..bafdc02b3 100755 --- a/synthtool/gcp/templates/java_library/.kokoro/build.sh +++ b/synthtool/gcp/templates/java_library/.kokoro/build.sh @@ -47,7 +47,8 @@ set +e case ${JOB_TYPE} in test) - mvn test -B -ntp -Dclirr.skip=true -Denforcer.skip=true + echo "SUREFIRE_JVM_OPT: ${SUREFIRE_JVM_OPT}" + mvn test -B -ntp -Dclirr.skip=true -Denforcer.skip=true ${SUREFIRE_JVM_OPT} RETURN_CODE=$? ;; lint)