-
Notifications
You must be signed in to change notification settings - Fork 18
120 lines (106 loc) · 3.86 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# 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, 20]
steps:
- uses: actions/checkout@v3
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@v3
with:
distribution: 'zulu'
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@v3
with:
distribution: 'zulu'
java-version: ${{ matrix.java-version }}
- name: Spotless Check
uses: gradle/gradle-build-action@v2
with:
# Spotless must run in a different invocation, because
# it has some weird Gradle configuration/variant issue
arguments: spotlessCheck --scan
- name: Build with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: --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.
uses: gradle/gradle-build-action@v2
with:
arguments: buildToolIntegrations
- name: Microbenchmarks
uses: gradle/gradle-build-action@v2
with:
arguments: jmh
- name: Cache Bazel stuff
if: ${{ matrix.java-version == '11' }}
uses: actions/cache@v3
with:
path: |
~/.cache/bazel
key: bazel-${{ hashFiles('**/.gitmodules') }}
restore-keys: bazel-
- name: Setup bazel
if: ${{ matrix.java-version == '11' }}
uses: jwlawson/[email protected]
with:
bazel-version: '3.5.1'
- name: Conformance tests
if: ${{ matrix.java-version == '11' }}
run: conformance/run-conformance-tests.sh
- uses: codecov/codecov-action@v3
if: ${{ matrix.java-version == '11' }}
with:
files: jacoco/build/reports/jacoco/codeCoverageReport/codeCoverageReport.xml
flags: java
- name: Capture test results
uses: actions/upload-artifact@v3
if: failure()
with:
name: test-results
path: |
**/build/reports/*
**/build/test-results/*