diff --git a/.github/actions/setup-gradle/action.yml b/.github/actions/setup-gradle/action.yml index 80090f7bd49fd..216427b3bae86 100644 --- a/.github/actions/setup-gradle/action.yml +++ b/.github/actions/setup-gradle/action.yml @@ -25,6 +25,9 @@ inputs: gradle-cache-read-only: description: "Should the Gradle cache be read-only?" default: "true" + gradle-cache-write-only: + description: "Should the Gradle cache be write-only?" + default: "false" develocity-access-key: description: "Optional access key for uploading build scans to Develocity" default: "" @@ -45,6 +48,7 @@ runs: develocity-access-key: ${{ inputs.develocity-access-key }} develocity-token-expiry: 4 cache-read-only: ${{ inputs.gradle-cache-read-only }} + cache-write-only: ${{ inputs.gradle-cache-write-only }} # Cache downloaded JDKs in addition to the default directories. gradle-home-cache-includes: | caches diff --git a/.github/scripts/junit.py b/.github/scripts/junit.py index 30d1296ba5456..96617dd5fd0c1 100644 --- a/.github/scripts/junit.py +++ b/.github/scripts/junit.py @@ -55,6 +55,9 @@ class TestCase: def key(self) -> Tuple[str, str]: return self.class_name, self.test_name + def __repr__(self): + return f"{self.class_name} {self.test_name}" + @dataclasses.dataclass class TestSuite: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c7eba3a84abc2..d6da2a94fa5b4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,6 +22,10 @@ on: description: "Should the Gradle cache be read-only?" default: "true" type: string + gradle-cache-write-only: + description: "Should the Gradle cache be write-only?" + default: "false" + type: string github-actions-opt-in: description: "Should we run the opt-in steps?" default: "false" @@ -52,6 +56,7 @@ jobs: with: java-version: ${{ matrix.java }} gradle-cache-read-only: ${{ inputs.gradle-cache-read-only }} + gradle-cache-write-only: ${{ inputs.gradle-cache-write-only }} develocity-access-key: ${{ secrets.GE_ACCESS_TOKEN }} - name: Compile and validate # Gradle flags @@ -94,18 +99,22 @@ jobs: with: java-version: ${{ matrix.java }} gradle-cache-read-only: ${{ inputs.gradle-cache-read-only }} + gradle-cache-write-only: ${{ inputs.gradle-cache-write-only }} develocity-access-key: ${{ secrets.GE_ACCESS_TOKEN }} - name: Test # Gradle flags # --build-cache: Let Gradle restore the build cache # --scan: Attempt to publish build scans in PRs. This will only work on PRs from apache/kafka, not public forks. # --continue: Keep running even if a test fails + # -PcommitId Prevent the Git SHA being written into the jar files (which breaks caching) timeout-minutes: 180 # 3 hours + continue-on-error: true run: | ./gradlew --build-cache --scan --continue \ -PtestLoggingEvents=started,passed,skipped,failed \ - -PignoreFailures=true -PmaxParallelForks=2 \ + -PmaxParallelForks=2 \ -PmaxTestRetries=1 -PmaxTestRetryFailures=10 \ + -PcommitId=xxxxxxxxxxxxxxxx \ test - name: Archive JUnit reports if: always() diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e52acab6447f4..3c0a3ca454980 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,6 +34,7 @@ jobs: uses: ./.github/workflows/build.yml with: gradle-cache-read-only: ${{ github.ref != 'refs/heads/trunk' }} + gradle-cache-write-only: ${{ github.ref == 'refs/heads/trunk' }} github-actions-opt-in: ${{ github.ref == 'refs/heads/trunk' || contains(github.head_ref, 'gh-') }} secrets: inherit diff --git a/build.gradle b/build.gradle index ce655cbbf7469..b498f77f92cb0 100644 --- a/build.gradle +++ b/build.gradle @@ -252,7 +252,7 @@ if (repo != null) { rat.enabled = false } println("Starting build with version $version (commit id ${commitId == null ? "null" : commitId.take(8)}) using Gradle $gradleVersion, Java ${JavaVersion.current()} and Scala ${versions.scala}") -println("Build properties: maxParallelForks=$maxTestForks, maxScalacThreads=$maxScalacThreads, maxTestRetries=$userMaxTestRetries") +println("Build properties: ignoreFailures=$userIgnoreFailures, maxParallelForks=$maxTestForks, maxScalacThreads=$maxScalacThreads, maxTestRetries=$userMaxTestRetries") subprojects { @@ -882,6 +882,7 @@ project(':server') { inputs.property "commitId", commitId inputs.property "version", version outputs.file receiptFile + outputs.cacheIf { true } doLast { def data = [ @@ -1366,6 +1367,7 @@ project(':group-coordinator:group-coordinator-api') { inputs.property "commitId", commitId inputs.property "version", version outputs.file receiptFile + outputs.cacheIf { true } doLast { def data = [ @@ -1735,6 +1737,7 @@ project(':clients') { inputs.property "commitId", commitId inputs.property "version", version outputs.file receiptFile + outputs.cacheIf { true } doLast { def data = [ @@ -1900,6 +1903,7 @@ project(':raft') { inputs.property "commitId", commitId inputs.property "version", version outputs.file receiptFile + outputs.cacheIf { true } doLast { def data = [ @@ -1993,6 +1997,7 @@ project(':server-common') { inputs.property "commitId", commitId inputs.property "version", version outputs.file receiptFile + outputs.cacheIf { true } doLast { def data = [ @@ -2051,6 +2056,7 @@ project(':storage:storage-api') { inputs.property "commitId", commitId inputs.property "version", version outputs.file receiptFile + outputs.cacheIf { true } doLast { def data = [ @@ -2141,6 +2147,7 @@ project(':storage') { inputs.property "commitId", commitId inputs.property "version", version outputs.file receiptFile + outputs.cacheIf { true } doLast { def data = [ @@ -2235,6 +2242,7 @@ project(':tools:tools-api') { inputs.property "commitId", commitId inputs.property "version", version outputs.file receiptFile + outputs.cacheIf { true } doLast { def data = [