Skip to content

Commit

Permalink
Test with JDK 16
Browse files Browse the repository at this point in the history
JDK 16 is then tested with both Gradle 6 and Gradle 7
  • Loading branch information
tbroyer committed Mar 22, 2021
1 parent 41fc479 commit a17ab4e
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 5 deletions.
39 changes: 38 additions & 1 deletion .github/workflows/gradle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 11, 15 ]
java: [ 11, 16 ]
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -117,3 +117,40 @@ jobs:
name: jdk-${{ matrix.java }}-tests
path: build/reports/tests/test/

test-jdk16-gradle7:
needs: linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup JDK 16
id: setup-test-java
uses: actions/setup-java@v1
with:
java-version: 16

- name: Setup JAVA_HOME_16_X64 environment variable
run: echo "JAVA_HOME_16_X64=${{ steps.setup-test-java.outputs.path }}" | tee -a $GITHUB_ENV

- name: Setup environment
run: |
echo "JAVA_HOME=${JAVA_HOME_8_X64}" | tee -a $GITHUB_ENV
echo "org.gradle.java.installations.auto-download=false" | tee -a gradle.properties
echo "org.gradle.java.installations.fromEnv=JAVA_HOME_16_X64" | tee -a gradle.properties
- name: Build with Gradle
id: gradle-build
uses: eskatos/gradle-command-action@v1
with:
arguments: --scan test -Ptest.java-toolchain=16 -Ptest.gradle-version=7.0-milestone-3
wrapper-cache-enabled: true
dependencies-cache-enabled: true
dependencies-cache-key: '**/*gradle.lockfile'
dependencies-cache-exact: true

- name: Store reports
if: always() && (steps.gradle-build.outcome == 'success' || steps.gradle-build.outcome == 'failure')
uses: actions/upload-artifact@v2
with:
name: jdk16-gradle7-tests
path: build/reports/tests/test/
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package net.ltgt.gradle.nullaway

import com.google.common.truth.TruthJUnit.assume
import net.ltgt.gradle.errorprone.ErrorPronePlugin
import org.gradle.api.JavaVersion
import org.gradle.util.GradleVersion
import org.junit.jupiter.api.BeforeEach
import java.io.File
Expand Down Expand Up @@ -37,6 +38,7 @@ class AndroidIntegrationTest : AbstractPluginIntegrationTest(
@BeforeEach
fun setupAndroid() {
assume().that(GradleVersion.version(testGradleVersion)).isAtLeast(GradleVersion.version("6.5"))
assume().withMessage("isJava16Compatible").that(JavaVersion.current()).isLessThan(JavaVersion.VERSION_16)

File(testProjectDir.resolve("src/main").apply { mkdirs() }, "AndroidManifest.xml").writeText(
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package net.ltgt.gradle.nullaway

import com.google.common.truth.Truth.assertThat
import com.google.common.truth.TruthJUnit.assume
import net.ltgt.gradle.errorprone.ErrorPronePlugin
import org.gradle.api.JavaVersion
import org.gradle.testkit.runner.TaskOutcome
import org.gradle.util.GradleVersion
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.io.TempDir
Expand All @@ -16,6 +19,11 @@ class GroovyDslIntegrationTest {

@BeforeEach
fun setupProject() {
assume().that(
JavaVersion.current() < JavaVersion.VERSION_16 ||
GradleVersion.version(testGradleVersion).baseVersion >= GradleVersion.version("7.0")
).isTrue()

settingsFile = testProjectDir.resolve("settings.gradle").apply {
createNewFile()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package net.ltgt.gradle.nullaway

import com.google.common.truth.Truth
import com.google.common.truth.TruthJUnit
import com.google.common.truth.Truth.assertThat
import com.google.common.truth.TruthJUnit.assume
import net.ltgt.gradle.errorprone.ErrorPronePlugin
import org.gradle.api.JavaVersion
import org.gradle.util.GradleVersion
import org.junit.jupiter.api.Test

Expand All @@ -19,7 +20,11 @@ class NullAwayPluginIntegrationTest : AbstractPluginIntegrationTest(

@Test
fun `is configuration-cache friendly`() {
TruthJUnit.assume().that(GradleVersion.version(testGradleVersion)).isAtLeast(GradleVersion.version("6.6"))
assume().that(GradleVersion.version(testGradleVersion)).isAtLeast(GradleVersion.version("6.6"))
assume().that(
JavaVersion.current() < JavaVersion.VERSION_16 ||
GradleVersion.version(testGradleVersion).baseVersion >= GradleVersion.version("7.0")
).isTrue()

// given
testProjectDir.writeSuccessSource()
Expand All @@ -31,6 +36,6 @@ class NullAwayPluginIntegrationTest : AbstractPluginIntegrationTest(
val result = testProjectDir.buildWithArgs("--configuration-cache", "compileJava")

// then
Truth.assertThat(result.output).contains("Reusing configuration cache.")
assertThat(result.output).contains("Reusing configuration cache.")
}
}

0 comments on commit a17ab4e

Please sign in to comment.