Skip to content

Commit 41b46ba

Browse files
authored
Simplified set of CI jobs (#1271)
This PR implements the following new policy for jobs to run on CI: * We only run the build on the latest LTS JDK version (currently 21) * Run tests on the latest LTS JDK version (the standard `test` task) * Run tests on any older LTS versions supported by the latest version of Error Prone (currently JDK 17) * Test on latest JDK version (currently 24) * Test on oldest supported Error Prone version, on oldest JDK that it supports, only for core NullAway tests (JDK 11, Error Prone 2.14.0) * Test on Linux, Mac, and Windows This is in preparation for updating to Gradle 9 (#1270), which can only run on JDK 17+. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - Chores - Simplified CI: trimmed matrix to macOS and Windows, standardized job names, and unified build/test steps. - Adjusted coverage gating to run on Linux with repository filter. - Removed matrix-based gating for local publishing. - Minor cleanup of formatting and step structure. - Tests - Updated JDK test targets: replaced 21 with 17; 24 remains. - Kept certain JDK-specific tests disabled, aligned with new targets. - Removed a version-specific test exclusion, enabling the affected test to run across versions. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 39fed3d commit 41b46ba

4 files changed

Lines changed: 22 additions & 71 deletions

File tree

.github/workflows/continuous-integration.yml

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,13 @@ concurrency:
99
cancel-in-progress: true
1010
jobs:
1111
build:
12-
name: "JDK ${{ matrix.java }} on ${{ matrix.os }} with Error Prone ${{ matrix.epVersion }}"
12+
name: "Build and test on ${{ matrix.os }}"
1313
strategy:
1414
matrix:
1515
include:
16-
- os: ubuntu-latest
17-
java: 11
18-
epVersion: 2.14.0
19-
- os: ubuntu-latest
20-
java: 17
21-
epVersion: 2.14.0
22-
# last version of Error Prone that supports Java 11
23-
- os: ubuntu-latest
24-
java: 11
25-
epVersion: 2.31.0
2616
- os: macos-latest
27-
java: 17
28-
epVersion: 2.41.0
2917
- os: windows-latest
30-
java: 17
31-
epVersion: 2.41.0
3218
- os: ubuntu-latest
33-
java: 17
34-
epVersion: 2.41.0
3519
fail-fast: false
3620
runs-on: ${{ matrix.os }}
3721
steps:
@@ -42,25 +26,19 @@ jobs:
4226
with:
4327
java-version: |
4428
21
45-
17
46-
${{ matrix.java }}
4729
distribution: 'temurin'
4830
- name: Setup Gradle
4931
uses: gradle/actions/setup-gradle@v4
50-
- name: Build and test using Java ${{ matrix.java }} and Error Prone ${{ matrix.epVersion }}
51-
env:
52-
ORG_GRADLE_PROJECT_epApiVersion: ${{ matrix.epVersion }}
32+
- name: Build and test
5333
run: ./gradlew build
5434
- name: Run shellcheck
5535
run: ./gradlew shellcheck
5636
if: runner.os == 'Linux'
5737
- name: Aggregate jacoco coverage
5838
id: jacoco_report
59-
env:
60-
ORG_GRADLE_PROJECT_epApiVersion: ${{ matrix.epVersion }}
6139
run: ./gradlew codeCoverageReport
6240
continue-on-error: true
63-
if: runner.os == 'Linux' && matrix.java == '17' && matrix.epVersion == '2.41.0' && github.repository == 'uber/NullAway'
41+
if: runner.os == 'Linux' && github.repository == 'uber/NullAway'
6442
- name: Upload coverage reports to Codecov
6543
uses: codecov/codecov-action@v4
6644
with:
@@ -69,11 +47,9 @@ jobs:
6947
if: steps.jacoco_report.outcome == 'success'
7048
- name: Test publishToMavenLocal flow
7149
env:
72-
ORG_GRADLE_PROJECT_epApiVersion: ${{ matrix.epVersion }}
7350
ORG_GRADLE_PROJECT_VERSION_NAME: '0.0.0.1-LOCAL'
7451
ORG_GRADLE_PROJECT_RELEASE_SIGNING_ENABLED: 'false'
7552
run: ./gradlew publishToMavenLocal
76-
if: matrix.java == '17'
7753
- name: Check that Git tree is clean after build and test
7854
run: ./.buildscript/check_git_clean.sh
7955
compile-other-projects:

buildSrc/src/main/groovy/nullaway.java-test-conventions.gradle

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -44,28 +44,28 @@ configurations.create('transitiveSourcesElements') {
4444
}
4545
}
4646

47+
// to expose necessary JDK types on JDK 16+; see https://errorprone.info/docs/installation#java-9-and-newer
48+
def commonJavacOpens = [
49+
"--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
50+
"--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
51+
"--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
52+
"--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED",
53+
"--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
54+
"--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED",
55+
"--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
56+
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
57+
"--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
58+
"--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED",
59+
"--add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED",
60+
]
4761

4862
test {
4963
maxHeapSize = "1024m"
50-
// to expose necessary JDK types on JDK 16+; see https://errorprone.info/docs/installation#java-9-and-newer
51-
jvmArgs += [
52-
"--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
53-
"--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
54-
"--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
55-
"--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED",
56-
"--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
57-
"--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED",
58-
"--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
59-
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
60-
"--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
61-
"--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED",
62-
// Accessed by Lombok tests
63-
"--add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED",
64-
]
64+
jvmArgs += commonJavacOpens
6565
}
6666

6767
// Tasks for testing on other JDK versions; see https://jakewharton.com/build-on-latest-java-test-through-lowest-java/
68-
[21, 24].each { majorVersion ->
68+
[17, 24].each { majorVersion ->
6969
def jdkTest = tasks.register("testJdk$majorVersion", Test) {
7070
onlyIf {
7171
// Only run when using the latest Error Prone version
@@ -83,21 +83,7 @@ test {
8383
classpath = testTask.classpath
8484
testClassesDirs = testTask.testClassesDirs
8585
maxHeapSize = "1024m"
86-
// to expose necessary JDK types on JDK 16+; see https://errorprone.info/docs/installation#java-9-and-newer
87-
jvmArgs += [
88-
"--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
89-
"--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
90-
"--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
91-
"--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED",
92-
"--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
93-
"--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED",
94-
"--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
95-
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
96-
"--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
97-
"--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED",
98-
// Accessed by Lombok tests
99-
"--add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED",
100-
]
86+
jvmArgs += commonJavacOpens
10187
}
10288

10389
tasks.named('check').configure {

jdk-recent-unit-tests/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ plugins {
1818
id 'nullaway.java-test-conventions'
1919
}
2020

21-
// Use JDK 21 for this module, via a toolchain
21+
// Use JDK 24 for this module, via a toolchain
2222
// We must null out sourceCompatibility and targetCompatibility to use toolchains.
2323
java.sourceCompatibility = null
2424
java.targetCompatibility = null
@@ -54,7 +54,7 @@ tasks.withType(Test).configureEach { test ->
5454
}
5555

5656
// Disable tasks for specific JDK versions; we only run on the recent JDK version specified above
57-
tasks.getByName('testJdk21').configure {
57+
tasks.getByName('testJdk17').configure {
5858
onlyIf { false }
5959
}
6060
tasks.getByName('testJdk24').configure {

nullaway/build.gradle

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,3 @@ tasks.register('buildWithNullAway', JavaCompile) {
185185
project.tasks.named('check').configure {
186186
dependsOn 'buildWithNullAway'
187187
}
188-
189-
tasks.withType(Test).configureEach { test ->
190-
// hack: for some reasons the ErrorProneCLIFlagsConfigTest does not pass on EP 2.31.0,
191-
// though it passes on both older and newer Error Prone versions (???). Not worth tracking
192-
// down
193-
if (deps.versions.errorProneApi == "2.31.0") {
194-
test.filter {
195-
excludeTestsMatching "com.uber.nullaway.ErrorProneCLIFlagsConfigTest"
196-
}
197-
}
198-
}

0 commit comments

Comments
 (0)