Fix Java and Bazel version when building with Bazel in GitHub Actions.
This CL fixes the version of Java to JDK8 and Bazel to 3.7.1
For Java, ubuntu-latest will soon be switching from Java 8 to Java 11 as the default (https://github.com/actions/virtual-environments/issues/1816), and our Bazel builds currently don't work with Java 11 since compile_testing depends on @local_jdk//:lib/tools.jar which doesn't exist in Java 11.
https://github.com/google/bazel-common/blob/master/third_party/java/compile_testing/BUILD#L32
For Bazel, ubuntu-latest currently uses Bazel 4.0.0 by default, which fails with Robolectric tests @Config annotation:
```
error: missing required annotation argument: <clinit> @Config
```
RELNOTES=N/A
PiperOrigin-RevId: 358062883
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 328d4b1..958ca52 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -10,7 +10,17 @@
bazel-test:
name: 'Bazel tests'
runs-on: ubuntu-latest
+ env:
+ # Our Bazel builds currently rely on JDK 8.
+ USE_JAVA_VERSION: '8'
+ # Our Bazel builds currently rely on 3.7.1. The version is set via
+ # baselisk by USE_BAZEL_VERSION: https://github.com/bazelbuild/bazelisk.
+ USE_BAZEL_VERSION: '3.7.1'
steps:
+ - name: 'Install Java ${{ env.USE_JAVA_VERSION }}'
+ uses: actions/setup-java@v1
+ with:
+ java-version: '${{ env.USE_JAVA_VERSION }}'
- name: 'Check out repository'
uses: actions/checkout@v2
- name: 'Cache local Maven repository'