jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vladimirsitni...@apache.org
Subject [jmeter] 02/02: Configure Gradle local build cache, add build scans, and use gradle-cache-action for GitHub CI
Date Wed, 19 Aug 2020 12:48:40 GMT
This is an automated email from the ASF dual-hosted git repository.

vladimirsitnikov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git

commit ceddfe7adb288aa221089727b457ec7243d9d326
Author: Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
AuthorDate: Wed Aug 19 13:26:41 2020 +0300

    Configure Gradle local build cache, add build scans, and use gradle-cache-action for GitHub
CI
    
    This commit configures local build cache, and it delegates
    Gradle execution to burrunan/gradle-cache-action.
    
    It unlocks fine-grained remote build cache with GitHub Actions backend
    (=faster builds), and it adds error markers
    (e.g. compilation errors right in the commit diffs)
    
    See https://github.com/burrunan/gradle-cache-action#gradle-cache-action
---
 .github/workflows/main.yml | 19 ++++++++++++-------
 build.gradle.kts           |  5 +++++
 gradle.properties          |  4 ++++
 settings.gradle.kts        | 20 +++++++++++++++++++-
 4 files changed, 40 insertions(+), 8 deletions(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index be85ffc..83c7f53 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -22,10 +22,12 @@ jobs:
       uses: actions/setup-java@v1
       with:
         java-version: 14
-    - name: 'Test'
-      shell: bash
-      run: |
-        ./gradlew --no-parallel build -x distTar -x distTarSource
+    - uses: burrunan/gradle-cache-action@v1
+      name: Test
+      with:
+        job-id: jdk14
+        multi-cache-enabled: false
+        arguments: --scan --no-parallel build -x distTar -x distTarSource
 
   mac:
     name: 'macOS (JDK 14)'
@@ -38,6 +40,9 @@ jobs:
       uses: actions/setup-java@v1
       with:
         java-version: 14
-    - name: 'Test'
-      run: |
-        ./gradlew --no-parallel build -x distTar -x distTarSource -Dskip.test_TestDNSCacheManager.testWithCustomResolverAnd1Server=true
+    - uses: burrunan/gradle-cache-action@v1
+      name: Test
+      with:
+        job-id: jdk14
+        multi-cache-enabled: false
+        arguments: --scan --no-parallel build -x distTar -x distTarSource -Dskip.test_TestDNSCacheManager.testWithCustomResolverAnd1Server=true
diff --git a/build.gradle.kts b/build.gradle.kts
index 4f0c605..3f40ffd 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -506,6 +506,11 @@ allprojects {
                     exceptionFormat = TestExceptionFormat.FULL
                     showStandardStreams = true
                 }
+
+                outputs.cacheIf("test outcomes sometimes depends on third-party systems,
so we should not cache it for now") {
+                    false
+                }
+
                 // Pass the property to tests
                 fun passProperty(name: String, default: String? = null) {
                     val value = System.getProperty(name) ?: default
diff --git a/gradle.properties b/gradle.properties
index 1ce1c6c..862fcdd 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -16,6 +16,10 @@
 #
 
 org.gradle.parallel=true
+# Build cache can be disabled with --no-build-cache option
+org.gradle.caching=true
+#org.gradle.caching.debug=true
+
 # See https://github.com/gradle/gradle/pull/11358 , https://issues.apache.org/jira/browse/INFRA-14923
 # repository.apache.org does not yet support .sha256 and .sha512 checksums
 systemProp.org.gradle.internal.publish.checksums.insecure=true
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 77f8f5b..2e178c0 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -32,6 +32,10 @@ pluginManagement {
     }
 }
 
+plugins {
+    `gradle-enterprise`
+}
+
 // This is the name of a current project
 // Note: it cannot be inferred from the directory name as developer might clone JMeter to
jmeter_tmp folder
 rootProject.name = "jmeter"
@@ -92,6 +96,18 @@ if (property("localReleasePlugins").toBool(nullAs = false, blankAs = true,
defau
         includeBuild("../vlsi-release-plugins")
 }
 
+val isCiServer = System.getenv().containsKey("CI")
+
+if (isCiServer) {
+    gradleEnterprise {
+        buildScan {
+            termsOfServiceUrl = "https://gradle.com/terms-of-service"
+            termsOfServiceAgree = "yes"
+            tag("CI")
+        }
+    }
+}
+
 // Checksum plugin sources can be validated at https://github.com/vlsi/vlsi-release-plugins
 buildscript {
     dependencies {
@@ -107,6 +123,8 @@ buildscript {
 
 // Note: we need to verify the checksum for checksum-dependency-plugin itself
 val expectedSha512 = mapOf(
+    "F7040C571C2A2727F2EED4EA772F5A7C5D9CB393828B7A2331F7167E467429486F5F3E9423883FE9A6D652FFB0484EAE722CDFB46D97180209BCBEEBF9C25DE3"
+            to "gradle-enterprise-gradle-plugin-3.4.jar",
     "43BC9061DFDECA0C421EDF4A76E380413920E788EF01751C81BDC004BD28761FBD4A3F23EA9146ECEDF10C0F85B7BE9A857E9D489A95476525565152E0314B5B"
             to "bcpg-jdk15on-1.62.jar",
     "2BA6A5DEC9C8DAC2EB427A65815EB3A9ADAF4D42D476B136F37CD57E6D013BF4E9140394ABEEA81E42FBDB8FC59228C7B85C549ED294123BF898A7D048B3BD95"
@@ -137,7 +155,7 @@ val violations =
         .joinToString("\n  ") { (file, sha512) -> "SHA-512(${file.name}) = $sha512 ($file)"
}
 
 if (violations.isNotBlank()) {
-    throw GradleException("Buildscript classpath has permitted files that were not explicitly
permitted:\n  $violations")
+    throw GradleException("Buildscript classpath has files that were not explicitly permitted:\n
 $violations")
 }
 
 apply(plugin = "com.github.vlsi.checksum-dependency")


Mime
View raw message