blob: 4f14afd79ad019423f126cc4455803a0d3f96f51 [file]
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: 96d43f370671742b4d32bd630ba03f7772306875
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: a85686ec92020c5a2f90373227758a38ace5b679
build: ./gradlew --init-script use-snapshot.gradle.kts compileAllJava
- project: junit-framework
url: https://github.com/junit-team/junit-framework.git
branch: main
sha: 68e59c02a55f456a39df0c9a672b479e48a43474
build: ./gradlew --init-script use-snapshot.gradle.kts compileAllJava
- project: spring-boot
url: https://github.com/spring-projects/spring-boot.git
branch: main
sha: ebb5e11c70c50469c45f8aada56dd6d477c6b77f
build: ./gradlew --init-script use-snapshot.gradle.kts compileAllJava
- project: reactor-core
url: https://github.com/reactor/reactor-core.git
branch: main
sha: c7558a44573277db75ea275c190cb4b310c8c5a0
build: ./gradlew --init-script use-snapshot.gradle.kts compileAllJava
- project: spring-batch
url: https://github.com/spring-projects/spring-batch.git
branch: main
sha: 8352aa1b511679acf5511706534a1937b9022cae
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: 713faf069e246f3430ae23ead1f90430c672cc15
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"
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