Skip to content

Commit 4c76654

Browse files
authored
Retry in merge queue (#2146)
1 parent 2b8de4b commit 4c76654

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

.github/workflows/build-common.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ on:
99
no-build-cache:
1010
type: boolean
1111
required: false
12+
max-test-retries:
13+
type: number
14+
required: false
15+
default: 0
1216

1317
permissions:
1418
contents: read
@@ -90,6 +94,7 @@ jobs:
9094
"-PtestJavaVersion=${{ matrix.test-java-version }}"
9195
"-Porg.gradle.java.installations.paths=${{ steps.setup-java-test.outputs.path }}"
9296
"-Porg.gradle.java.installations.auto-download=false"
97+
"-PmaxTestRetries=${{ inputs.max-test-retries }}"
9398
${{ inputs.no-build-cache && '--no-build-cache' || '' }}
9499
95100
integration-test:
@@ -109,7 +114,7 @@ jobs:
109114
cache-read-only: ${{ inputs.cache-read-only }}
110115

111116
- name: Integration test
112-
run: ./gradlew integrationTest ${{ inputs.no-build-cache && '--no-build-cache' || '' }}
117+
run: ./gradlew integrationTest "-PmaxTestRetries=${{ inputs.max-test-retries }}" ${{ inputs.no-build-cache && '--no-build-cache' || '' }}
113118

114119
- name: Save integration test results
115120
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2

.github/workflows/build-pull-request.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ jobs:
1616
uses: ./.github/workflows/build-common.yml
1717
with:
1818
cache-read-only: true
19+
# retry in merge queue to avoid unnecessary failures
20+
max-test-retries: ${{ github.event_name == 'merge_group' && 5 || 0 }}
1921

2022
link-check:
2123
uses: ./.github/workflows/reusable-link-check.yml

buildSrc/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ dependencies {
1717
implementation("net.ltgt.gradle:gradle-nullaway-plugin:2.2.0")
1818
implementation("org.owasp:dependency-check-gradle:12.1.3")
1919
implementation("ru.vyarus.animalsniffer:ru.vyarus.animalsniffer.gradle.plugin:2.0.1")
20+
implementation("com.gradle:develocity-gradle-plugin:4.1.1")
2021
}
2122

2223
spotless {

buildSrc/src/main/kotlin/otel.java-conventions.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ tasks {
6666
withType<Test>().configureEach {
6767
useJUnitPlatform()
6868

69+
val maxTestRetries = gradle.startParameter.projectProperties["maxTestRetries"]?.toInt() ?: 0
70+
develocity.testRetry {
71+
// You can see tests that were retried by this mechanism in the collected test reports and build scans.
72+
maxRetries.set(maxTestRetries)
73+
}
74+
6975
testLogging {
7076
exceptionFormat = TestExceptionFormat.FULL
7177
showStandardStreams = true

0 commit comments

Comments
 (0)