Update GH workflows / Gradle run steps #1355
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (C) 2021 The Authors of CEL-Java | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
name: CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
jobs: | |
java: | |
name: Java/Gradle | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 4 | |
matrix: | |
java-version: [11, 17, 21] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'true' | |
# Special handling to test against Java 8: | |
# antlr version 4.10 requires Java 11 to run the antlr tool, but tests still need to run | |
# against Java 8 - that's being done here: | |
- name: Set up Java 8 | |
if: ${{ matrix.java-version == '11' }} | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 8 | |
- name: Configure env with Java 8 home | |
if: ${{ matrix.java-version == '11' }} | |
run: | |
echo "JAVA_8_HOME=$JAVA_HOME" >> $GITHUB_ENV | |
- name: Enable Java 8 tests | |
if: ${{ matrix.java-version == '11' }} | |
run: | |
echo "ADDITIONAL_GRADLE_OPTS=-PalsoTestAgainstJava8" >> $GITHUB_ENV | |
- name: Configure Java 8 home for Gradle | |
if: ${{ matrix.java-version == '11' }} | |
run: | | |
mkdir -p $HOME/.gradle | |
echo "org.gradle.java.installations.fromEnv=JAVA_8_HOME" >> $HOME/.gradle/gradle.properties | |
- name: Set up JDK ${{ matrix.java-version }} | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: ${{ matrix.java-version }} | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
with: | |
cache-read-only: ${{ github.event_name != 'push' || github.ref != 'refs/heads/main' }} | |
- name: Spotless Check | |
# Spotless must run in a different invocation, because | |
# it has some weird Gradle configuration/variant issue | |
run: ./gradlew spotlessCheck --scan | |
- name: Build | |
run: ./gradlew --rerun-tasks assemble ${{ env.ADDITIONAL_GRADLE_OPTS }} check publishToMavenLocal -x jmh -x spotlessCheck --scan | |
- name: Build tool integrations | |
# The buildToolIntegration* tasks require publishToMavenLocal, run it as a separate step, | |
# because these tasks intentionally do not depend on the publishToMavenLocal tasks. | |
run: ./gradlew buildToolIntegrations | |
- name: Microbenchmarks | |
run: ./gradlew jmh | |
- name: Cache Bazel stuff | |
if: ${{ matrix.java-version == '11' }} | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/bazel | |
key: bazel-${{ hashFiles('**/.gitmodules') }} | |
restore-keys: bazel- | |
- name: Conformance tests | |
if: ${{ matrix.java-version == '11' }} | |
run: conformance/run-conformance-tests.sh | |
- name: Capture test results | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: test-results | |
path: | | |
**/build/reports/* | |
**/build/test-results/* |