Skip to content

Commit ec67bcd

Browse files
Fix CI: Resolve JDK versions for Android and runtime detection for iOS
- Updated `.github/workflows/maven.yml`: - Android job now installs JDK 17, then JDK 11. - JDK 17 is saved to `JAVA17_HOME` and explicitly used for Android SDK tools (`sdkmanager`, `avdmanager`) and the native build step to satisfy requirements. - JDK 11 remains the default for `mvn install` and other build tasks. - Updated `scripts/ci/run-ios-simulator.sh`: - Added auto-detection logic to find the latest available iOS runtime if the specific requested version is missing, resolving failures on `macos-15` runners. - Updated `scripts/ci/build-thirdparty-app.sh`: - Removed `hellocodenameone` fallback logic; strictly targets `APP_DIR`. - Removed implicit `LATEST` version overriding to fix Maven validation errors.
1 parent 4c136e0 commit ec67bcd

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

.github/workflows/maven.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ jobs:
3232
with:
3333
distribution: temurin
3434
java-version: '17'
35+
- name: Install Android SDK
36+
uses: android-actions/setup-android@v3
37+
with:
38+
packages: platform-tools emulator system-images;android-33;google_apis;x86_64
3539
- name: Set JAVA17_HOME
3640
run: echo "JAVA17_HOME=$JAVA_HOME" >> $GITHUB_ENV
3741
- name: Install Java 11
@@ -45,10 +49,6 @@ jobs:
4549
wget https://github.com/codenameone/CodenameOne/raw/refs/heads/master/maven/CodeNameOneBuildClient.jar -O ~/.codenameone/CodeNameOneBuildClient.jar
4650
- name: Install Libraries (JDK 11)
4751
run: mvn install -DskipTests
48-
- name: Install Android SDK
49-
uses: android-actions/setup-android@v3
50-
with:
51-
packages: platform-tools emulator system-images;android-33;google_apis;x86_64
5252
- name: Enable KVM
5353
run: |
5454
sudo apt-get update
@@ -64,6 +64,7 @@ jobs:
6464
- name: Boot emulator and run smoke test
6565
env:
6666
ANDROID_SDK_ROOT: ${{ env.ANDROID_SDK_ROOT }}
67+
JAVA_HOME: ${{ env.JAVA17_HOME }}
6768
run: |
6869
./scripts/ci/start-android-emulator.sh
6970
adb install -r BTDemo/target/*-android-device.apk

scripts/ci/run-ios-simulator.sh

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Environment variables:
1111
APP_BUNDLE Path to the .app bundle to install (required).
1212
BUNDLE_ID Bundle identifier used to launch the app (required).
1313
SIM_DEVICE_NAME Simulator name to create/use. Default: iPhone 15
14-
SIM_RUNTIME Simulator runtime identifier. Default: iOS 17.2
14+
SIM_RUNTIME Simulator runtime identifier. Default: iOS (auto-detect latest)
1515
SIM_TIMEOUT Seconds to wait for boot and launch. Default: 180
1616
1717
The script will create the simulator if missing, boot it headlessly,
@@ -30,20 +30,32 @@ if [[ -z ${APP_BUNDLE:-} || -z ${BUNDLE_ID:-} ]]; then
3030
fi
3131

3232
SIM_DEVICE_NAME=${SIM_DEVICE_NAME:-"iPhone 15"}
33-
SIM_RUNTIME=${SIM_RUNTIME:-"iOS 17.2"}
33+
SIM_RUNTIME=${SIM_RUNTIME:-"iOS"}
3434
SIM_TIMEOUT=${SIM_TIMEOUT:-180}
3535

3636
function info() {
3737
echo "[ios-sim] $*"
3838
}
3939

4040
function ensure_device() {
41+
# Try to find the exact runtime first, or fallback to the latest available iOS runtime
4142
local runtime_id
42-
runtime_id=$(xcrun simctl list runtimes | awk -v r="$SIM_RUNTIME" '/com.apple.CoreSimulator.SimRuntime/ && $0 ~ r {print $2}')
43+
runtime_id=$(xcrun simctl list runtimes | awk -v r="$SIM_RUNTIME" '/com.apple.CoreSimulator.SimRuntime/ && $0 ~ r {print $2}' | sort | tail -n 1)
44+
45+
# If still not found and SIM_RUNTIME was generic "iOS", look for any iOS runtime
46+
if [[ -z $runtime_id && "$SIM_RUNTIME" == "iOS" ]]; then
47+
runtime_id=$(xcrun simctl list runtimes | awk '/com.apple.CoreSimulator.SimRuntime.iOS/ {print $2}' | sort | tail -n 1)
48+
fi
49+
4350
if [[ -z $runtime_id ]]; then
44-
echo "Simulator runtime $SIM_RUNTIME not found" >&2
51+
echo "Simulator runtime matching '$SIM_RUNTIME' not found" >&2
52+
echo "Available runtimes:" >&2
53+
xcrun simctl list runtimes >&2
4554
exit 1
4655
fi
56+
57+
info "Selected runtime: $runtime_id"
58+
4759
local existing
4860
existing=$(xcrun simctl list devices | awk -v n="$SIM_DEVICE_NAME" -v r="$runtime_id" '$0 ~ n" (" && $0 ~ r {print $1}')
4961
if [[ -n $existing ]]; then

0 commit comments

Comments
 (0)