diff --git a/.github/workflows/run-checks-all.yml b/.github/workflows/run-checks-all.yml index 53e4a51f668e..fabb8b71f799 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 5436afe70f80..b80471371887 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 void run(Path source, Path destination) throws IOException { } // 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 a48ae6c61435..86d240067f4f 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 void apply(Project project) { .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 59ae7422b0a0..1e808746e1b5 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]