You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2022/05/14 18:49:55 UTC

[lucene] branch main updated: Detect CI builds and enable errorprone by default for those CI builds (#890)

This is an automated email from the ASF dual-hosted git repository.

uschindler pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/main by this push:
     new 7a8071c9d4b Detect CI builds and enable errorprone by default for those CI builds (#890)
7a8071c9d4b is described below

commit 7a8071c9d4bfec7363d59d4cb4a365911fec8c3f
Author: Uwe Schindler <us...@apache.org>
AuthorDate: Sat May 14 20:49:50 2022 +0200

    Detect CI builds and enable errorprone by default for those CI builds (#890)
---
 gradle/globals.gradle                | 5 +++++
 gradle/validation/error-prone.gradle | 4 ++--
 lucene/CHANGES.txt                   | 4 +++-
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/gradle/globals.gradle b/gradle/globals.gradle
index 4650a11c971..60e5101437e 100644
--- a/gradle/globals.gradle
+++ b/gradle/globals.gradle
@@ -147,5 +147,10 @@ allprojects {
       }
       return taskList
     }
+
+    // detect if we run in CI environment by looking at existence of env vars:
+    // "CI": Github (https://docs.github.com/en/actions/learn-github-actions/environment-variables)
+    // anything starting with "JENKINS_" or "HUDSON_": Jenkins/Hudson (https://jenkins.thetaphi.de/env-vars.html/)
+    isCIBuild = System.getenv().keySet().find { it ==~ /(?i)((JENKINS|HUDSON)(_\w+)?|CI)/ } != null
   }
 }
diff --git a/gradle/validation/error-prone.gradle b/gradle/validation/error-prone.gradle
index 5ca48a7211c..67c0ea20ca0 100644
--- a/gradle/validation/error-prone.gradle
+++ b/gradle/validation/error-prone.gradle
@@ -21,8 +21,8 @@ if (rootProject.usesAltJvm && rootProject.runtimeJavaVersion > JavaVersion.VERSI
   skipReason = "won't work with JDK ${rootProject.runtimeJavaVersion} if used as alternative java toolchain"
 }
 
-if (!Boolean.parseBoolean(propertyOrDefault("tests.nightly", "false"))) {
-  skipReason = "skipped on non-nightly runs, pass -Ptests.nightly=true to run"
+if (!propertyOrDefault("validation.errorprone", isCIBuild).asBoolean()) {
+  skipReason = "skipped on builds not running inside CI environments, pass -Pvalidation.errorprone=true to enable"
 }
 
 if (skipReason) {
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index e5bba1efd56..8ccf0ee3dee 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -211,7 +211,9 @@ Build
 
 * Upgrade forbiddenapis to version 3.3.  (Uwe Schindler)
 
-* LUCENE-10532: Remove LuceneTestCase.Slow annotation. ALl tests can be fast. (Robert Muir)
+* Detect CI builds on Github or Jenkins and enable errorprone.  (Uwe Schindler, Dawid Weiss)
+
+* LUCENE-10532: Remove LuceneTestCase.Slow annotation. All tests can be fast. (Robert Muir)
 
 Other
 ---------------------