Skip to content

Commit ec561e1

Browse files
committed
Harden CI Gradle downloads with cache and retries
1 parent 0248c11 commit ec561e1

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,27 @@ jobs:
2121
with:
2222
distribution: 'temurin'
2323
java-version: '11'
24+
cache: 'gradle'
2425

2526
- name: Build and Release
26-
run: ./gradlew clean check shadowJar
27+
env:
28+
GRADLE_OPTS: "-Dorg.gradle.internal.http.connectionTimeout=120000 -Dorg.gradle.internal.http.socketTimeout=120000"
29+
run: |
30+
set -euo pipefail
31+
for attempt in 1 2 3; do
32+
echo "Gradle build attempt ${attempt}/3"
33+
if ./gradlew --no-daemon clean check shadowJar; then
34+
exit 0
35+
fi
36+
37+
if [[ "${attempt}" -lt 3 ]]; then
38+
echo "Build failed, retrying in 15 seconds..."
39+
sleep 15
40+
fi
41+
done
42+
43+
echo "Build failed after 3 attempts."
44+
exit 1
2745
2846
- run: ./scripts/install_local.sh
2947
- name: Checkout
@@ -50,6 +68,7 @@ jobs:
5068
with:
5169
distribution: 'temurin'
5270
java-version: '11'
71+
cache: 'gradle'
5372

5473
- name: Setup Node
5574
uses: actions/setup-node@v4

0 commit comments

Comments
 (0)