Skip to content

Commit

Permalink
run the test suite against the latest jdk
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-manes committed Oct 26, 2023
1 parent 2995ea8 commit 364b646
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 45 deletions.
82 changes: 54 additions & 28 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: build
on:
pull_request: {}
push:
branches: [master, v2.dev, v3.dev]
permissions: read-all
on: [ push, pull_request ]

env:
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
Expand Down Expand Up @@ -60,13 +63,13 @@ jobs:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Prepare GraalVM
if: matrix.java == 'GraalVM'
if: env.JAVA_VERSION == 'GraalVM'
shell: bash
run: echo "GRADLE_ARGS=--no-build-cache" >> $GITHUB_ENV
- name: Compile
uses: ./.github/actions/run-gradle
with:
java: ${{ matrix.java }}
java: ${{ env.JAVA_VERSION }}
early-access: ${{ env.EA_JDK }}
token: ${{ secrets.GITHUB_TOKEN }}
arguments: check -x test ${{ env.GRADLE_ARGS }}
Expand All @@ -91,55 +94,78 @@ jobs:
- caffeine:weakKeysAndWeakValuesStatsSyncCaffeineSlowTest
- caffeine:weakKeysAndSoftValuesStatsSyncCaffeineSlowTest
- caffeine:strongKeysAndStrongValuesStatsSyncCaffeineTest
- caffeine:weakKeysAndStrongValuesStatsSyncGuavaSlowTest
- caffeine:weakKeysAndStrongValuesStatsAsyncCaffeineTest
- caffeine:strongKeysAndWeakValuesStatsSyncGuavaSlowTest
- caffeine:strongKeysAndSoftValuesStatsSyncGuavaSlowTest
- caffeine:weakKeysAndStrongValuesStatsSyncCaffeineTest
- caffeine:weakKeysAndStrongValuesAsyncCaffeineSlowTest
- caffeine:strongKeysAndWeakValuesStatsSyncCaffeineTest
- caffeine:strongKeysAndSoftValuesStatsSyncCaffeineTest
- caffeine:weakKeysAndWeakValuesStatsSyncGuavaSlowTest
- caffeine:weakKeysAndStrongValuesSyncCaffeineSlowTest
- caffeine:weakKeysAndSoftValuesStatsSyncGuavaSlowTest
- caffeine:strongKeysAndWeakValuesSyncCaffeineSlowTest
- caffeine:strongKeysAndStrongValuesStatsSyncGuavaTest
- caffeine:strongKeysAndSoftValuesSyncCaffeineSlowTest
- caffeine:weakKeysAndWeakValuesStatsSyncCaffeineTest
- caffeine:weakKeysAndSoftValuesStatsSyncCaffeineTest
- caffeine:strongKeysAndStrongValuesAsyncCaffeineTest
- caffeine:weakKeysAndWeakValuesSyncCaffeineSlowTest
- caffeine:weakKeysAndStrongValuesStatsSyncGuavaTest
- caffeine:weakKeysAndSoftValuesSyncCaffeineSlowTest
- caffeine:strongKeysAndWeakValuesStatsSyncGuavaTest
- caffeine:strongKeysAndStrongValuesSyncCaffeineTest
- caffeine:strongKeysAndSoftValuesStatsSyncGuavaTest
- caffeine:weakKeysAndStrongValuesSyncGuavaSlowTest
- caffeine:weakKeysAndStrongValuesAsyncCaffeineTest
- caffeine:strongKeysAndWeakValuesSyncGuavaSlowTest
- caffeine:strongKeysAndSoftValuesSyncGuavaSlowTest
- caffeine:weakKeysAndWeakValuesStatsSyncGuavaTest
- caffeine:weakKeysAndStrongValuesSyncCaffeineTest
- caffeine:weakKeysAndSoftValuesStatsSyncGuavaTest
- caffeine:strongKeysAndWeakValuesSyncCaffeineTest
- caffeine:strongKeysAndSoftValuesSyncCaffeineTest
- caffeine:weakKeysAndWeakValuesSyncGuavaSlowTest
- caffeine:weakKeysAndSoftValuesSyncGuavaSlowTest
- caffeine:strongKeysAndStrongValuesSyncGuavaTest
- caffeine:weakKeysAndWeakValuesSyncCaffeineTest
- caffeine:weakKeysAndSoftValuesSyncCaffeineTest
- caffeine:weakKeysAndStrongValuesSyncGuavaTest
- caffeine:strongKeysAndWeakValuesSyncGuavaTest
- caffeine:strongKeysAndSoftValuesSyncGuavaTest
- caffeine:weakKeysAndWeakValuesSyncGuavaTest
- caffeine:weakKeysAndSoftValuesSyncGuavaTest
- caffeine:lincheckTest
- caffeine:isolatedTest
- caffeine:junitTest
- simulator:check
- jcache:check
- guava:check
java: [ 11 ]
java: [ 11, 21 ]
include:
- suite: caffeine:weakKeysAndStrongValuesStatsSyncGuavaSlowTest
java: 11
- suite: caffeine:strongKeysAndWeakValuesStatsSyncGuavaSlowTest
java: 11
- suite: caffeine:strongKeysAndSoftValuesStatsSyncGuavaSlowTest
java: 11
- suite: caffeine:weakKeysAndWeakValuesStatsSyncGuavaSlowTest
java: 11
- suite: caffeine:weakKeysAndSoftValuesStatsSyncGuavaSlowTest
java: 11
- suite: caffeine:strongKeysAndStrongValuesStatsSyncGuavaTest
java: 11
- suite: caffeine:weakKeysAndStrongValuesStatsSyncGuavaTest
java: 11
- suite: caffeine:strongKeysAndWeakValuesStatsSyncGuavaTest
java: 11
- suite: caffeine:strongKeysAndSoftValuesStatsSyncGuavaTest
java: 11
- suite: caffeine:weakKeysAndStrongValuesSyncGuavaSlowTest
java: 11
- suite: caffeine:strongKeysAndWeakValuesSyncGuavaSlowTest
java: 11
- suite: caffeine:strongKeysAndSoftValuesSyncGuavaSlowTest
java: 11
- suite: caffeine:weakKeysAndWeakValuesStatsSyncGuavaTest
java: 11
- suite: caffeine:weakKeysAndSoftValuesStatsSyncGuavaTest
java: 11
- suite: caffeine:weakKeysAndWeakValuesSyncGuavaSlowTest
java: 11
- suite: caffeine:weakKeysAndSoftValuesSyncGuavaSlowTest
java: 11
- suite: caffeine:strongKeysAndStrongValuesSyncGuavaTest
java: 11
- suite: caffeine:weakKeysAndStrongValuesSyncGuavaTest
java: 11
- suite: caffeine:strongKeysAndWeakValuesSyncGuavaTest
java: 11
- suite: caffeine:strongKeysAndSoftValuesSyncGuavaTest
java: 11
- suite: caffeine:weakKeysAndWeakValuesSyncGuavaTest
java: 11
- suite: caffeine:weakKeysAndSoftValuesSyncGuavaTest
java: 11
env:
JAVA_VERSION: ${{ matrix.java }}
steps:
Expand All @@ -151,10 +177,10 @@ jobs:
allowed-endpoints: ${{ env.ALLOWED_ENDPOINTS }}
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Run tests (${{ matrix.suite }})
- name: Run tests (${{ env.JAVA_VERSION }})
uses: ./.github/actions/run-gradle
with:
java: ${{ matrix.java }}
java: ${{ env.JAVA_VERSION }}
arguments: ${{ matrix.suite }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Format Test Artifact Name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import java.util.AbstractSet;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
Expand Down Expand Up @@ -119,7 +118,7 @@ default CompletableFuture<Map<K, V>> getAll(Iterable<? extends K> keys,

int initialCapacity = calculateHashMapCapacity(keys);
var futures = new LinkedHashMap<K, CompletableFuture<V>>(initialCapacity);
var proxies = new HashMap<K, CompletableFuture<V>>(initialCapacity);
var proxies = new LinkedHashMap<K, CompletableFuture<V>>(initialCapacity);
for (K key : keys) {
if (futures.containsKey(key)) {
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -880,9 +880,10 @@ public void getAllBifunction_early_success(AsyncCache<Int, Int> cache, CacheCont
var bulk = new CompletableFuture<Map<Int, Int>>();
var result = cache.getAll(context.absentKeys(), (keysToLoad, executor) -> bulk);
var future = cache.asMap().get(key);

future.complete(value);
bulk.complete(context.absent()); // obtrudes the future's value

bulk.complete(context.absent());
assertThat(future).succeedsWith(context.absent().get(key));
assertThat(result.join()).containsExactlyEntriesIn(context.absent());
assertThat(cache.synchronous().asMap()).containsAtLeastEntriesIn(context.absent());
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ checkstyle = "10.12.4"
coherence = "22.06.2"
commons-collections4 = "4.4"
commons-compress = "1.24.0"
commons-io = "2.14.0"
commons-io = "2.15.0"
commons-lang3 = "3.13.0"
commons-math3 = "3.6.1"
commons-text = "1.10.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ dependencies {
annotationProcessor(platform(libs.kotlin.bom))
}

java.toolchain.languageVersion = JavaLanguageVersion.of(
System.getenv("JAVA_VERSION")?.toIntOrNull() ?: 11)
val javaVersion = JavaLanguageVersion.of(System.getenv("JAVA_VERSION")?.toIntOrNull() ?: 11)
java.toolchain.languageVersion = javaVersion

tasks.withType<JavaCompile>().configureEach {
sourceCompatibility = java.toolchain.languageVersion.get().toString()
targetCompatibility = java.toolchain.languageVersion.get().toString()
options.release = java.toolchain.languageVersion.get().asInt()
sourceCompatibility = javaVersion.toString()
targetCompatibility = javaVersion.toString()
options.release = javaVersion.asInt()

javaCompiler = javaToolchains.compilerFor {
languageVersion = java.toolchain.languageVersion
Expand All @@ -33,6 +33,9 @@ tasks.withType<JavaCompile>().configureEach {
options.compilerArgs.add("-Xlint:all,-processing,-exports,-auxiliaryclass,"
+ "-requires-automatic,-requires-transitive-automatic")
options.compilerArgs.addAll(listOf("-Xmaxerrs", "500", "-Xmaxwarns", "500"))
if (javaVersion.canCompileOrRun(21)) {
options.compilerArgs.add("-proc:full")
}
options.encoding = "UTF-8"
}

Expand Down Expand Up @@ -64,10 +67,10 @@ tasks.jar {
properties.empty()
bnd(mapOf(
"Bundle-License" to "https://www.apache.org/licenses/LICENSE-2.0",
"Build-Jdk-Spec" to java.toolchain.languageVersion.get(),
"Implementation-Title" to project.description,
"Bundle-Description" to project.description,
"Implementation-Version" to version,
"Build-Jdk-Spec" to javaVersion,
"-noextraheaders" to true,
"-reproducible" to true,
"-snapshot" to "SNAPSHOT"))
Expand All @@ -80,12 +83,12 @@ tasks.withType<Javadoc>().configureEach {
"https://checkerframework.org/api/",
"https://errorprone.info/api/latest/",
"https://lightbend.github.io/config/latest/api/",
"https://guava.dev/releases/${libs.versions.guava.get()}/api/docs/",
"https://docs.oracle.com/en/java/javase/${java.toolchain.languageVersion.get()}/docs/api/")
"https://docs.oracle.com/en/java/javase/$javaVersion/docs/api/",
"https://guava.dev/releases/${libs.versions.guava.get()}/api/docs/")

if (project != project(":caffeine")) {
val caffeineJavadoc = project(":caffeine").tasks.named<Javadoc>("javadoc")

Check notice on line 90 in gradle/plugins/src/main/kotlin/lifecycle/java-library-caffeine-conventions.gradle.kts

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unnecessary type argument

Remove explicit type arguments
linksOffline("https://static.javadoc.io/${group}/caffeine/${version}/",
linksOffline("https://static.javadoc.io/$group/caffeine/$version/",
relativePath(caffeineJavadoc.get().destinationDir!!.path))
dependsOn(caffeineJavadoc)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dependencies {
}

tasks.withType<Test>().configureEach {
jvmArgs("-XX:SoftRefLRUPolicyMSPerMB=0")
jvmArgs("-XX:SoftRefLRUPolicyMSPerMB=0", "-XX:+EnableDynamicAgentLoading", "-Xshare:off")
if ("debug" in systemProperties) {
jvmArgs("-Xdebug", "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ subprojects {
dependsOn(tasks.jar)

// ensure tasks don't overwrite the default report directories used by the 'test' task
reports.html.outputLocation = file(layout.buildDirectory.file("reports/${name}"))
reports.junitXml.outputLocation = file(layout.buildDirectory.file("reports/${name}/results"))
binaryResultsDirectory = layout.buildDirectory.dir("reports/${name}/results/binary/${name}")
reports.html.outputLocation = file(layout.buildDirectory.file("reports/$name"))
reports.junitXml.outputLocation = file(layout.buildDirectory.file("reports/$name/results"))
binaryResultsDirectory = layout.buildDirectory.dir("reports/$name/results/binary/$name")
}
}

Expand Down

0 comments on commit 364b646

Please sign in to comment.