diff --git a/.github/workflows/build-common.yml b/.github/workflows/build-common.yml index 399b063b7..e66619ec9 100644 --- a/.github/workflows/build-common.yml +++ b/.github/workflows/build-common.yml @@ -9,6 +9,10 @@ on: no-build-cache: type: boolean required: false + max-test-retries: + type: number + required: false + default: 0 permissions: contents: read @@ -90,6 +94,7 @@ jobs: "-PtestJavaVersion=${{ matrix.test-java-version }}" "-Porg.gradle.java.installations.paths=${{ steps.setup-java-test.outputs.path }}" "-Porg.gradle.java.installations.auto-download=false" + "-PmaxTestRetries=${{ inputs.max-test-retries }}" ${{ inputs.no-build-cache && '--no-build-cache' || '' }} integration-test: @@ -109,7 +114,7 @@ jobs: cache-read-only: ${{ inputs.cache-read-only }} - name: Integration test - run: ./gradlew integrationTest ${{ inputs.no-build-cache && '--no-build-cache' || '' }} + run: ./gradlew integrationTest "-PmaxTestRetries=${{ inputs.max-test-retries }}" ${{ inputs.no-build-cache && '--no-build-cache' || '' }} - name: Save integration test results uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 diff --git a/.github/workflows/build-pull-request.yml b/.github/workflows/build-pull-request.yml index 43827c623..d41d87f5f 100644 --- a/.github/workflows/build-pull-request.yml +++ b/.github/workflows/build-pull-request.yml @@ -16,6 +16,8 @@ jobs: uses: ./.github/workflows/build-common.yml with: cache-read-only: true + # retry in merge queue to avoid unnecessary failures + max-test-retries: ${{ github.event_name == 'merge_group' && 5 || 0 }} link-check: uses: ./.github/workflows/reusable-link-check.yml diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index bf473fff1..6de6f8e1e 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -17,6 +17,7 @@ dependencies { implementation("net.ltgt.gradle:gradle-nullaway-plugin:2.2.0") implementation("org.owasp:dependency-check-gradle:12.1.3") implementation("ru.vyarus.animalsniffer:ru.vyarus.animalsniffer.gradle.plugin:2.0.1") + implementation("com.gradle:develocity-gradle-plugin:4.1.1") } spotless { diff --git a/buildSrc/src/main/kotlin/otel.java-conventions.gradle.kts b/buildSrc/src/main/kotlin/otel.java-conventions.gradle.kts index 17cc114df..ecdd63bd9 100644 --- a/buildSrc/src/main/kotlin/otel.java-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/otel.java-conventions.gradle.kts @@ -66,6 +66,12 @@ tasks { withType().configureEach { useJUnitPlatform() + val maxTestRetries = gradle.startParameter.projectProperties["maxTestRetries"]?.toInt() ?: 0 + develocity.testRetry { + // You can see tests that were retried by this mechanism in the collected test reports and build scans. + maxRetries.set(maxTestRetries) + } + testLogging { exceptionFormat = TestExceptionFormat.FULL showStandardStreams = true