Repository navigation
275 lines (275 loc) · 12.1 KB
/
Copy pathcontinuous-integration.yml
File metadata and controls
275 lines (275 loc) · 12.1 KB
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
name: Continuous integration
on:
merge_group:
pull_request:
push:
branches:
- master
# Cancel in-progress runs for pull requests, but not for master branch pushes or merge queue
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build:
name: "Build and test on ${{ matrix.os }}"
strategy:
matrix:
include:
- os: macos-latest
- os: windows-latest
- os: ubuntu-latest
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Check out NullAway sources
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: 'Set up JDK 28 EA from jdk.java.net'
uses: oracle-actions/setup-java@fff43251af9936a0e6a4d5d0946e14f1680e9b6b # v1.5.0
with:
website: jdk.java.net
release: 28
- name: 'Set up JDKs'
uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0
with:
java-version: |
17
21
25
distribution: 'temurin'
check-latest: 'true'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@8da46b539cd8fe6ab27ca75128919a18d757604c # v6.4.1
- name: List toolchains
run: ./gradlew javaToolchains
- name: Check formatting
run: ./gradlew spotlessCheck
- name: Check compilation
run: ./gradlew assemble compileTestJava
- name: Build and test
# The preceding Spotless and compilation tasks are up to date, while build still guarantees
# that every lifecycle and custom verification task runs.
run: ./gradlew build
env:
# The Linux build produces the execution data consumed by the Codecov aggregation step.
# Keep ordinary macOS and Windows test runs free of JaCoCo instrumentation overhead.
ORG_GRADLE_PROJECT_enableJacoco: ${{ matrix.os == 'ubuntu-latest' && 'true' || 'false' }}
ORG_GRADLE_PROJECT_cribro.diffCoverageEnabled: ${{ matrix.os == 'ubuntu-latest' && 'true' || 'false' }}
- name: Run shellcheck
run: ./gradlew shellcheck
if: runner.os == 'Linux'
- name: Aggregate jacoco coverage
id: jacoco_report
run: ./gradlew codeCoverageReport
env:
# Use the same test-task configuration as the preceding Linux build so its JaCoCo
# execution data remains up-to-date and is included in the aggregate XML report.
ORG_GRADLE_PROJECT_enableJacoco: 'true'
continue-on-error: true
if: runner.os == 'Linux' && github.repository == 'uber/NullAway'
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
files: ./code-coverage-report/build/reports/jacoco/codeCoverageReport/codeCoverageReport.xml
# Each module also writes a jacocoTestReport.xml for diff coverage; upload the aggregate only.
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}
if: steps.jacoco_report.outcome == 'success'
- name: Cleanup Codecov temporary files
run: |
# See https://github.com/codecov/codecov-action/issues/1851
rm -rf codecov codecov.SHA256SUM codecov.SHA256SUM.sig
if: steps.jacoco_report.outcome == 'success'
- name: Test publishToMavenLocal flow
env:
ORG_GRADLE_PROJECT_VERSION_NAME: '0.0.0.1-LOCAL'
ORG_GRADLE_PROJECT_RELEASE_SIGNING_ENABLED: 'false'
run: ./gradlew publishToMavenLocal
- name: Check that Git tree is clean after build and test
run: ./.buildscript/check_git_clean.sh
suppression-remover-regression-tests:
name: "Suppression remover regression tests"
runs-on: ubuntu-latest
steps:
- name: Check out NullAway sources
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: '3.15'
cache: 'pip'
cache-dependency-path: scripts/nullaway-suppression-remover/pyproject.toml
- name: Install suppression remover test dependencies
working-directory: scripts/nullaway-suppression-remover
run: python -m pip install --editable '.[test]'
- name: Run suppression remover regression tests
working-directory: scripts/nullaway-suppression-remover
run: python -m pytest
test-with-error-prone-snapshot:
name: "Test with Error Prone snapshot"
runs-on: ubuntu-latest
steps:
- name: Checkout this repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: 'Set up Default JDK'
uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0
with:
java-version: 25
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@8da46b539cd8fe6ab27ca75128919a18d757604c # v6.4.1
- name: Test with Error Prone snapshot
run: ./gradlew testErrorProneLatestSnapshot
compile-other-projects:
name: "Build ${{ matrix.project }} with snapshot"
strategy:
fail-fast: false
# Each project builds at a pinned commit, so a change upstream cannot fail an unrelated
# NullAway PR. Renovate moves sha to the tip of branch; .github/third-party/README.md explains
# how to patch a project whose fix upstream has not merged yet.
# build runs in the project checkout, with use-snapshot.gradle.kts copied there and
# NULLAWAY_VERSION set to the snapshot that publishToMavenLocal installed. A Gradle build takes
# the snapshot through the init script; a Maven build passes NULLAWAY_VERSION to the property
# its pom.xml reads the NullAway version from. Renovate's regex expects project, url, branch,
# and sha in that order, so build goes after sha.
matrix:
include:
- project: caffeine
url: https://github.com/ben-manes/caffeine.git
branch: master
sha: cc8505dbbacda9256c048c4c186e896f8fcb01f8
build: JAVA_VERSION=26 ./gradlew --init-script use-snapshot.gradle.kts compileAllJava
- project: spring-framework
url: https://github.com/spring-projects/spring-framework.git
branch: main
sha: fe4f1859749febef72762b4b86e1ffff5d2d989c
build: ./gradlew --init-script use-snapshot.gradle.kts compileAllJava
- project: junit-framework
url: https://github.com/junit-team/junit-framework.git
branch: main
sha: 5f34d9b462689e61f5fa4a654e250da175dccb59
build: ./gradlew --init-script use-snapshot.gradle.kts compileAllJava
- project: spring-boot
url: https://github.com/spring-projects/spring-boot.git
branch: main
sha: bdad4a35b852f68eaf402ddc471beb19c448245f
build: ./gradlew --init-script use-snapshot.gradle.kts compileAllJava
- project: reactor-core
url: https://github.com/reactor/reactor-core.git
branch: main
sha: 21c0a1c9dd79b742f09e57294271f13416d790a6
build: ./gradlew --init-script use-snapshot.gradle.kts compileAllJava
- project: spring-batch
url: https://github.com/spring-projects/spring-batch.git
branch: main
sha: 86b656768ab09cf5d2b1b07f650a987652cd3e1b
build: ./mvnw -B -ntp -nsu -Dnullaway.version="$NULLAWAY_VERSION" -Dspring-javaformat.skip=true test-compile
- project: vavr
url: https://github.com/vavr-io/vavr.git
branch: main
sha: 56325ea8379d86ec18303d1edae41f67c5ced860
build: JAVA_HOME="$JAVA_HOME_21_X64" ./mvnw -B -ntp -nsu -Pnullaway -Dnullaway.version="$NULLAWAY_VERSION" -Dspotless.skip=true compile
- project: calcite
url: https://github.com/apache/calcite.git
branch: main
sha: 4973f548c8056488a36338a0f65a67c2ea63a226
build: JAVA_HOME="$JAVA_HOME_21_X64" ./gradlew --init-script use-snapshot.gradle.kts -PenableErrorprone classes jmhClasses
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Checkout this repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: 'Set up JDKs'
uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0
with:
java-version: | # JDK 26 needed for Caffeine
21
26
25
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@8da46b539cd8fe6ab27ca75128919a18d757604c # v6.4.1
- name: Publish to Maven Local
env:
ORG_GRADLE_PROJECT_RELEASE_SIGNING_ENABLED: 'false'
run: ./gradlew publishToMavenLocal
- name: Check out ${{ matrix.project }} at the pinned commit
env:
PROJECT: ${{ matrix.project }}
URL: ${{ matrix.url }}
SHA: ${{ matrix.sha }}
run: |
git init "/tmp/$PROJECT"
git -C "/tmp/$PROJECT" fetch --depth 1 "$URL" "$SHA"
git -C "/tmp/$PROJECT" checkout --detach FETCH_HEAD
- name: Apply patches to ${{ matrix.project }}
env:
PROJECT: ${{ matrix.project }}
run: .github/third-party/apply-patches.sh ".github/third-party/$PROJECT" "/tmp/$PROJECT"
- name: Run ${{ matrix.project }} build
env:
PROJECT: ${{ matrix.project }}
BUILD: ${{ matrix.build }}
run: |
cp .github/workflows/use-snapshot.gradle.kts "/tmp/$PROJECT"
NULLAWAY_VERSION="$(sed -n 's/^VERSION_NAME=//p' gradle.properties)"
export NULLAWAY_VERSION
cd "/tmp/$PROJECT"
eval "$BUILD"
# The master-required-checks ruleset in .asf.yaml can require this one check instead of each job and matrix entry, so a
# project added to the compile-other-projects matrix gates merges without a ruleset change.
# always() runs the gate when a needed job fails or is cancelled; a skipped gate would pass.
# test-with-error-prone-snapshot is left out: a break in the Error Prone snapshot would block every PR.
ci-gate:
name: CI gate
needs:
- build
- suppression-remover-regression-tests
- compile-other-projects
if: always()
permissions: {}
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Fail unless every needed job succeeded
env:
RESULTS: ${{ toJSON(needs) }}
run: |
echo "$RESULTS" | jq -r 'to_entries[] | "\(.key): \(.value.result)"'
echo "$RESULTS" | jq -e 'all(.[]; .result == "success")' > /dev/null
publish-snapshot:
name: Publish snapshot to Maven Central
needs:
- build
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'uber/NullAway'
runs-on: ubuntu-latest
steps:
- name: Check out NullAway sources
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up JDK
uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0
with:
java-version: 25
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@8da46b539cd8fe6ab27ca75128919a18d757604c # v6.4.1
- name: Verify snapshot version
run: grep -Eq '^VERSION_NAME=.*-SNAPSHOT$' gradle.properties
- name: Publish snapshot
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USER_TOKEN_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_USER_TOKEN_PASSWORD }}
ORG_GRADLE_PROJECT_RELEASE_SIGNING_ENABLED: 'false'
run: ./gradlew publishToMavenCentral