Skip to content

Apache Lucene open-source search software

ci: remove "max-workers" and test with our gradle defaults (#15307)

Robert Muirc67f8d38641e
diff --git a/.github/workflows/run-checks-all.yml b/.github/workflows/run-checks-all.yml
index 53e4a51f668..fabb8b71f79 100644
--- a/.github/workflows/run-checks-all.yml
+++ b/.github/workflows/run-checks-all.yml
@@ -58,7 +58,7 @@ jobs:
echo "lucene.tool.ast-grep=ast-grep" >> build-options.local.properties
- name: Run gradle check (without tests)
- run: ./gradlew check -x test "-Ptask.times=true" --max-workers 2
+ run: ./gradlew check -x test "-Ptask.times=true"
# This runs all tests without any other validation checks.
@@ -87,8 +87,20 @@ jobs:
- name: Configure tools
uses: ./.github/actions/prepare-for-build
+ - name: Speedup MacOS runner
+ if: ${{ runner.os == 'macOS' }}
+ run: |
+ mkdir /tmp/tmpfs
+ sudo mount_tmpfs -o noowners -s 1g /tmp/tmpfs
+ sudo sysctl debug.lowpri_throttle_enabled=0
+ echo "tests.workDir=/tmp/tmpfs/lucene" >> build-options.local.properties
+
- name: Run gradle tests
- run: ./gradlew test "-Ptask.times=true" "-Pvalidation.errorprone=false" --max-workers 2
+ run: ./gradlew test "-Ptask.times=true" "-Pvalidation.errorprone=false"
+ env:
+ # Set to the defaults to override the "CI"-based logic that would enable C2
+ # we can't afford C2 on github runners.
+ TEST_JVM_ARGS: "-XX:TieredStopAtLevel=1 -XX:+UseParallelGC -XX:ActiveProcessorCount=1"
- name: List automatically-initialized gradle.properties
run: cat gradle.properties
diff --git a/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/GradlePropertiesGenerator.java b/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/GradlePropertiesGenerator.java
index 5436afe70f8..b8047137188 100644
--- a/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/GradlePropertiesGenerator.java
+++ b/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/GradlePropertiesGenerator.java
@@ -54,10 +54,10 @@ public class GradlePropertiesGenerator {
}
// Approximate a common-sense default for running gradle/tests with parallel
- // workers: half the count of available cpus but not more than 12.
+ // workers: the count of available cpus but not more than 12.
var cpus = Runtime.getRuntime().availableProcessors();
- var maxWorkers = (int) Math.max(1d, Math.min(cpus * 0.5d, 12));
- var testsJvms = (int) Math.max(1d, Math.min(cpus * 0.5d, 12));
+ var maxWorkers = Math.min(cpus, 12);
+ var testsJvms = Math.min(cpus, 12);
var replacements = Map.of("@MAX_WORKERS@", maxWorkers, "@TEST_JVMS@", testsJvms);
diff --git a/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/plugins/java/TestsAndRandomizationPlugin.java b/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/plugins/java/TestsAndRandomizationPlugin.java
index a48ae6c6143..86d240067f4 100644
--- a/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/plugins/java/TestsAndRandomizationPlugin.java
+++ b/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/plugins/java/TestsAndRandomizationPlugin.java
@@ -186,9 +186,7 @@ public class TestsAndRandomizationPlugin extends LuceneGradlePlugin {
.getProviders()
.provider(
() -> {
- return ((int)
- Math.max(
- 1, Math.min(Runtime.getRuntime().availableProcessors() / 2.0, 4.0)));
+ return Math.min(12, Runtime.getRuntime().availableProcessors());
}));
// GITHUB#13986: Allow easier configuration of the Panama Vectorization provider with newer Java
diff --git a/gradle/template.gradle.properties b/gradle/template.gradle.properties
index 59ae7422b0a..1e808746e1b 100644
--- a/gradle/template.gradle.properties
+++ b/gradle/template.gradle.properties
@@ -16,7 +16,7 @@
###############
#
# Gradle build can run tasks in parallel but by default it consumes all CPU cores which
-# is too optimistic a default for Lucene tests. You can disable the parallelism
+# may be too optimistic a default for Lucene tests. You can disable the parallelism
# entirely or assign it a 'low' priority with these properties:
#
# org.gradle.parallel=[true, false]
@@ -24,7 +24,7 @@
#
# The default level of parallelism is computed based on the number of cores on
# your machine (on the first run of gradle build). By default these are fairly conservative
-# settings (half the number of cores for workers, for example):
+# settings (the number of cores for workers up to a limit of 12, for example):
#
# org.gradle.workers.max=[X]
# tests.jvms=[N <= X]