Skip to content

Commit dd34253

Browse files
Cache Android CI tools and improve download reliability (#4351)
- Updated `scripts/setup-workspace.sh` to use `repo.maven.apache.org` (CDN) instead of `archive.apache.org` for Maven downloads. - Added `--retry 3 --retry-all-errors` to `curl` commands in `scripts/setup-workspace.sh` for robust downloading of JDKs and Maven. - Added `actions/cache` to `.github/workflows/scripts-android.yml` to cache the `${{ runner.temp }}/codenameone-tools` directory, preventing redundant downloads in CI. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
1 parent c43fc81 commit dd34253

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

.github/workflows/scripts-android.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,13 @@ jobs:
117117
echo "CN1SS_SKIP_COMMENT=1" >> $GITHUB_ENV
118118
echo "CN1SS_FAIL_ON_MISMATCH=1" >> $GITHUB_ENV
119119
echo "CN1SS_SKIP_COVERAGE=1" >> $GITHUB_ENV
120+
- name: Cache codenameone-tools
121+
uses: actions/cache@v4
122+
with:
123+
path: ${{ runner.temp }}/codenameone-tools
124+
key: ${{ runner.os }}-cn1-tools-${{ hashFiles('scripts/setup-workspace.sh') }}
125+
restore-keys: |
126+
${{ runner.os }}-cn1-tools-
120127
- name: Setup workspace
121128
run: ./scripts/setup-workspace.sh -q -DskipTests
122129
- name: Build Android port

scripts/setup-workspace.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ fi
6868

6969
JDK8_URL="https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u462-b08/OpenJDK8U-jdk_${arch_jdk8}_${os}_hotspot_8u462b08.tar.gz"
7070
JDK17_URL="https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.16%2B8/OpenJDK17U-jdk_${arch}_${os}_hotspot_17.0.16_8.tar.gz"
71-
MAVEN_URL="https://archive.apache.org/dist/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.tar.gz"
71+
MAVEN_URL="https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.tar.gz"
7272

7373
install_jdk() {
7474
local url="$1" dest_var="$2"
@@ -78,7 +78,7 @@ install_jdk() {
7878
log "Using cached JDK archive $(basename "$archive")"
7979
else
8080
log "Downloading JDK from $url"
81-
curl -fL "$url" -o "$archive"
81+
curl -fL --retry 3 --retry-all-errors "$url" -o "$archive"
8282
fi
8383

8484
local top
@@ -130,7 +130,7 @@ if [ -z "${MAVEN_HOME:-}" ] || ! [ -x "$MAVEN_HOME/bin/mvn" ]; then
130130
log "Using cached Maven archive $(basename "$mvn_archive")"
131131
else
132132
log "Downloading Maven from $MAVEN_URL"
133-
curl -fL "$MAVEN_URL" -o "$mvn_archive"
133+
curl -fL --retry 3 --retry-all-errors "$MAVEN_URL" -o "$mvn_archive"
134134
fi
135135
mvn_top=$(tar -tzf "$mvn_archive" 2>/dev/null | head -1 | cut -d/ -f1 || true)
136136
if [ -z "$mvn_top" ]; then

0 commit comments

Comments
 (0)